How can I make a panel with diagonal "click zones"?
-
I made some diagonal text using panels which is done using rotation.
Rotation does not actually rotate the panel though, it rotates the graphics "canvas", so the panels are still on right angles.I want to make "click zones" for each text strip area, but the way the panels overlap, they are only leave vertical zones:
So the click zone associated with each text strip is not good this way.
I would like to use an invisible panel overlay to get the clicks.
How can I use a mouse callback to separate the area diagonally to make "click zones" for each strip?
The purpose here is to open a panel to change the text for each slot:
-
@VirtualVirgin There is no built in way to do this. You'd need to use some maths (trigonometry) to create the click zones in the mouse callback.
-
@d-healey Thanks David :)
I have another question about using the label:
When I double-click I make the panel and label visible to change the text like the above picture.
When I enter text I have the control callback for the label set:inline function onLabelControl(component, value) { local index = matrix0LabelArray.indexOf(component); if (component) { component.set("visible", false); matrix0LabelPanelArray[index].set("visible", false); matrix0PanelArray[index].set("visible", true); matrix0PanelArray[index].set("text", component.get("text")); matrix0PanelArray[index].repaint(); Console.print("onLabelControl callback has been exectued"); } };
That hides the label for text entry and makes the panel with the diagonal text visible.
I am trying to help the behaviour though.
It only works if I enter a new text.
If keep the same text and hit "enter", or I hit "esc" or I click somewhere else, the callback is not executed so the label for text entry just remains visible.
How can I make it execute when those other things happen?
Can I detect a mouse click off of the label, or when the "esc" key is used? -
@VirtualVirgin said in How can I make a panel with diagonal "click zones"?:
if (component)
When will this ever not be true?
@VirtualVirgin said in How can I make a panel with diagonal "click zones"?:
How can I make it execute when those other things happen?
See if enabling the
updateEachKey
property works.@VirtualVirgin said in How can I make a panel with diagonal "click zones"?:
Can I detect a mouse click off of the label, or when the "esc" key is used?
You can use
setKeyPressCallback()
with most controls, I think that includes labels. This also triggers based on focus changes. -
@VirtualVirgin @d-healey No need for trigo! Assuming a 45° angle...
HiseSnippet 1030.3ocsV0taaaCEkxIZKVXcaEsO.D8WxMYp9q5jrrflFGmUiU6ZL21r8q.ZIJKBKQZPQEWig7NrGq83r2fsKkjijSxxFLVMfMz8KxiN7buzijBWZbrPhLrd+x4TjwWYNdIWEzMfv3n9mgL9ZyAjXE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jGrg11HOXiUAQQDWo3R2rtO8kX6j5AvDO8R9pv+1.rwMPocjk44H3N0KccWeotSgM2zBasoE1dSK7kaZgc1zB2eSK7f+8B0+kmWmnDQYsMHzfQ8RGmYXziS.EXpZE82TYi6OC
-
@ustk Ooh that's really elegant, maybe one for the snippet browser or the docs.
-
@ustk Nice done!