Skip to content

Add cursor style for morphs#62

Open
ego-lay-atman-bay wants to merge 3 commits intojmoenig:masterfrom
ego-lay-atman-bay:cursor-style
Open

Add cursor style for morphs#62
ego-lay-atman-bay wants to merge 3 commits intojmoenig:masterfrom
ego-lay-atman-bay:cursor-style

Conversation

@ego-lay-atman-bay
Copy link
Contributor

@ego-lay-atman-bay ego-lay-atman-bay commented Aug 8, 2023

This adds a new cursorStyle attribute to Morphs, which is what the cursor turns into when hovering over the Morph. It's initially null, which you can change to any css cursor. The code that changes the cursor (aka, sets the canvas style to show the cursor) looks for the first Morph under the mouse that does not have a null cursorStyle, and then uses that. I also made sure to keep the cursor when dragging a Morph (unless it's null, we can discuss whether that's the best behavior). There's also a cursorGrabStyle which is used when the Morph is currently being dragged (aka, grabbed).

I just decided to do this because I felt that it would make snap feel more interactive.

@ego-lay-atman-bay
Copy link
Contributor Author

ego-lay-atman-bay commented Aug 8, 2023

I have also put these changes into my snap mod, so if you want to see what it could look like, here it is.
https://ego-lay-atman-bay.github.io/Snap/snap.html

@jmoenig
Copy link
Owner

jmoenig commented Aug 16, 2023

This is nice, thank you!

I'm currently not really sure whether I want to extend Morphic with cursor shapes. There was a time - a decade ago - when I would've really killed for it, but it didn't work across browsers back then, and I sort of killed my desire for it then :)

But there's another feature you've been pioneering (I think) that some of us (especially me) are very interested in: Wasn't it you who made a beautiful patch that adds flat dark mode to Snap? If I'm wrong about that then sorry, otherwise I'd love to talk to you about it!

@jmoenig
Copy link
Owner

jmoenig commented Aug 17, 2023

I've had a closer look at your fork, and I love it, mostly everything I see, and I might not have noticed evrerything! You're right, the "live" mouse pointers are awfully nice to use! There seems to be an issue about Morphic not (yet) noticing some subtle state changes, such as when the user releases the mouse button after dragging something without moving the mouse, but those might just have to be added.
I also noticed your changes to the "skin", including the "flat" and "dark/light" settings. I love those! And you've even added a nice dialog that lets users configure the colors of the UI, what a beautiful hack!
Hey, thinking about all of these I really like them. How would you feel about merging them all into the main Snap! branch for v10? If you're interested just drop me note (here or via email), I'd like to discuss this further with you!
Thank you, thank you for sharing these wonderful hacks!

@ego-lay-atman-bay
Copy link
Contributor Author

ego-lay-atman-bay commented Aug 17, 2023 via email

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants