Docs: Fix unclear text in reactivity example (#9217)

This commit is contained in:
Nigel Breslaw 2025-08-21 15:06:52 +03:00 committed by GitHub
parent 1479c3f579
commit 007cfd26b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,23 +22,21 @@ export component MyComponent {
myRect := Rectangle { myRect := Rectangle {
x: ta.mouse-x; x: ta.mouse-x;
y: ta.mouse-y; y: ta.mouse-y;
width: 40px; width: 60px;
height: 40px; height: 60px;
background: ta.pressed ? orange : white; background: ta.pressed ? orange : skyblue;
}
Text { Text {
x: 5px; y: 5px; x: 5px; y: 5px;
text: "x: " + myRect.x / 1px; text: "x: " + myRect.x / 1px;
color: white; color: white;
} }
Text { Text {
x: 5px; y: 15px; x: 5px; y: 20px;
text: "y: " + myRect.y / 1px; text: "y: " + myRect.y / 1px;
color: white; color: white;
} }
} }
}
``` ```
As the name suggests, Reactivity is all about parts of the user interface automatically updating or 'reacting' As the name suggests, Reactivity is all about parts of the user interface automatically updating or 'reacting'
@ -124,18 +122,19 @@ export component MyComponent {
myRect := Rectangle { myRect := Rectangle {
x: ta.mouse-x; x: ta.mouse-x;
y: ta.mouse-y; y: ta.mouse-y;
width: 40px; width: 60px;
height: 40px; height: 60px;
background: ta.pressed ? orange : white; background: ta.pressed ? orange : skyblue;
}
Text { Text {
x: 5px; y: 5px; x: 5px; y: 5px;
text: "x: " + lengthToInt(myRect.x); text: "x: " + lengthToInt(myRect.x);
color: white;
} }
Text { Text {
x: 5px; y: 15px; x: 5px; y: 20px;
text: "y: " + lengthToInt(myRect.y); text: "y: " + lengthToInt(myRect.y);
color: white;
}
} }
} }
``` ```