griffpatch / Scratch3-Dev-Tools

Scratch 3 Dev Tools Browser Extension
GNU General Public License v3.0
35 stars 18 forks source link

Make an RGB number input for editor. #8

Open Sheshank-s opened 5 years ago

Sheshank-s commented 5 years ago

I'm making this now on my branch. I'll send a merge request soon.

Sheshank-s commented 5 years ago

Sorry I started this, and then i had schol work. I'll get it done by the end of the day for sure! Also @griffpatch can you confirm this idea?

griffpatch commented 5 years ago

No hurry don't fret :) - Could you outline what your idea is in a little more detail?

Sheshank-s commented 5 years ago

Yeah! image

When you input the hex code it updates the other things. I made the html already im just working on the js now

griffpatch commented 5 years ago

Cool!

Sheshank-s commented 5 years ago

Weird, since the popup is a react container, adding HTML to it breaks the popup (sliders don't work).

Sheshank-s commented 5 years ago

Never mind that ^ I found a work around

Sheshank-s commented 5 years ago

Hmm... I'm not able to change the color. I tried simulating the slider moving and then a click but the click won't happen at the place i want, it only goes to the beginning of the slider.

Sheshank-s commented 5 years ago

Do you have any ideas on how i can get it to work?

ghost commented 5 years ago

I don't know, but try to use the function setColor(color) and look at https://github.com/LLK/scratch-paint/blob/develop/src/containers/color-picker.jsx

Sheshank-s commented 5 years ago

How would I be able to access that function from the extension though?

griffpatch commented 5 years ago

Interfacing with the existing framework can be really difficult, if not impossible... I am having great trouble finding creatine ways of doing things!

On Sat, 21 Sep 2019, 19:34 Sheshank Shankar, notifications@github.com wrote:

How would I be able to access that function from the extension though?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/griffpatch/Scratch3-Dev-Tools/issues/8?email_source=notifications&email_token=ABTM3PXQXGJ5KWF446AEJ2DQKZSM7A5CNFSM4IX6E622YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7IXIXY#issuecomment-533820511, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTM3PXP3RVHCNNM62NLKY3QKZSM7ANCNFSM4IX6E62Q .

Sheshank-s commented 5 years ago

@griffpatch Yeah... One option is we can set the left value of the slider to the correct places, and then the user would need to move one of the sliders a little bit to the left so that it updates... but that's a really crappy way of doing it.

Sheshank-s commented 5 years ago

@griffpatch @RaspberryPiFan Doing something like this document.getElementsByClassName("slider_container_o2aIb")[0].click() Resets the slider to 0. If there is a way to click at a certain position on the slider, that might work.

Sheshank-s commented 5 years ago

Another idea, we can generate an image in the extension, so that the user can click the extension, put in hex value, copy image, paste in scratch editor, then use color picker.

That's really time consuming for user though..

griffpatch commented 5 years ago

@griffpatch @RaspberryPiFan Doing something like this document.getElementsByClassName("slider_container_o2aIb")[0].click() Resets the slider to 0. If there is a way to click at a certain position on the slider, that might work.

Don't reference the class name ending in _o2aIb because this could change with each build of scratch. Instead you need to locate the element using a selector like this:

let find = document.querySelector('[class*=slidercontainer]')

Sheshank-s commented 5 years ago

@griffpatch Okay cool. Should I just make it so that it says underneath the hex code what the color brightness and saturation should be?

Sheshank-s commented 5 years ago

image And then the user has to move the sliders, that should work!

Explosion-Scratch commented 4 years ago

What if we use the existing framework for the color picker to simulate using it?