|
@@ -37,6 +37,7 @@ export class AssistCtrl {
|
|
const size = this.ctrl._selCanvaseSize;
|
|
const size = this.ctrl._selCanvaseSize;
|
|
const ctx = this.ctrl._selCtx;
|
|
const ctx = this.ctrl._selCtx;
|
|
const cardBox = this.ctrl.getCurrCardBox();
|
|
const cardBox = this.ctrl.getCurrCardBox();
|
|
|
|
+ const veiewBox = this.ctrl.getViewPortBox();
|
|
|
|
|
|
const ObjC = this.ctrl.objContainer
|
|
const ObjC = this.ctrl.objContainer
|
|
const bound = ObjC.getBound()
|
|
const bound = ObjC.getBound()
|
|
@@ -47,50 +48,54 @@ export class AssistCtrl {
|
|
ctx.fillStyle = "orange";
|
|
ctx.fillStyle = "orange";
|
|
|
|
|
|
//左边
|
|
//左边
|
|
|
|
+
|
|
|
|
+
|
|
let x = (cardBox.x + bound.x)*2;
|
|
let x = (cardBox.x + bound.x)*2;
|
|
let y = (cardBox.y + bound.y + bound.height / 2.0) *2
|
|
let y = (cardBox.y + bound.y + bound.height / 2.0) *2
|
|
- ctx.moveTo(x, y); // Move the pen to (30, 50)
|
|
|
|
- ctx.lineTo(cardBox.x *2 , y); // Draw a line to (150, 100)
|
|
|
|
- ctx.stroke(); // Render the path
|
|
|
|
- //关闭当前的绘制路径
|
|
|
|
- ctx.closePath();
|
|
|
|
const tl = ( x - cardBox.x*2).toFixed(0);
|
|
const tl = ( x - cardBox.x*2).toFixed(0);
|
|
- ctx.fillText(tl, cardBox.x*2, y - 18);
|
|
|
|
|
|
+ const m = ctx.measureText(tl)
|
|
|
|
+ ctx.moveTo(veiewBox.left *2, y);
|
|
|
|
+ ctx.lineTo(veiewBox.left *2 + 30, y);
|
|
|
|
+ ctx.stroke();
|
|
|
|
+ ctx.closePath();
|
|
|
|
+ ctx.fillText(tl, veiewBox.left *2, y - 18);
|
|
|
|
|
|
//右边
|
|
//右边
|
|
x = (cardBox.x + bound.x + bound.width);
|
|
x = (cardBox.x + bound.x + bound.width);
|
|
const x2 = (cardBox.x + cardBox.width);
|
|
const x2 = (cardBox.x + cardBox.width);
|
|
- ctx.moveTo(x*2, y); // Move the pen to (30, 50)
|
|
|
|
- ctx.lineTo( x2*2, y); // Draw a line to (150, 100)
|
|
|
|
- ctx.stroke(); // Render the path
|
|
|
|
- ctx.closePath();
|
|
|
|
const tr = ((x2-x)*2).toFixed(0);
|
|
const tr = ((x2-x)*2).toFixed(0);
|
|
- const m = ctx.measureText(tr)
|
|
|
|
- ctx.fillText(tr, x2*2 - m.width, y-18);
|
|
|
|
|
|
+ const m2 = ctx.measureText(tr)
|
|
|
|
+
|
|
|
|
+ ctx.beginPath(); // Start a new path
|
|
|
|
+ ctx.moveTo(veiewBox.right*2.0, y);
|
|
|
|
+ ctx.lineTo( veiewBox.right*2.0 - 30, y);
|
|
|
|
+ ctx.stroke();
|
|
|
|
+ ctx.closePath();
|
|
|
|
+ ctx.fillText(tr, veiewBox.right*2.0 - m2.width, y-18);
|
|
|
|
|
|
//上边
|
|
//上边
|
|
x = cardBox.x + cardBox.width / 2.0;
|
|
x = cardBox.x + cardBox.width / 2.0;
|
|
y = cardBox.y;
|
|
y = cardBox.y;
|
|
|
|
|
|
- ctx.moveTo(x*2, y*2); // Move the pen to (30, 50)
|
|
|
|
- ctx.lineTo( x*2, (y + bound.y)*2); // Draw a line to (150, 100)
|
|
|
|
|
|
+ ctx.beginPath(); // Start a new path
|
|
|
|
+ ctx.moveTo(x*2, veiewBox.top*2); // Move the pen to (30, 50)
|
|
|
|
+ ctx.lineTo( x*2, veiewBox.top*2 + 40 ); // Draw a line to (150, 100)
|
|
ctx.stroke(); // Render the path
|
|
ctx.stroke(); // Render the path
|
|
- ctx.closePath();
|
|
|
|
let dy = (bound.y*2).toFixed(0);
|
|
let dy = (bound.y*2).toFixed(0);
|
|
- ctx.fillText(dy, x*2, cardBox.y *2 + 36);
|
|
|
|
|
|
+ ctx.fillText(dy, x*2 + 10, veiewBox.top*2 +36);
|
|
|
|
|
|
|
|
|
|
//下边
|
|
//下边
|
|
x = cardBox.x + cardBox.width / 2.0;
|
|
x = cardBox.x + cardBox.width / 2.0;
|
|
y = cardBox.y + cardBox.height;
|
|
y = cardBox.y + cardBox.height;
|
|
|
|
|
|
- ctx.moveTo(x*2, y*2); // Move the pen to (30, 50)
|
|
|
|
- ctx.lineTo( x*2, (cardBox.y + bound.y + bound.height)*2); // Draw a line to (150, 100)
|
|
|
|
|
|
+ ctx.beginPath(); // Start a new path
|
|
|
|
+ ctx.moveTo(x*2, veiewBox.bottom*2.0); // Move the pen to (30, 50)
|
|
|
|
+ ctx.lineTo( x*2, veiewBox.bottom*2.0 - 40); // Draw a line to (150, 100)
|
|
ctx.stroke(); // Render the path
|
|
ctx.stroke(); // Render the path
|
|
- ctx.closePath();
|
|
|
|
dy = ((cardBox.height - bound.y - bound.height)*2).toFixed(0);
|
|
dy = ((cardBox.height - bound.y - bound.height)*2).toFixed(0);
|
|
- ctx.fillText(dy, x*2, y*2);
|
|
|
|
-
|
|
|
|
|
|
+ ctx.fillText(dy, x*2 + 10, veiewBox.bottom*2.0);
|
|
|
|
+
|
|
//如果有旋转角度
|
|
//如果有旋转角度
|
|
if ( Math.abs(ObjC.parent.rotation) > 0.001 ) {
|
|
if ( Math.abs(ObjC.parent.rotation) > 0.001 ) {
|
|
ctx.strokeRect((bound.x + cardBox.x)*2, (bound.y + cardBox.y)*2, bound.width *2, bound.height *2);
|
|
ctx.strokeRect((bound.x + cardBox.x)*2, (bound.y + cardBox.y)*2, bound.width *2, bound.height *2);
|
|
@@ -104,6 +109,9 @@ export class AssistCtrl {
|
|
}
|
|
}
|
|
|
|
|
|
flashDrawCardDists() {
|
|
flashDrawCardDists() {
|
|
- this._flashDraw(this.drawCardDists.bind(this));
|
|
|
|
|
|
+ this._flashDraw(()=>{
|
|
|
|
+ this.drawCardDists()
|
|
|
|
+ this.ctrl.assistMagnet?.draw();
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|