We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f5167cd commit 4c642d4Copy full SHA for 4c642d4
objectdrawPrograms/crossHairs.grace
@@ -0,0 +1,25 @@
1
+dialect "objectdraw"
2
+print(1@2)
3
+def crossHairs = object {
4
+ inherits graphicApplicationSize(400@400)
5
+
6
+ // lines forming crosshairs
7
+ def vertical = lineFrom ((canvas.width/2) @ 0)
8
+ to ((canvas.width/2) @ (canvas.height)) on (canvas)
9
+ def horizontal =
10
+ lineFrom(0 @ (canvas.height/2)) to ((canvas.width) @ (canvas.height/2)) on (canvas)
11
12
+ // Move the lines to follow the mouse
13
+ method onMouseDrag(point) {
14
15
+ vertical.setEndPoints((point.x) @ 0,
16
+ (point.x) @ (canvas.height))
17
+ horizontal.setEndPoints(0 @ (point.y),
18
+ (canvas.width) @ (point.y))
19
+ }
20
21
+ def shapes: Choice = menuWithOptions ["FramedSquare","FramedCircle"]
22
23
+ // required to pop up window and start graphics
24
+ startGraphics
25
+}
0 commit comments