From 1fbcd89f56c28451a3940a37a25f673cdd27bfc9 Mon Sep 17 00:00:00 2001 From: villares Date: Sat, 4 Apr 2020 01:07:29 -0300 Subject: [PATCH] Update sketch_2020_04_03a.pyde --- .../sketch_2020_04_03a.pyde | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/2020/sketch_2020_04_03a/sketch_2020_04_03a.pyde b/2020/sketch_2020_04_03a/sketch_2020_04_03a.pyde index f2fd4aac..dba3dda4 100644 --- a/2020/sketch_2020_04_03a/sketch_2020_04_03a.pyde +++ b/2020/sketch_2020_04_03a/sketch_2020_04_03a.pyde @@ -21,15 +21,13 @@ permitDrag = [False] * 4 def setup() : size(300, 300) smooth() - # startpocoordinates + # startpoint coordinates x[0] = x[1] = 50 y[0] = 50 y[1] = y[2] = 150 x[2] = x[3] = 250 y[3] = 250 - - - + def draw() : background(255) noFill() @@ -51,32 +49,26 @@ def draw() : else: fill(0) ellipse(x[i], y[i], 5, 5) - - - # permit dragging for i in range(4): if permitDrag[i]: x[i] = mouseX - y[i] = mouseY - + y[i] = mouseY def mouseReleased () : for i in range(4): permitDrag[i] = False - - def mousePressed () : for i in range(4): if (x[i]-5 <= mouseX <= x[i]+10 and y[i]-5 <= mouseY <= y[i]+10): permitDrag[i] = True -# hand curser when over dragging over points +# hand cursor when over dragging over points def mouseMoved () : cursor(ARROW) for i in range(4): - if (mouseX>=x[i]-5 and mouseX<=x[i]+10 and mouseY>=y[i]-5 and mouseY<=y[i]+10) : + if (x[i]-5 <= mouseX <= x[i]+10 and + y[i]-5 <= mouseY <= y[i]+10): cursor(HAND) -