Skip to content
Snippets Groups Projects
Commit 8dca3172 authored by Michael Leuschel's avatar Michael Leuschel
Browse files

use more features in the button example

parent a5286649
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
{ {
"id": "button", "id": "button",
"attr": "stroke-width", "attr": "stroke-width",
"value": "IF ENABLED(\"press_button\") THEN 6 ELSE 1 END" "value": "IF ENABLED(\"press_button\") THEN 6 ELSE 1 END",
"ignore": "is now used in hover below"
}, },
{ {
"id": "button_%0", "id": "button_%0",
...@@ -21,15 +22,19 @@ ...@@ -21,15 +22,19 @@
"events": [ "events": [
{ {
"id": "button", "id": "button",
"event": "toggle_button" "event": "toggle_button",
"hover": { "attr":"stroke-width", "enter":"6", "leave":"1"}
}, },
{ {
"id": "button_TRUE", "id": "button_TRUE",
"event": "toggle_button" "event": "toggle_button",
"hover": { "attr":"stroke-width", "enter":"3", "leave":"1", "id":"button"}
}, },
{ {
"id": "button_FALSE", "id": "button_FALSE",
"event": "press_button" "event": "set_button",
"predicates" : ["newVal = bool(%shiftKey=FALSE)"],
"hover": { "attr":"stroke-width", "enter":"5", "leave":"1", "id":"button"}
} }
] ]
} }
...@@ -12,5 +12,8 @@ OPERATIONS ...@@ -12,5 +12,8 @@ OPERATIONS
END; END;
toggle_button = BEGIN toggle_button = BEGIN
button:= bool(button=FALSE) button:= bool(button=FALSE)
END;
set_button(newVal) = PRE newVal:BOOL THEN
button := bool(newVal=TRUE)
END END
END END
\ No newline at end of file
<svg height="230" width="200"> <svg height="240" width="200">
<circle id="button" cx="100" cy="100" r="80" <circle id="button" cx="100" cy="100" r="80"
stroke="black" stroke-width="3" fill="green" /> stroke="black" stroke-width="3" fill="green" />
<text text-align="left" x="50" y="190" <text text-align="left" x="50" y="190"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment