There is a zoomed jcanvas and there is a rectangle layer on image above it. If I drag or move the rectangle layer with mouse the position of layer quicker / slower than mouse depending on the zoom value.
I tried to solve the problem with updateDragX and updateDragY but the rectangle jumped over when the value of zoom was larger than 1.
`smpl.canvas.addLayer( {
type: “rectangle”,
name: “Rectangle”,
strokeStyle: smpl.stroke,
strokeWidth: smpl.strokew,
strokeDash:[ 5, 5 ],
x: p.x,
y: p.y,
width: p.width – 5,
height: p.height – 5,
draggable: true,
drag: function(e){
// some code here
},
handlemove: function(e){
// some code here
},
resizeFromCenter: false,
constrainProportions: false,
handlePlacement: ‘both’,
handle:{
type: “arc”,
fillStyle: smpl.fillStyle,
strokeStyle: stroke,
strokeWidth: strokew,
radius: radius,
},
updateDragX: function( layer, x ) {
return Math.round( x / zoom);
},
updateDragY: function ( layer, y ) {
return Math.round( y / smpl.zoom);
}
}).drawLayers();
user25321778 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.