|
@@ -167,30 +167,16 @@ export default class Draw {
|
|
|
}
|
|
|
|
|
|
// 文字
|
|
|
- drawText(position, txt, screenCoord, angle) {
|
|
|
+ drawText(position, txt, screenCoord) {
|
|
|
this.context.save()
|
|
|
this.setCanvasStyle(Style.Font)
|
|
|
- if (coordinate.ratio == Constant.ratio) {
|
|
|
- this.context.font = '36px Microsoft YaHei'
|
|
|
- } else {
|
|
|
- this.context.font = '12px Microsoft YaHei'
|
|
|
- }
|
|
|
+ this.context.font = '12px Microsoft YaHei'
|
|
|
|
|
|
let pt = { x: position.x, y: position.y }
|
|
|
if (!screenCoord) {
|
|
|
pt = coordinate.getScreenXY({ x: position.x, y: position.y })
|
|
|
}
|
|
|
-
|
|
|
- if (angle) {
|
|
|
- this.context.translate(pt.x, pt.y)
|
|
|
- this.context.rotate(angle)
|
|
|
- //this.context.strokeText(txt, 0, 0)
|
|
|
- this.context.fillText(txt, 0, 0)
|
|
|
- } else {
|
|
|
- //this.context.strokeText(txt, pt.x, pt.y)
|
|
|
- this.context.fillText(txt, pt.x, pt.y)
|
|
|
- }
|
|
|
-
|
|
|
+ this.context.fillText(txt, pt.x, pt.y)
|
|
|
this.context.restore()
|
|
|
}
|
|
|
|
|
@@ -305,6 +291,10 @@ export default class Draw {
|
|
|
this.context.lineTo(0,geometry.height)
|
|
|
this.context.closePath();
|
|
|
this.context.stroke()
|
|
|
+
|
|
|
+ this.context.font = '24px Microsoft YaHei'
|
|
|
+ const fontWidth = this.context.measureText(geometry.value).width
|
|
|
+ this.context.fillText(geometry.value, geometry.width/2 - fontWidth/2, geometry.height/2-2)
|
|
|
this.context.restore()
|
|
|
}
|
|
|
|
|
@@ -830,7 +820,7 @@ export default class Draw {
|
|
|
const selectItem = stateService.getSelectItem()
|
|
|
const draggingItem = stateService.getDraggingItem()
|
|
|
const focusItem = stateService.getFocusItem()
|
|
|
-
|
|
|
+
|
|
|
if (selectItem && selectItem.type == VectorType.Compass) {
|
|
|
if (geometry.vectorId == selectItem.vectorId) {
|
|
|
this.context.strokeStyle = Style.Select.Compass.strokeStyle
|