Closed BurntPizza closed 9 years ago
Events are now distributed via broadcast from the parent ColorChooser:
https://github.com/BurntPizza/Paint.JAVA/commit/e761e464313b8149fc546d48a2904b1ce4948bc0
This looks pretty sweet.
Silly Swing, that's not how backbuffers work!
Great work. This is amazing.
Unfortunately I didn't get a whole lot done today, but I did get the primary/secondary selector and the beginnings of a layout:
Also you get to finally see it without the gif artifacts!
https://github.com/BurntPizza/Paint.JAVA/commit/8dde6663ca09130130b59234d634aa4573f747b8
Ok, so I re-worked the events again, I think it's good now. Try it out: ColorChooser.jar
Took me a minute to glitch it:
To reproduce:
(The hue should still be yellow, but it switches to red)
Also note that the border stays around the pallette colour even though I'm not using it anymore.
Apart from that, it works very nicely.
Download it again (new version)
Both things you mentioned are taken care of :) The pallet will select a color if it has a swatch matching the current primary. I plan on adding keyboard support so that arrows keys or WASD will navigate through the pallet. How does that sound?
I don't have access to my computer right now so I can't test it right now.
Keyboard support sounds good. Could you also get it to work for the sliders?
@BurntPizza: I've been trying to merge this in but it doesn't work.
The .jar version you linked above works fine, but the one on your branch doesn't allow any of the sliders or the wheel to be moved.
That's weird... the experimental branch? It's the same code I'm pretty sure.
Yep. I merged in the experimental branch and ran the main method in ColorChooser.java.
If the last version you uploaded was from the commit marked in your comment (https://github.com/BurntPizza/Paint.JAVA/commit/20b43c5235233f869274d6d1bac27bfdeb16eff0) then the bug must have been introduced somewhere in the last two commits.
Edit: Tried again without the last two commits and it still doesn't work.
Aha. Found the problem. It was my fault. I changed the MathUtils.clamp() method to take the arguments (value, min, max) instead of (value, max, min) because it was more intuitive.
Sorry about that.
I really need to make it throw an IllegalArgumentException when that happens.
All working now.
So far I've added some support for left/right click to change primary/secondary, but obviously it isn't possible to do for the sliders.
I've had a look at the layout, and started work on some more components (number input fields next to the sliders), as well as toggling the visibility of different components to have different level of control.
I've finished my work for now. Here's some screenshots: http://imgur.com/a/Qq4oS
Actually, I just realised I forgot a hex colour field. I think I'll ditch the 'Settings' button.
Nice!
Couldn't the Less button disappear in the mini version? Might be able to squeeze something in that way. Same with "More" int the fully extended.
Turns out the hex input field needed more space than I thought (it wouldn't fit on the minimized versions), so instead I made it popup when you right click on the indicator. (Also supports right clicking the secondary colour)
Also, while I was trying to make some buttons smaller, Swing for some reason decides that +
was too big for a button, so it instead replaces the text with ...
which is even larger.
This will mostly be a progress thread for the ColorChooser, feel free to make comments/suggestions at any point.
Latest progress: ColorComponenets are now linkable via ColorListeners:
https://github.com/BurntPizza/Paint.JAVA/commit/bf8fab51e06a0b065d96d1bb30ab847e66420663
Unfortunately Wheel-to-slider events are being stupid, so they aren't done yet.
ColorChooser test frame is here