From 29d86556cabfca8f7397e7246ee710011ea988a9 Mon Sep 17 00:00:00 2001 From: Nyeogmi Date: Sat, 17 Dec 2022 13:45:46 -0800 Subject: [PATCH] Again, reduce the level of useless work --- chameleonic.p8 | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/chameleonic.p8 b/chameleonic.p8 index a2219d2..d4f9d99 100644 --- a/chameleonic.p8 +++ b/chameleonic.p8 @@ -679,8 +679,13 @@ function rope:drag( for x,y in self:_rast( anc.x,anc.y,x,y ) do - self:_drag1(i(),x,y) - self:_tidy_up_gen() + local a=self:_anc(i()) + if not (_point_eq(a, {x=x,y=y})) then + a.x=x + a.y=y + a.dirty=true + self:_tidy_up_gen() + end end end @@ -748,17 +753,6 @@ function rope:_tidy_up_gen() end end -function rope:_drag1( - i,x,y -) - local a=self:_anc(i) - if (_point_eq(a, {x=x,y=y})) return - - a.x=x - a.y=y - a.dirty=true -end - function rope:_find_needed_anchors(i) if (i<=0) return false if (#self.ancs+1