From 9917926a4389fde137396213237d4eca47f2982d Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Thu, 8 Apr 2021 09:04:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iscs_new/selectingHandle.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/iscs_new/selectingHandle.js b/src/iscs_new/selectingHandle.js index 3712acadf..d2300f83b 100644 --- a/src/iscs_new/selectingHandle.js +++ b/src/iscs_new/selectingHandle.js @@ -63,14 +63,15 @@ class Vernier extends graphic.Group { const minY = rect.y; const maxX = rect.x + rect.width; const maxY = rect.y + rect.height; - const direction = (Math.abs(rect.width)/rect.width); + const directionX = (Math.abs(rect.width)/rect.width); + const directionY = (Math.abs(rect.height)/rect.height); const axisLineWidthHalf = vernierStyle.axisLine.lineStyle.lineWidth/this._scaleRate/2; this._axisLineX = new graphic.Line({ ...shapeRender, z: 9999, silent: true, - position: [0, -axisLineWidthHalf*direction], + position: [0, -axisLineWidthHalf*directionY], shape: { x1: minX, y1: minY, @@ -82,11 +83,11 @@ class Vernier extends graphic.Group { } }) - const step = 4/this._scaleRate; + const step = vernierStyle.axisTick.lineStyle.lineWidth*2/this._scaleRate; const count = parseInt(Math.abs(rect.width/step)); for(var i = 0; i in new Array(count+1).fill(0); i++) { - const offset = step * i * direction; + const offset = step * i * directionX; const tick = i % vernierStyle.axisTick.length == 0 const len = tick? vernierStyle.axisTick.distance*0.7: vernierStyle.axisTick.distance*0.5; if (tick) { @@ -98,13 +99,13 @@ class Vernier extends graphic.Group { x1: minX + offset, y1: minY, x2: minX + offset, - y2: minY - len * direction / this._scaleRate + y2: minY - len * directionY / this._scaleRate }, style: { ...vernierStyle.axisTick.lineStyle, ...vernierStyle.axisLabel.textStyle, text: i%2? '': i/vernierStyle.axisTick.length/2, - textPosition: direction > 0? 'top': 'bottom' + textPosition: directionY > 0? 'top': 'bottom' } })) } else { @@ -116,7 +117,7 @@ class Vernier extends graphic.Group { x1: minX + offset, y1: minY, x2: minX + offset, - y2: minY - len * direction / this._scaleRate + y2: minY - len * directionY / this._scaleRate }, style: { ...vernierStyle.axisTick.lineStyle @@ -133,14 +134,15 @@ class Vernier extends graphic.Group { const minY = rect.y; const maxX = rect.x + rect.width; const maxY = rect.y + rect.height; - const direction = (Math.abs(rect.width)/rect.width); + const directionX = (Math.abs(rect.width)/rect.width); + const directionY = (Math.abs(rect.height)/rect.height); const axisLineWidthHalf = vernierStyle.axisLine.lineStyle.lineWidth/this._scaleRate/2; this._axisLineY = new graphic.Line({ ...shapeRender, z: 9999, silent: true, - position: [-axisLineWidthHalf*direction, 0], + position: [-axisLineWidthHalf*directionX, 0], shape: { x1: minX, y1: minY, @@ -154,11 +156,11 @@ class Vernier extends graphic.Group { this.add(this._axisLineY); - const step = 4/this._scaleRate; + const step = vernierStyle.axisTick.lineStyle.lineWidth*2 /this._scaleRate; const count = parseInt(Math.abs(rect.height/step)); for(var i = 0; i in new Array(count+1).fill(0); i++) { - const offset = step * i * direction; + const offset = step * i * directionY; const tick = i % vernierStyle.axisTick.length == 0; const len = tick? vernierStyle.axisTick.distance*0.7: vernierStyle.axisTick.distance*0.5; if (tick) { @@ -169,14 +171,14 @@ class Vernier extends graphic.Group { shape: { x1: minX, y1: minY + offset, - x2: minX - len * direction / this._scaleRate, + x2: minX - len * directionX / this._scaleRate, y2: minY + offset }, style: { ...vernierStyle.axisTick.lineStyle, ...vernierStyle.axisLabel.textStyle, text: i%2? '': i/vernierStyle.axisTick.length/2, - textPosition: direction > 0? 'left': 'right' + textPosition: directionX > 0? 'left': 'right' } })) } else { @@ -187,7 +189,7 @@ class Vernier extends graphic.Group { shape: { x1: minX, y1: minY + offset, - x2: minX - len * direction / this._scaleRate, + x2: minX - len * directionX / this._scaleRate, y2: minY + offset }, style: {