|
@@ -16,7 +16,12 @@ export const help = {
|
|
getVectorStyle(vector, geoType = vector.geoType) {
|
|
getVectorStyle(vector, geoType = vector.geoType) {
|
|
const geoId = vector?.vectorId;
|
|
const geoId = vector?.vectorId;
|
|
if (!geoId || Settings.screenMode) {
|
|
if (!geoId || Settings.screenMode) {
|
|
- return [Style[geoType], undefined];
|
|
|
|
|
|
+ return [
|
|
|
|
+ Settings.screenMode && Style["Screen"][geoType]
|
|
|
|
+ ? Style["Screen"][geoType]
|
|
|
|
+ : Style[geoType],
|
|
|
|
+ undefined,
|
|
|
|
+ ];
|
|
}
|
|
}
|
|
|
|
|
|
const itemsEntry = [
|
|
const itemsEntry = [
|
|
@@ -24,6 +29,7 @@ export const help = {
|
|
[stateService.getDraggingItem(), "Dragging"],
|
|
[stateService.getDraggingItem(), "Dragging"],
|
|
[stateService.getFocusItem(), "Focus"],
|
|
[stateService.getFocusItem(), "Focus"],
|
|
];
|
|
];
|
|
|
|
+
|
|
let currentAttr;
|
|
let currentAttr;
|
|
|
|
|
|
//console.log(itemsEntry)
|
|
//console.log(itemsEntry)
|
|
@@ -146,10 +152,8 @@ export const help = {
|
|
ctx.closePath();
|
|
ctx.closePath();
|
|
},
|
|
},
|
|
getRealDistance(p1, p2) {
|
|
getRealDistance(p1, p2) {
|
|
- return (
|
|
|
|
- Math.round(
|
|
|
|
- (mathUtil.getDistance(p1, p2) * coordinate.res * 100) / coordinate.ratio
|
|
|
|
- ) / 100
|
|
|
|
|
|
+ return Math.round(
|
|
|
|
+ (mathUtil.getDistance(p1, p2) * coordinate.res * 100) / coordinate.ratio
|
|
);
|
|
);
|
|
},
|
|
},
|
|
getPerpendicularPoint(p1, p2, p3, d) {
|
|
getPerpendicularPoint(p1, p2, p3, d) {
|
|
@@ -184,27 +188,30 @@ export const help = {
|
|
[start, end] = [end, start];
|
|
[start, end] = [end, start];
|
|
}
|
|
}
|
|
|
|
|
|
- const angle =
|
|
|
|
- (Math.atan2(end.y - start.y, end.x - start.x) * 180) / Math.PI;
|
|
|
|
- const center = mathUtil.lineCenter(start, end);
|
|
|
|
-
|
|
|
|
|
|
+ const at2 = Math.atan2(end.y - start.y, end.x - start.x) * 180;
|
|
|
|
+ const angle = at2 / Math.PI;
|
|
|
|
+ const fontSize = (style.fontSize || 10) * coordinate.ratio;
|
|
|
|
+ const vline = mathUtil.getVerticalLineByDistance(start, end, fontSize);
|
|
|
|
+ const center = mathUtil.lineCenter(vline[0], vline[1]);
|
|
|
|
+ console.log(center, start, end);
|
|
ctx.save();
|
|
ctx.save();
|
|
ctx.translate(center.x, center.y);
|
|
ctx.translate(center.x, center.y);
|
|
- // ctx.rotate((angle * Math.PI) / 180);
|
|
|
|
- ctx.font = `${(style.fontSize || 10) * coordinate.ratio}px Microsoft YaHei`;
|
|
|
|
|
|
+ ctx.rotate((angle * Math.PI) / 180);
|
|
|
|
+
|
|
|
|
+ ctx.font = `${fontSize}px Microsoft YaHei`;
|
|
const textCenter = help.getTextCenter(ctx, text);
|
|
const textCenter = help.getTextCenter(ctx, text);
|
|
ctx.fillStyle = style.backColor;
|
|
ctx.fillStyle = style.backColor;
|
|
if (!Settings.screenMode) {
|
|
if (!Settings.screenMode) {
|
|
- const padding = style.padding;
|
|
|
|
- help.roundRect(
|
|
|
|
- ctx,
|
|
|
|
- -textCenter.x - padding,
|
|
|
|
- textCenter.y - padding,
|
|
|
|
- textCenter.width + 2 * padding,
|
|
|
|
- textCenter.height + 2 * padding,
|
|
|
|
- textCenter.height / 2 + padding
|
|
|
|
- );
|
|
|
|
- ctx.fill();
|
|
|
|
|
|
+ // const padding = style.padding;
|
|
|
|
+ // help.roundRect(
|
|
|
|
+ // ctx,
|
|
|
|
+ // -textCenter.x - padding,
|
|
|
|
+ // textCenter.y - padding,
|
|
|
|
+ // textCenter.width + 2 * padding,
|
|
|
|
+ // textCenter.height + 2 * padding,
|
|
|
|
+ // textCenter.height / 2 + padding
|
|
|
|
+ // );
|
|
|
|
+ // ctx.fill();
|
|
}
|
|
}
|
|
ctx.fillStyle = style.fillColor;
|
|
ctx.fillStyle = style.fillColor;
|
|
ctx.fillText(text, -textCenter.x, -textCenter.y);
|
|
ctx.fillText(text, -textCenter.x, -textCenter.y);
|
|
@@ -576,6 +583,7 @@ export default class Draw {
|
|
} else {
|
|
} else {
|
|
width = vector.singleRoadWidth / vector.singleRoadDrivewayCount;
|
|
width = vector.singleRoadWidth / vector.singleRoadDrivewayCount;
|
|
}
|
|
}
|
|
|
|
+ console.log(width);
|
|
width = width.toFixed(0);
|
|
width = width.toFixed(0);
|
|
|
|
|
|
vector.roadWidthTipsPos.forEach((line) => {
|
|
vector.roadWidthTipsPos.forEach((line) => {
|
|
@@ -586,7 +594,7 @@ export default class Draw {
|
|
const [style] = help.setVectorStyle(this.context, vector, ["NormalLine"]);
|
|
const [style] = help.setVectorStyle(this.context, vector, ["NormalLine"]);
|
|
help.drawStyleLine(this.context, [start, end]);
|
|
help.drawStyleLine(this.context, [start, end]);
|
|
help.drawLineText(this.context, start, end, width, {
|
|
help.drawLineText(this.context, start, end, width, {
|
|
- fillColor: "#fff",
|
|
|
|
|
|
+ fillColor: Settings.screenMode ? "#000" : "#fff",
|
|
padding: 6,
|
|
padding: 6,
|
|
fontSize: 12,
|
|
fontSize: 12,
|
|
backColor: style.strokeStyle,
|
|
backColor: style.strokeStyle,
|
|
@@ -1142,8 +1150,8 @@ export default class Draw {
|
|
if (text) {
|
|
if (text) {
|
|
style = {
|
|
style = {
|
|
...style,
|
|
...style,
|
|
- fillStyle: text.color,
|
|
|
|
- strokeStyle: text.color,
|
|
|
|
|
|
+ fillStyle: Settings.screenMode ? "#000" : text.color,
|
|
|
|
+ strokeStyle: Settings.screenMode ? "#000" : text.color,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1172,7 +1180,10 @@ export default class Draw {
|
|
ctx.restore();
|
|
ctx.restore();
|
|
};
|
|
};
|
|
|
|
|
|
- if (Settings.selectBasePointId === vector.vectorId) {
|
|
|
|
|
|
+ if (
|
|
|
|
+ Settings.selectBasePointId === vector.vectorId &&
|
|
|
|
+ !Settings.screenMode
|
|
|
|
+ ) {
|
|
style = {
|
|
style = {
|
|
...style,
|
|
...style,
|
|
fillStyle: "rgba(255, 143, 40, 1)",
|
|
fillStyle: "rgba(255, 143, 40, 1)",
|
|
@@ -1265,8 +1276,8 @@ export default class Draw {
|
|
}
|
|
}
|
|
this.context.save();
|
|
this.context.save();
|
|
const [_, foo] = help.setVectorStyle(this.context, vector);
|
|
const [_, foo] = help.setVectorStyle(this.context, vector);
|
|
-
|
|
|
|
- this.context.fillStyle = vector.color;
|
|
|
|
|
|
+ const color = Settings.screenMode ? "#000" : vector.color;
|
|
|
|
+ this.context.fillStyle = color;
|
|
this.context.textBaseline = "bottom";
|
|
this.context.textBaseline = "bottom";
|
|
this.context.font = `${
|
|
this.context.font = `${
|
|
vector.fontSize * coordinate.ratio
|
|
vector.fontSize * coordinate.ratio
|
|
@@ -1301,7 +1312,11 @@ export default class Draw {
|
|
this.context.restore();
|
|
this.context.restore();
|
|
vector.displayPoint &&
|
|
vector.displayPoint &&
|
|
this.drawPoint(
|
|
this.drawPoint(
|
|
- { ...vector.center, color: vector.color, fillColor: vector.color },
|
|
|
|
|
|
+ {
|
|
|
|
+ ...vector.center,
|
|
|
|
+ color: color,
|
|
|
|
+ fillColor: color,
|
|
|
|
+ },
|
|
true
|
|
true
|
|
);
|
|
);
|
|
|
|
|
|
@@ -1387,9 +1402,9 @@ export default class Draw {
|
|
this.context,
|
|
this.context,
|
|
coordinate.getScreenXY(startReal),
|
|
coordinate.getScreenXY(startReal),
|
|
coordinate.getScreenXY(endReal),
|
|
coordinate.getScreenXY(endReal),
|
|
- (vector.value
|
|
|
|
|
|
+ vector.value
|
|
? Math.round(vector.value * 100) / 100
|
|
? Math.round(vector.value * 100) / 100
|
|
- : help.getRealDistance(startReal, endReal)) + "m",
|
|
|
|
|
|
+ : help.getRealDistance(startReal, endReal),
|
|
style
|
|
style
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -1483,6 +1498,7 @@ export default class Draw {
|
|
this.context.setLineDash(style.dash);
|
|
this.context.setLineDash(style.dash);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ console.log(vector);
|
|
help.drawStyleLine(this.context, [start, end], vector.style, vector.weight);
|
|
help.drawStyleLine(this.context, [start, end], vector.style, vector.weight);
|
|
// vector.category = VectorCategory.Line.LocationLineByFixPoint;
|
|
// vector.category = VectorCategory.Line.LocationLineByFixPoint;
|
|
switch (vector.category) {
|
|
switch (vector.category) {
|