Canvas drawing drag problem

draw the subway map to achieve the drag function, the first drag is normal, the back drag will appear a backward effect in the opposite direction.

function clickSubway(e) {
    isDrag=true;
    start_x=e.pageX-draw.offsetLeft;
    start_y=e.pageY-draw.offsetTop;

}
//
function dragSubway(e) {
    end_x=e.pageX-draw.offsetLeft;
    end_y=e.pageY-draw.offsetTop;
    mx=end_x-start_x;
    my=end_y-start_y;  //,
    if(isDrag){
        drawSubway();
    }

}

function stopDrag(e) {
    isDrag=false;
    e.stopPropagation();
    e.preventDefault();

}
Feb.28,2021

because of the border. Have you considered the width of the frame?


similar problems have been encountered, but I draw with SVG, mainly because the problem of the parent container seems to be, you can pay attention to

Menu