Skip to content
This repository was archived by the owner on Mar 5, 2021. It is now read-only.

Background color scene#141

Open
YannDub wants to merge 2 commits into
superpowers:masterfrom
YannDub:background_color_scene
Open

Background color scene#141
YannDub wants to merge 2 commits into
superpowers:masterfrom
YannDub:background_color_scene

Conversation

@YannDub

@YannDub YannDub commented Sep 5, 2016

Copy link
Copy Markdown

I had work on the issue #58 , I have just one problem, I use SupClient.table.appendColorField but the result type is an Association of pickerField and TextField. The change event is called on the picker field but not on the text field.

I think it would good to change the text value and the picker value at same time.

@bilou84

bilou84 commented Sep 11, 2016

Copy link
Copy Markdown
Contributor

Hello and thanks for your contribution!

I'm sorry to say that it should have been done a bit differently. The way you did makes it a synchronized setting shared across all user which is not something we want.

In this case, it should be a user setting like for instance the keymap in the script editor.
Here are the code where it's done so you can take inspiration from that!
https://github.com/superpowers/superpowers-common-plugins/blob/master/textEditorWidget/settingsEditors/TextEditorSettingsEditor.ts#L36-L44
https://github.com/superpowers/superpowers-common-plugins/blob/master/textEditorWidget/settingsEditors/TextEditorSettingsEditor.ts#L36-L44

And here is how it's used:
https://github.com/superpowers/superpowers-common-plugins/blob/master/textEditorWidget/widget/widget.ts#L82
https://github.com/superpowers/superpowers-common-plugins/blob/master/textEditorWidget/widget/widget.ts#L103-L105

Also make sure to store the value without the #. To convert the string to an hexadecimal value when setting it in the engine, you should use parseInt(colorString, 16);

As for the color field, I agree that it should be easier to work with so I just made the change here:
superpowers/superpowers-core@31b49ce
And here is an example on how to use it:
https://github.com/superpowers/superpowers-game/blob/master/plugins/default/sprite/componentEditors/SpriteRendererEditor.ts#L109-L114

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants