summaryrefslogtreecommitdiff
path: root/public/js/p5_custom.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/p5_custom.js')
-rw-r--r--public/js/p5_custom.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/public/js/p5_custom.js b/public/js/p5_custom.js
index 19a8dd0..53a1156 100644
--- a/public/js/p5_custom.js
+++ b/public/js/p5_custom.js
@@ -40,8 +40,15 @@ draw_arrow=function(p,x1,y1,x2,y2,elt=null,canvas,skiparrow=false,flip=false){
yfactor=-yfactor
}
- cp=canvas.position()
- elt.position(cp.x+center.x+justify*xfactor-5,cp.y+center.y-justify*yfactor-elt.elt.offsetHeight/2)
+ cp=canvas.position()
+ elt_x=cp.x+center.x+justify*xfactor-5
+ elt_y=cp.y+center.y-justify*yfactor-elt.elt.offsetHeight/2
+ if (elt_x<cp.x || elt_y < cp.y || elt_x>(canvas.width+cp.x) || elt_y>(canvas.height+cp.y)){
+ elt.elt.style.display="none"
+ } else {
+ elt.elt.style.display="block"
+ }
+ elt.position(elt_x,elt_y)
}