So my problem is that the dragged object is always drawn on top of other objects.
Give up the script .
and my code is :
<!DOCTYPE HTML> <html> <head> <style> body { margin: 0px; padding: 0px; } canvas { border: 1px solid #9C9898; } </style> <script src="http://www.html5canvastutorials.com/libraries/kinetic-v4.3.1-beta.js"></script> <script> window.onload = function() { var stage = new Kinetic.Stage({ container: 'container', width: 578, height: 200 }); var cableLayer = new Kinetic.Layer(); </script> </head> <body onmousedown="return false;"> <div id="container"></div> </body> </html>
So, I tried to set the index using
cable.on('dragmove', (function () { c1.setPosition([cable.getPosition().x + cable.getPoints()[0].x, cable.getPosition().y + cable.getPoints()[0].y]); c2.setPosition([cable.getPosition().x + cable.getPoints()[1].x, cable.getPosition().y + cable.getPoints()[1].y]); c2.setIndex(1); c1.setIndex(1); cable.setIndex(2); cableLayer.draw(); }));
Doesn't seem to work? Why is this? How to make circles draw along the entire line in all cases? This is basically the case when you drag a line.
Somewhere I install it differently somewhere else?
thanks for the help
source share