|
@@ -218,7 +218,8 @@ export default class Draw {
|
|
|
sideWidth = Math.max(sideWidth,this.context.measureText(fontInfo.textValues[i]).width, this.context.measureText(parseFloat(fontInfo.textValues[i]).toFixed(2)).width)
|
|
|
}
|
|
|
geometry.sideWidth = sideWidth
|
|
|
- geometry.sideThickness = fontInfo.height * geometry.fontSize * 2
|
|
|
+ geometry.sideThickness = fontInfo.height * (geometry.fontSize)
|
|
|
+
|
|
|
geometry.setPoints2d()
|
|
|
|
|
|
let points2d = geometry.points2d
|
|
@@ -229,7 +230,10 @@ export default class Draw {
|
|
|
|
|
|
let pt = coordinate.getScreenXY({ x: geometry.center.x, y: geometry.center.y })
|
|
|
const fontWidth1 = geometry.sideWidth
|
|
|
- let dy = (points[3].y - points[0].y)/fontInfo.textValues.length
|
|
|
+ //let dy = (points[3].y - points[0].y)/fontInfo.textValues.length/2
|
|
|
+ let dy = geometry.sideThickness/fontInfo.height/2
|
|
|
+ console.log('dy:'+dy)
|
|
|
+ console.log('(points[3].y - points[0].y):'+(points[3].y - points[0].y));
|
|
|
for(let i=0;i<fontInfo.textValues.length;++i){
|
|
|
// const line1 = mathUtil.createLine1({ x: (points[0].x + points[3].x) / 2, y: (points[0].y + points[3].y) / 2 }, { x: (points[2].x + points[1].x) / 2, y: (points[2].y + points[1].y) / 2 })
|
|
|
// const fontStart1 = mathUtil.getDisPointsLine(line1, pt, fontWidth1 / 2, fontWidth1 / 2)
|
|
@@ -239,10 +243,28 @@ export default class Draw {
|
|
|
// } else {
|
|
|
// this.context.fillText(geometry.value, fontStart1.newpoint2.x, fontStart1.newpoint2.y)
|
|
|
// }
|
|
|
- this.context.fillText(fontInfo.textValues[i], pt.x - fontWidth1/2, pt.y - geometry.sideThickness/2+dy*i)
|
|
|
+ //let count = (2*(i-(fontInfo.textValues.length-1))+1)
|
|
|
+ let count = 1 * (fontInfo.textValues.length-i)
|
|
|
+ count = 2* count - fontInfo.textValues.length
|
|
|
+ console.log('count:'+count)
|
|
|
+ this.context.fillText(fontInfo.textValues[i], pt.x - fontWidth1/2, pt.y + dy*count)
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ // this.context.beginPath()
|
|
|
+ // this.context.arc(pt.x, pt.y, 2 * coordinate.ratio, 0, Math.PI * 2, true)
|
|
|
+ // this.context.stroke()
|
|
|
+ // this.context.fill()
|
|
|
+
|
|
|
+ // this.context.beginPath()
|
|
|
+ // this.context.moveTo(points[0].x, points[0].y)
|
|
|
+ // this.context.lineTo(points[1].x, points[1].y)
|
|
|
+ // this.context.lineTo(points[2].x, points[2].y)
|
|
|
+ // this.context.lineTo(points[3].x, points[3].y)
|
|
|
+ // this.context.closePath();
|
|
|
+ // this.context.stroke()
|
|
|
+
|
|
|
this.context.restore()
|
|
|
}
|
|
|
|