|
@@ -25,16 +25,20 @@ export default class Draw {
|
|
|
this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height)
|
|
|
}
|
|
|
|
|
|
- drawBackGround(color) {
|
|
|
+ drawBackGround() {
|
|
|
this.context.save()
|
|
|
- this.context.fillStyle = color
|
|
|
- this.context.fillRect(0, 0, this.context.canvas.width, this.context.canvas.height)
|
|
|
+ this.context.fillStyle = 'white';
|
|
|
+ this.context.fillRect(0,0,this.context.canvas.width,this.context.canvas.height)
|
|
|
this.context.restore()
|
|
|
}
|
|
|
|
|
|
- // setSVGAttr(svgId,width,height){
|
|
|
-
|
|
|
- // }
|
|
|
+ drawFrame() {
|
|
|
+ this.context.save()
|
|
|
+ this.context.strokeStyle = 'black';
|
|
|
+ const ratio = this.context.canvas.width/297 ;
|
|
|
+ this.context.strokeRect(ratio * 20, ratio * 20,this.context.canvas.width - 2*ratio * 20,this.context.canvas.height - 2*ratio * 20)
|
|
|
+ this.context.restore()
|
|
|
+ }
|
|
|
|
|
|
drawWall(vector) {
|
|
|
let start = floorplanService.getPoint(vector.start)
|
|
@@ -52,11 +56,9 @@ export default class Draw {
|
|
|
this.context.save()
|
|
|
this.context.beginPath()
|
|
|
this.context.lineCap = 'round' //线段端点的样式
|
|
|
- //this.context.lineJoin= 'miter';
|
|
|
- this.context.strokeStyle = Style.Wall.strokeStyle
|
|
|
|
|
|
this.context.lineWidth = Style.Wall.lineWidth * coordinate.ratio
|
|
|
- this.context.strokeStyle = Style.Wall.strokeStyle
|
|
|
+ this.context.strokeStyle = vector.color
|
|
|
|
|
|
const selectItem = stateService.getSelectItem()
|
|
|
const draggingItem = stateService.getDraggingItem()
|
|
@@ -184,8 +186,8 @@ export default class Draw {
|
|
|
this.context.save()
|
|
|
|
|
|
this.context.lineWidth = Style.Tag.lineWidth * coordinate.ratio
|
|
|
- this.context.strokeStyle = Style.Tag.strokeStyle
|
|
|
- this.context.fillStyle = Style.Tag.fillStyle
|
|
|
+ this.context.strokeStyle = geometry.color
|
|
|
+ this.context.fillStyle = geometry.color
|
|
|
|
|
|
const selectItem = stateService.getSelectItem()
|
|
|
const draggingItem = stateService.getDraggingItem()
|
|
@@ -210,11 +212,18 @@ export default class Draw {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const fontSize = coordinate.ratio == Constant.ratio ? 36 : 12
|
|
|
- this.context.font = `400 ${fontSize}px Microsoft YaHei`
|
|
|
+ this.context.font = `400 ${geometry.fontSize* coordinate.ratio}px Microsoft YaHei`
|
|
|
|
|
|
//根据文字的长度,更新标注范围
|
|
|
- geometry.sideWidth = Math.max(this.context.measureText(geometry.value).width, this.context.measureText(parseFloat(geometry.value).toFixed(2)).width)
|
|
|
+ //geometry.sideWidth = Math.max(this.context.measureText(geometry.value).width, this.context.measureText(parseFloat(geometry.value).toFixed(2)).width)
|
|
|
+ let fontInfo = geometry.setFontLenAndHeight()
|
|
|
+ let sideWidth = 0;
|
|
|
+ for(let i=0;i<fontInfo.textValues.length;++i){
|
|
|
+ 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)
|
|
|
+
|
|
|
geometry.setPoints2d()
|
|
|
|
|
|
let points2d = geometry.points2d
|
|
@@ -223,18 +232,41 @@ export default class Draw {
|
|
|
points[i] = coordinate.getScreenXY({ x: points2d[i].x, y: points2d[i].y })
|
|
|
}
|
|
|
|
|
|
- let pt = { x: geometry.center.x, y: geometry.center.y }
|
|
|
- pt = coordinate.getScreenXY({ x: geometry.center.x, y: geometry.center.y })
|
|
|
- const fontWidth1 = this.context.measureText(geometry.value).width
|
|
|
- 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)
|
|
|
-
|
|
|
- if (fontStart1.newpoint1.x < fontStart1.newpoint2.x) {
|
|
|
- this.context.fillText(geometry.value, fontStart1.newpoint1.x, fontStart1.newpoint1.y)
|
|
|
- } else {
|
|
|
- this.context.fillText(geometry.value, fontStart1.newpoint2.x, fontStart1.newpoint2.y)
|
|
|
+ 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/2
|
|
|
+ let dy = geometry.sideThickness/fontInfo.height/2*coordinate.ratio
|
|
|
+ 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)
|
|
|
+
|
|
|
+ // if (fontStart1.newpoint1.x < fontStart1.newpoint2.x) {
|
|
|
+ // this.context.fillText(geometry.value, fontStart1.newpoint1.x, fontStart1.newpoint1.y)
|
|
|
+ // } else {
|
|
|
+ // this.context.fillText(geometry.value, fontStart1.newpoint2.x, fontStart1.newpoint2.y)
|
|
|
+ // }
|
|
|
+ //let count = (2*(i-(fontInfo.textValues.length-1))+1)
|
|
|
+ //let count = 1 * (fontInfo.textValues.length-i)
|
|
|
+ let count = i+1
|
|
|
+ count = 2* count - fontInfo.textValues.length
|
|
|
+ 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()
|
|
|
}
|
|
|
|
|
@@ -255,7 +287,6 @@ export default class Draw {
|
|
|
}
|
|
|
|
|
|
drawCell(geometry,width,height){
|
|
|
-
|
|
|
this.context.save()
|
|
|
this.context.lineWidth = Style.Table.lineWidth * coordinate.ratio
|
|
|
this.context.strokeStyle = Style.Table.strokeStyle
|
|
@@ -286,16 +317,13 @@ export default class Draw {
|
|
|
this.context.translate(width, height)
|
|
|
this.context.beginPath()
|
|
|
this.context.moveTo(0,0)
|
|
|
- this.context.lineTo(geometry.width,0)
|
|
|
- this.context.lineTo(geometry.width,geometry.height)
|
|
|
- this.context.lineTo(0,geometry.height)
|
|
|
+ this.context.lineTo(geometry.width* coordinate.ratio,0)
|
|
|
+ this.context.lineTo(geometry.width* coordinate.ratio,geometry.height* coordinate.ratio)
|
|
|
+ this.context.lineTo(0,geometry.height* coordinate.ratio)
|
|
|
this.context.closePath();
|
|
|
this.context.stroke()
|
|
|
|
|
|
- const defaultHeight = 24;
|
|
|
- const defaultWidth = 156;
|
|
|
-
|
|
|
- this.context.font = '12px Microsoft YaHei'
|
|
|
+ this.context.font = 12*coordinate.ratio+'px Microsoft YaHei'
|
|
|
let fontWidth = this.context.measureText(geometry.value).width
|
|
|
//如果是数字或者字母
|
|
|
const patt = /[A-z0-9]/g;
|
|
@@ -307,12 +335,12 @@ export default class Draw {
|
|
|
|
|
|
|
|
|
//let rowCount = Math.ceil(geometry.height/defaultHeight) //分几行写
|
|
|
- let rowCount = Math.ceil(fontWidth/geometry.width) //分几行写,根据要写的文字的长度来判断
|
|
|
+ let rowCount = Math.ceil(fontWidth/(geometry.width* coordinate.ratio)) //分几行写,根据要写的文字的长度来判断
|
|
|
|
|
|
if(rowCount == 1){
|
|
|
this.context.textAlign = "center";
|
|
|
this.context.textBaseline = "middle";
|
|
|
- this.context.fillText(geometry.value, geometry.width/2, geometry.height/2)
|
|
|
+ this.context.fillText(geometry.value, geometry.width/2* coordinate.ratio, geometry.height/2* coordinate.ratio)
|
|
|
}
|
|
|
//大于1行
|
|
|
else{
|
|
@@ -321,7 +349,7 @@ export default class Draw {
|
|
|
this.context.textAlign = "left";
|
|
|
for(let i=0;i<rowCount;++i){
|
|
|
const value = geometry.value.substr(i*rowFontCount,rowFontCount)
|
|
|
- this.context.fillText(value, geometry.width/2 - rowWidth/2, 18+18*i)
|
|
|
+ this.context.fillText(value, (geometry.width/2* coordinate.ratio- rowWidth/2), (18+18*i)* coordinate.ratio)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -337,10 +365,9 @@ export default class Draw {
|
|
|
this.context.save()
|
|
|
this.context.beginPath()
|
|
|
this.context.lineCap = 'round' //线段端点的样式;
|
|
|
- this.context.strokeStyle = Style.Rectangle.strokeStyle
|
|
|
|
|
|
this.context.lineWidth = Style.Rectangle.lineWidth * coordinate.ratio
|
|
|
- this.context.strokeStyle = Style.Rectangle.strokeStyle
|
|
|
+ this.context.strokeStyle = geometry.color
|
|
|
|
|
|
const selectItem = stateService.getSelectItem()
|
|
|
const draggingItem = stateService.getDraggingItem()
|
|
@@ -426,12 +453,14 @@ export default class Draw {
|
|
|
|
|
|
drawCircleGeo(geometry)
|
|
|
{
|
|
|
- let radius = geometry.radius * coordinate.res * coordinate.zoom/Constant.defaultZoom
|
|
|
+ let radius = geometry.radius * coordinate.res * coordinate.zoom/Constant.defaultZoom * coordinate.ratio
|
|
|
const twoPi = Math.PI * 2
|
|
|
const pt = coordinate.getScreenXY(geometry.center)
|
|
|
|
|
|
this.context.save()
|
|
|
- this.context.strokeStyle = Style.Circle.strokeStyle
|
|
|
+
|
|
|
+ this.context.lineWidth = Style.Circle.lineWidth * coordinate.ratio
|
|
|
+ this.context.strokeStyle = geometry.color
|
|
|
|
|
|
const selectItem = stateService.getSelectItem()
|
|
|
const draggingItem = stateService.getDraggingItem()
|
|
@@ -510,7 +539,7 @@ export default class Draw {
|
|
|
|
|
|
drawIcon(geometry)
|
|
|
{
|
|
|
- let radius = geometry.radius * coordinate.res * coordinate.zoom/Constant.defaultZoom
|
|
|
+ let radius = geometry.radius * coordinate.res * coordinate.zoom/Constant.defaultZoom * coordinate.ratio
|
|
|
const twoPi = Math.PI * 2
|
|
|
const pt = coordinate.getScreenXY(geometry.center)
|
|
|
|
|
@@ -592,8 +621,8 @@ export default class Draw {
|
|
|
this.context.save()
|
|
|
this.setCanvasStyle(Style.Font)
|
|
|
|
|
|
- let fonSize = Math.ceil(radius * 14/20);
|
|
|
- this.context.font = fonSize + Style.Font.font;
|
|
|
+ let fontSize = Math.ceil(radius * 14/20);
|
|
|
+ this.context.font = fontSize + Style.Font.font
|
|
|
let center = coordinate.getScreenXY(geometry.center);
|
|
|
this.context.fillText(geometry.value, center.x , center.y)
|
|
|
this.context.restore()
|
|
@@ -604,7 +633,7 @@ export default class Draw {
|
|
|
this.context.save()
|
|
|
this.context.beginPath()
|
|
|
this.context.lineCap = 'round' //线段端点的样式
|
|
|
- this.context.strokeStyle = Style.Arrow.strokeStyle
|
|
|
+ this.context.strokeStyle = geometry.color
|
|
|
this.context.lineWidth = Style.Arrow.lineWidth * coordinate.ratio
|
|
|
|
|
|
const selectItem = stateService.getSelectItem()
|
|
@@ -809,37 +838,148 @@ export default class Draw {
|
|
|
this.context.strokeStyle = Style.Focus.Title.strokeStyle
|
|
|
this.context.fillStyle = Style.Focus.Title.fillStyle
|
|
|
}
|
|
|
- //let pt = {}
|
|
|
- //pt.x = (this.context.canvas.width - this.context.measureText(geometry.value).width)/2
|
|
|
- this.context.fillText(geometry.value, this.context.canvas.width/2, geometry.height)
|
|
|
+ //this.context.font = `400 ${geometry.fontSize}px Microsoft YaHei`
|
|
|
+ this.context.font = `${24*coordinate.ratio}px Microsoft YaHei`
|
|
|
+ this.context.fillText(geometry.value, this.context.canvas.width/2, geometry.height*coordinate.ratio)
|
|
|
this.context.restore()
|
|
|
}
|
|
|
|
|
|
drawBgImage(geometry){
|
|
|
- if(geometry.src != null){
|
|
|
+ if(geometry.url != null){
|
|
|
const pt = {
|
|
|
- x:30,
|
|
|
- y:150
|
|
|
+ x:geometry.center.x*coordinate.ratio,
|
|
|
+ y:geometry.center.y*coordinate.ratio
|
|
|
}
|
|
|
|
|
|
this.context.save()
|
|
|
+ this.context.translate(pt.x+geometry.width*coordinate.ratio/2, pt.y+geometry.height*coordinate.ratio/2)
|
|
|
+ this.context.scale(geometry.scale,geometry.scale)
|
|
|
+
|
|
|
if(geometry.image == null)
|
|
|
{
|
|
|
var img = new Image()
|
|
|
img.src = geometry.src;
|
|
|
img.crossOrigin=""
|
|
|
img.onload = function () {
|
|
|
- this.context.drawImage(img, pt.x, pt.y, img.width, img.height)
|
|
|
+ this.context.drawImage(img, -img.width*coordinate.ratio/2, -img.height*coordinate.ratio/2, img.width*coordinate.ratio, img.height*coordinate.ratio)
|
|
|
}.bind(this)
|
|
|
geometry.image = img;
|
|
|
}
|
|
|
else{
|
|
|
- this.context.drawImage(geometry.image, pt.x, pt.y, geometry.image.width, geometry.image.height)
|
|
|
+ if(geometry.hasOwnProperty('width')){
|
|
|
+ this.context.drawImage(geometry.image, -geometry.width*coordinate.ratio/2, -geometry.height*coordinate.ratio/2, geometry.width*coordinate.ratio, geometry.height*coordinate.ratio)
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.context.drawImage(geometry.image, -geometry.width*coordinate.ratio/2, -geometry.height*coordinate.ratio/2, geometry.image.width*coordinate.ratio, geometry.image.height*coordinate.ratio)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ const focusItem = stateService.getFocusItem()
|
|
|
+ const selectItem = stateService.getSelectItem()
|
|
|
+ if (focusItem && focusItem.type == VectorType.BgImage) {
|
|
|
+ if (geometry.vectorId == focusItem.vectorId) {
|
|
|
+ this.context.lineWidth = 2/geometry.scale;
|
|
|
+ this.context.strokeStyle = Style.Select.Tag.strokeStyle
|
|
|
+ this.context.fillStyle = Style.Select.Tag.fillStyle
|
|
|
+ this.context.strokeRect( -geometry.width*coordinate.ratio/2, -geometry.height*coordinate.ratio/2, geometry.width, geometry.height)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (selectItem && selectItem.type == VectorType.BgImage) {
|
|
|
+ if (geometry.vectorId == selectItem.vectorId) {
|
|
|
+ this.context.lineWidth = 2/geometry.scale;
|
|
|
+ this.context.strokeStyle = Style.Select.Tag.strokeStyle
|
|
|
+ this.context.fillStyle = Style.Select.Tag.fillStyle
|
|
|
+ this.context.strokeRect( -geometry.width*coordinate.ratio/2, -geometry.height*coordinate.ratio/2, geometry.width, geometry.height)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this.context.beginPath()
|
|
|
+ // this.context.arc(0,0, 2 * coordinate.ratio, 0, Math.PI * 2, true)
|
|
|
+ // this.context.stroke()
|
|
|
+ // this.context.fill()
|
|
|
+
|
|
|
this.context.restore()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ drawCustomImage(geometry){
|
|
|
+ if(geometry.url != null){
|
|
|
+ const pt = coordinate.getScreenXY(geometry.center)
|
|
|
+ this.context.save()
|
|
|
+
|
|
|
+ this.context.translate(pt.x, pt.y)
|
|
|
+ this.context.scale(geometry.scale,geometry.scale)
|
|
|
+ this.context.translate(-1*geometry.ratio*geometry.width/2*coordinate.ratio, -1*geometry.ratio*geometry.height/2*coordinate.ratio)
|
|
|
+ this.context.rotate((geometry.angle / 180) * Math.PI)
|
|
|
+ this.context.translate(geometry.ratio*geometry.width/2*coordinate.ratio, geometry.ratio*geometry.height/2*coordinate.ratio)
|
|
|
+
|
|
|
+
|
|
|
+ if(geometry.image == null)
|
|
|
+ {
|
|
|
+ var img = new Image()
|
|
|
+ img.src = geometry.url;
|
|
|
+ img.crossOrigin=""
|
|
|
+ img.onload = function () {
|
|
|
+ this.context.drawImage(img, -img.width*coordinate.ratio, -img.height*coordinate.ratio)
|
|
|
+ }.bind(this)
|
|
|
+ geometry.image = img;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if(geometry.hasOwnProperty('width')){
|
|
|
+ this.context.drawImage(geometry.image, -geometry.ratio * geometry.width*coordinate.ratio, -geometry.ratio * geometry.height*coordinate.ratio,geometry.ratio * geometry.width*coordinate.ratio, geometry.ratio * geometry.height*coordinate.ratio)
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.context.drawImage(geometry.image, -geometry.ratio * geometry.width*coordinate.ratio, -geometry.ratio * geometry.height*coordinate.ratio,geometry.ratio * geometry.width*coordinate.ratio, geometry.ratio * geometry.height*coordinate.ratio)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ const focusItem = stateService.getFocusItem()
|
|
|
+ const selectItem = stateService.getSelectItem()
|
|
|
+ if (focusItem && focusItem.type == VectorType.CustomImage) {
|
|
|
+ if (geometry.vectorId == focusItem.vectorId) {
|
|
|
+ this.context.lineWidth = 2/geometry.scale;
|
|
|
+ this.context.strokeStyle = Style.Select.Tag.strokeStyle
|
|
|
+ this.context.fillStyle = Style.Select.Tag.fillStyle
|
|
|
+ this.context.strokeRect( -geometry.ratio * geometry.width, -geometry.ratio * geometry.height, geometry.ratio * geometry.width, geometry.ratio * geometry.height)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (selectItem && selectItem.type == VectorType.CustomImage) {
|
|
|
+ if (geometry.vectorId == selectItem.vectorId) {
|
|
|
+ this.context.lineWidth = 2/geometry.scale;
|
|
|
+ this.context.strokeStyle = Style.Select.Tag.strokeStyle
|
|
|
+ this.context.fillStyle = Style.Select.Tag.fillStyle
|
|
|
+ this.context.strokeRect( -geometry.ratio * geometry.width, -geometry.ratio * geometry.height, geometry.ratio * geometry.width, geometry.ratio * geometry.height)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.context.restore()
|
|
|
+
|
|
|
+ // this.context.save()
|
|
|
+ // if(geometry.points.length>1){
|
|
|
+
|
|
|
+ // this.context.strokeStyle = 'red'
|
|
|
+ // this.context.lineWidth = 4
|
|
|
+ // let p0 = coordinate.getScreenXY(geometry.points[0])
|
|
|
+ // let p1 = coordinate.getScreenXY(geometry.points[1])
|
|
|
+ // let p2 = coordinate.getScreenXY(geometry.points[2])
|
|
|
+ // let p3 = coordinate.getScreenXY(geometry.points[3])
|
|
|
+ // this.context.beginPath()
|
|
|
+ // this.context.moveTo(p0.x,p0.y);
|
|
|
+ // this.context.lineTo(p3.x,p3.y);
|
|
|
+ // this.context.lineTo(p2.x,p2.y);
|
|
|
+ // this.context.lineTo(p1.x,p1.y);
|
|
|
+ // this.context.closePath()
|
|
|
+ // this.context.stroke();
|
|
|
+ // }
|
|
|
+ // this.context.restore()
|
|
|
+ // this.context.beginPath()
|
|
|
+ // this.context.arc(pt.x-geometry.ratio * geometry.width/4*geometry.scale, pt.y-geometry.ratio * geometry.height/4*geometry.scale, 2 * coordinate.ratio, 0, Math.PI * 2, true)
|
|
|
+ // this.context.stroke()
|
|
|
+ // this.context.fill()
|
|
|
+ // this.context.restore()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
drawCompass(geometry){
|
|
|
|
|
|
this.context.save()
|
|
@@ -869,17 +1009,13 @@ export default class Draw {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- this.context.translate(geometry.center.x,geometry.center.y)
|
|
|
+ this.context.translate(geometry.center.x*coordinate.ratio,geometry.center.y*coordinate.ratio)
|
|
|
+ this.context.scale(coordinate.ratio,coordinate.ratio)
|
|
|
+ this.context.translate(16, 36)
|
|
|
this.context.rotate((geometry.angle)/180 * Math.PI)
|
|
|
- if(geometry.angle == 90){
|
|
|
- this.context.translate( 32/2, -52)
|
|
|
- }
|
|
|
- else if(geometry.angle == 180){
|
|
|
- this.context.translate( -32, -52)
|
|
|
- }
|
|
|
- else if(geometry.angle == 270){
|
|
|
- this.context.translate( -52, -32/2)
|
|
|
- }
|
|
|
+ this.context.translate(-16, -36)
|
|
|
+
|
|
|
+ //this.context.translate(18,26)
|
|
|
this.context.lineWidth = 1
|
|
|
this.context.miterLimit=4;
|
|
|
this.context.font="15px ''";
|
|
@@ -958,6 +1094,13 @@ export default class Draw {
|
|
|
this.context.fill();
|
|
|
this.context.stroke();
|
|
|
this.context.restore();
|
|
|
+
|
|
|
+ this.context.save()
|
|
|
+ this.context.font = 12*coordinate.ratio+`px Microsoft YaHei`
|
|
|
+ let value = '角度:'+geometry.angle + '°';
|
|
|
+ let fontWidth = this.context.measureText(value).width
|
|
|
+ this.context.fillText(value, (geometry.center.x*coordinate.ratio-fontWidth/5), (geometry.center.y+85)*coordinate.ratio)
|
|
|
+ this.context.restore()
|
|
|
}
|
|
|
|
|
|
setCanvasStyle(style) {
|
|
@@ -1024,7 +1167,7 @@ export default class Draw {
|
|
|
|
|
|
this.context.save()
|
|
|
this.context.strokeStyle = Style.Sign.strokeStyle
|
|
|
- this.context.fillStyle = "black";
|
|
|
+ this.context.fillStyle = "rgba(0,0,0,1)";
|
|
|
|
|
|
if (selectItem && selectItem.type == VectorType.Cigaret) {
|
|
|
if (geometry.vectorId == selectItem.vectorId) {
|
|
@@ -1058,7 +1201,7 @@ export default class Draw {
|
|
|
this.context.rotate((geometry.angle / 180) * Math.PI)
|
|
|
this.context.translate(pt.x - center.x, pt.y - center.y)
|
|
|
|
|
|
- this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
+ this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
|
|
|
this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
|
|
|
this.context.miterLimit = 4
|
|
@@ -1132,7 +1275,7 @@ export default class Draw {
|
|
|
this.context.strokeStyle="rgba(0,0,0,0)";
|
|
|
this.context.miterLimit=4;
|
|
|
this.context.font="15px ''";
|
|
|
- this.context.fillStyle="#FF4D4F";
|
|
|
+ this.context.fillStyle="rgba(255,77,79,1)";
|
|
|
|
|
|
if (selectItem && selectItem.type == VectorType.FirePoint) {
|
|
|
if (geometry.vectorId == selectItem.vectorId) {
|
|
@@ -1165,7 +1308,7 @@ export default class Draw {
|
|
|
this.context.translate(center.x, center.y)
|
|
|
this.context.rotate((geometry.angle / 180) * Math.PI)
|
|
|
this.context.translate(pt.x - center.x, pt.y - center.y)
|
|
|
- this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32, (geometry.getLen() * geometry.scale * coordinate.res) / 32)
|
|
|
+ this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32*coordinate.ratio)
|
|
|
this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32)
|
|
|
|
|
|
this.context.beginPath();
|
|
@@ -1204,7 +1347,7 @@ export default class Draw {
|
|
|
this.context.strokeStyle="rgba(0,0,0,0)";
|
|
|
this.context.miterLimit=4;
|
|
|
this.context.font="15px ''";
|
|
|
- this.context.fillStyle="black";
|
|
|
+ this.context.fillStyle="rgba(0,0,0,1)";
|
|
|
|
|
|
if (selectItem && selectItem.type == VectorType.LeftFootPrint) {
|
|
|
if (geometry.vectorId == selectItem.vectorId) {
|
|
@@ -1237,7 +1380,7 @@ export default class Draw {
|
|
|
this.context.translate(center.x, center.y)
|
|
|
this.context.rotate((geometry.angle / 180) * Math.PI)
|
|
|
this.context.translate(pt.x - center.x, pt.y - center.y)
|
|
|
- this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
+ this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
|
|
|
this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
|
|
|
this.context.beginPath();
|
|
@@ -1315,7 +1458,7 @@ export default class Draw {
|
|
|
this.context.strokeStyle="rgba(0,0,0,0)";
|
|
|
this.context.miterLimit=4;
|
|
|
this.context.font="15px ''";
|
|
|
- this.context.fillStyle="black";
|
|
|
+ this.context.fillStyle="rgba(0,0,0,1)";
|
|
|
|
|
|
if (selectItem && selectItem.type == VectorType.RightFootPrint) {
|
|
|
if (geometry.vectorId == selectItem.vectorId) {
|
|
@@ -1348,7 +1491,7 @@ export default class Draw {
|
|
|
this.context.translate(center.x, center.y)
|
|
|
this.context.rotate((geometry.angle / 180) * Math.PI)
|
|
|
this.context.translate(pt.x - center.x, pt.y - center.y)
|
|
|
- this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
+ this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
|
|
|
this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
|
|
|
this.context.beginPath();
|
|
@@ -1425,7 +1568,7 @@ export default class Draw {
|
|
|
this.context.save()
|
|
|
this.context.strokeStyle="rgba(0,0,0,0)";
|
|
|
this.context.miterLimit=4;
|
|
|
- this.context.fillStyle="black";
|
|
|
+ this.context.fillStyle="rgba(0,0,0,1)";
|
|
|
this.context.font=" 15px ''";
|
|
|
|
|
|
if (selectItem && selectItem.type == VectorType.LeftShoePrint) {
|
|
@@ -1459,7 +1602,7 @@ export default class Draw {
|
|
|
this.context.translate(center.x, center.y)
|
|
|
this.context.rotate((geometry.angle / 180) * Math.PI)
|
|
|
this.context.translate(pt.x - center.x, pt.y - center.y)
|
|
|
- this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
+ this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
|
|
|
this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
|
|
|
this.context.beginPath();
|
|
@@ -1497,7 +1640,7 @@ export default class Draw {
|
|
|
this.context.strokeStyle="rgba(0,0,0,0)";
|
|
|
this.context.miterLimit=4;
|
|
|
this.context.font="15px ''";
|
|
|
- this.context.fillStyle="black";
|
|
|
+ this.context.fillStyle="rgba(0,0,0,1)";
|
|
|
|
|
|
if (selectItem && selectItem.type == VectorType.RightShoePrint) {
|
|
|
if (geometry.vectorId == selectItem.vectorId) {
|
|
@@ -1530,7 +1673,7 @@ export default class Draw {
|
|
|
this.context.translate(center.x, center.y)
|
|
|
this.context.rotate((geometry.angle / 180) * Math.PI)
|
|
|
this.context.translate(pt.x - center.x, pt.y - center.y)
|
|
|
- this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
+ this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
|
|
|
this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
|
|
|
this.context.beginPath();
|
|
@@ -1568,7 +1711,7 @@ export default class Draw {
|
|
|
this.context.strokeStyle="rgba(0,0,0,0)";
|
|
|
this.context.miterLimit=4;
|
|
|
this.context.font="15px ''";
|
|
|
- this.context.fillStyle="black";
|
|
|
+ this.context.fillStyle="rgba(0,0,0,1)";
|
|
|
|
|
|
if (selectItem && selectItem.type == VectorType.FingerPrint) {
|
|
|
if (geometry.vectorId == selectItem.vectorId) {
|
|
@@ -1601,7 +1744,7 @@ export default class Draw {
|
|
|
this.context.translate(center.x, center.y)
|
|
|
this.context.rotate((geometry.angle / 180) * Math.PI)
|
|
|
this.context.translate(pt.x - center.x, pt.y - center.y)
|
|
|
- this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
+ this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
|
|
|
this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
|
|
|
this.context.beginPath();
|
|
@@ -1755,7 +1898,7 @@ export default class Draw {
|
|
|
this.context.translate(center.x, center.y)
|
|
|
this.context.rotate((geometry.angle / 180) * Math.PI)
|
|
|
this.context.translate(pt.x - center.x, pt.y - center.y)
|
|
|
- this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
+ this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
|
|
|
this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
|
|
|
this.context.beginPath();
|
|
@@ -1832,7 +1975,7 @@ export default class Draw {
|
|
|
this.context.strokeStyle="rgba(0,0,0,0)";
|
|
|
this.context.miterLimit=4;
|
|
|
this.context.font="15px ''";
|
|
|
- this.context.fillStyle="#FF4D4F";
|
|
|
+ this.context.fillStyle="rgba(255,77,79,1)";
|
|
|
|
|
|
if (selectItem && selectItem.type == VectorType.BloodStain) {
|
|
|
if (geometry.vectorId == selectItem.vectorId) {
|
|
@@ -1865,7 +2008,7 @@ export default class Draw {
|
|
|
this.context.translate(center.x, center.y)
|
|
|
this.context.rotate((geometry.angle / 180) * Math.PI)
|
|
|
this.context.translate(pt.x - center.x, pt.y - center.y)
|
|
|
- this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
+ this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
|
|
|
this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
|
|
|
|
|
|
this.context.beginPath();
|