-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for per scene and project wide DMG palettes #1601
base: develop
Are you sure you want to change the base?
Changes from all commits
0c5dc0b
27c9f71
a840e83
feb87db
5c1579b
8af70eb
b979450
e65305e
491cc10
6f01ceb
0e8ac08
ebbad21
adfdd17
a5b470a
8cd7007
dbb4514
ffcbf8d
7a59195
3237f33
591b584
53209d2
736c0da
1df68d9
d334907
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import { | |
backgroundSelectors, | ||
sceneSelectors, | ||
} from "store/features/entities/entitiesState"; | ||
import settingsActions from "store/features/settings/settingsActions"; | ||
import editorActions from "store/features/editor/editorActions"; | ||
import electronActions from "store/features/electron/electronActions"; | ||
import { SceneSelect } from "components/forms/SceneSelect"; | ||
|
@@ -66,7 +67,12 @@ const BackgroundPreviewSettings = ({ | |
); | ||
const [isOpen, setIsOpen] = useState<boolean>(false); | ||
const [buttonFocus, setButtonFocus] = useState<boolean>(false); | ||
const value = useAppSelector((state) => state.editor.previewAsSceneId); | ||
const value = useAppSelector((state) => { | ||
if (state.project.present.settings.previewAsMono) return "0"; | ||
const sceneId = state.editor.previewAsSceneId; | ||
if (sceneId === "") return "1"; | ||
return sceneId; | ||
}); | ||
const scene = useAppSelector((state) => | ||
sceneSelectors.selectById(state, value) | ||
); | ||
|
@@ -144,6 +150,11 @@ const BackgroundPreviewSettings = ({ | |
}; | ||
|
||
const onChange = (newValue: string) => { | ||
dispatch( | ||
settingsActions.editSettings({ | ||
previewAsMono: (newValue == "0"), | ||
}) | ||
); | ||
dispatch(editorActions.setPreviewAsSceneId(newValue)); | ||
}; | ||
Comment on lines
152
to
159
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm also using the "preview as" drop down selection to drive the |
||
|
||
|
@@ -173,7 +184,7 @@ const BackgroundPreviewSettings = ({ | |
onBlur={closeMenu} | ||
maxMenuHeight={200} | ||
optional | ||
optionalLabel={l10n("FIELD_DEFAULT_COLORS")} | ||
optionalLabels={[l10n("FIELD_COLOR_MODE_MONO"), l10n("FIELD_DEFAULT_COLORS")]} | ||
{...selectMenuStyleProps} | ||
/> | ||
</SelectMenu> | ||
|
@@ -190,7 +201,8 @@ const BackgroundPreviewSettings = ({ | |
? l10n("FIELD_PREVIEW_AS_SCENE", { | ||
sceneName: sceneName(scene, sceneIndex), | ||
}) | ||
: l10n("FIELD_PREVIEW_AS_DEFAULT")} | ||
: ([l10n("FIELD_PREVIEW_AS_MONO"), l10n("FIELD_PREVIEW_AS_DEFAULT")][+value]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As someone who has never used TypeScript before, I found the |
||
} | ||
</Pill> | ||
<FixedSpacer width={5} /> | ||
</> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a mono mode, similar to the one found on the world page, to the "preview as" drop down. Previously, only one non-scene option was available in this drop down, "Default Colors", which was used when
previewAsSceneId
was "". To facilitate more options, I'm just using the stringified index of the non-scene values. To ensure a consistent experience when switching between pages, I set the default state to "0" whenpreviewAsMono
and "1" whenpreviewAsSceneId
is unset.