[英]how to manage zoom and length handle in papaya
What I want to do is 我想做的是
1) I want to draw a length on image and want to add handle to edit it. 1)我想在图像上绘制一个长度,并想添加手柄以对其进行编辑。
2) When I want to zoom the image the drawn length should match the zoom level. 2)当我要缩放图像时,绘制的长度应与缩放级别匹配。
ctx.beginPath();
ctx.moveTo(linearr[i].x1, linearr[i].y1);
ctx.lineTo(linearr[i].x2, linearr[i].y2);
ctx.closePath();
ctx.stroke();
ctx.beginPath();
ctx.arc(linearr[i].x1, linearr[i].y1, 2, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fillStyle = 'green';
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.arc(linearr[i].x2, linearr[i].y2, 2, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fillStyle = 'green';
ctx.fill();
ctx.stroke();
where linearr
is an array 其中
linearr
是一个数组
Papaya already supports a ruler tool , if that's what you're looking for. 如果您正在寻找的话,Papaya已经支持标尺工具 。
Otherwise, see the function papaya.viewer.Viewer.prototype.drawRuler()
for an example of how to use the screen transform to draw lines, which includes the zoom transform. 否则,请参见函数
papaya.viewer.Viewer.prototype.drawRuler()
以获取有关如何使用屏幕变换绘制线条(包括缩放变换papaya.viewer.Viewer.prototype.drawRuler()
的示例。 Another function that might be helpful to you is this.selectedSlice.findProximalRulerHandle()
. 另一个可能对您有帮助的函数是
this.selectedSlice.findProximalRulerHandle()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.