fl-web-component 1.3.16 → 1.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fl-web-component.common.js +579 -42
- package/dist/fl-web-component.common.js.map +1 -1
- package/dist/fl-web-component.css +1 -1
- package/package.json +1 -1
- package/packages/components/com-flcanvas/components/entityFormatting.js +379 -100
- package/packages/components/com-flcanvas/index.vue +13 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";#fl-model[data-v-c496e868]{width:100%;height:100%;cursor:pointer}[data-v-c496e868] .tips-label{width:60px;color:#000;font:12px Helvetica;margin-top:-3em;padding:5px;text-align:center;vertical-align:middle;background-color:khaki}[data-v-c496e868] .measure-label{max-width:100px;margin-top:-1em;border:10px;border-radius:5px;padding:3px 10px;cursor:pointer;color:#009bea;background-color:#f4f4f4;box-shadow:0 1px 3px 1px rgba(0,0,0,.25)}[data-v-c496e868] .circle-tag{width:10px;height:10px;margin-top:5px;border-radius:50%;background-color:#ff5000}[data-v-c496e868] .measure-label-font{word-break:break-all}[data-v-c496e868] .mark-label-img{padding-top:5px;width:20px;height:20px}.lil-gui{background:hsla(0,0%,100%,.95)!important;border:1px solid #e0e0e0!important;border-radius:8px!important;box-shadow:0 4px 12px rgba(0,0,0,.15)!important;backdrop-filter:blur(10px)!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif!important}.lil-gui .title{background:linear-gradient(135deg,#f8f9fa,#e9ecef)!important;color:#495057!important;border-bottom:1px solid #dee2e6!important;font-weight:600!important;padding:0 12px!important;border-radius:8px 8px 0 0!important}.lil-gui .controller{border-bottom:1px solid #f1f3f4!important;background:transparent!important}.lil-gui .controller:last-child{border-bottom:none!important}.lil-gui .controller .name{color:#495057!important;font-weight:500!important;font-size:12px!important}.lil-gui .controller .widget{background:#f8f9fa!important;border:1px solid #ced4da!important;border-radius:4px!important;color:#495057!important}.lil-gui .controller .widget:focus,.lil-gui .controller .widget:hover{border-color:#80bdff!important;box-shadow:0 0 0 2px rgba(0,123,255,.25)!important}.lil-gui .controller .widget:focus{outline:none!important}.lil-gui .controller input[type=range]{background:#e9ecef!important;height:4px!important;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;border-radius:2px!important}.lil-gui .controller.number .fill{border-right:solid #008de9}.lil-gui .controller input[type=range]::-webkit-slider-thumb{background:#007bff!important;border:2px solid #fff!important;box-shadow:0 2px 4px rgba(0,0,0,.2)!important;width:16px!important;height:16px!important;border-radius:50%!important;-webkit-appearance:none!important;appearance:none!important;cursor:pointer!important}.lil-gui .controller input[type=range]::-moz-range-thumb{background:#007bff!important;border:2px solid #fff!important;box-shadow:0 2px 4px rgba(0,0,0,.2)!important;width:16px!important;height:16px!important;border-radius:50%!important;cursor:pointer!important}.lil-gui .controller .option{background:#fff!important;color:#495057!important;border-bottom:1px solid #f1f3f4!important}.lil-gui .controller .option:hover{background:#f8f9fa!important}.lil-gui .controller .option:last-child{border-bottom:none!important}.lil-gui input:active{background:#e6eff4}.lil-gui .controller button{background:linear-gradient(135deg,#007bff,#0056b3)!important;color:#fff!important;border:none!important;border-radius:4px!important;font-weight:500!important;transition:all .2s ease!important}.lil-gui .controller button:hover{background:linear-gradient(135deg,#0056b3,#004085)!important;transform:translateY(-1px)!important;box-shadow:0 4px 8px rgba(0,123,255,.3)!important}.lil-gui .controller .color{border:2px solid #fff!important;border-radius:4px!important;box-shadow:0 2px 4px rgba(0,0,0,.1)!important}.lil-gui .controller.number .slider,.lil-gui .controller.number .slider:hover{background-color:#e6eff4}.lil-gui input,.lil-gui input:hover,.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:#e6eff4}.lil-gui .controller>.name{min-width:25px}.lil-gui .controller.number input{color:#2e3136}.lil-gui .controller.number .slider:active{background-color:#e6eff4}.lil-gui .folder>.title{background:linear-gradient(135deg,#f1f3f4,#e9ecef)!important;color:#495057!important;border-bottom:1px solid #dee2e6!important}.lil-gui .folder>.title:before{color:#6c757d!important}.lil-gui .folder.closed>.children{display:none!important}#konva-container[data-v-
|
|
1
|
+
@charset "UTF-8";#fl-model[data-v-c496e868]{width:100%;height:100%;cursor:pointer}[data-v-c496e868] .tips-label{width:60px;color:#000;font:12px Helvetica;margin-top:-3em;padding:5px;text-align:center;vertical-align:middle;background-color:khaki}[data-v-c496e868] .measure-label{max-width:100px;margin-top:-1em;border:10px;border-radius:5px;padding:3px 10px;cursor:pointer;color:#009bea;background-color:#f4f4f4;box-shadow:0 1px 3px 1px rgba(0,0,0,.25)}[data-v-c496e868] .circle-tag{width:10px;height:10px;margin-top:5px;border-radius:50%;background-color:#ff5000}[data-v-c496e868] .measure-label-font{word-break:break-all}[data-v-c496e868] .mark-label-img{padding-top:5px;width:20px;height:20px}.lil-gui{background:hsla(0,0%,100%,.95)!important;border:1px solid #e0e0e0!important;border-radius:8px!important;box-shadow:0 4px 12px rgba(0,0,0,.15)!important;backdrop-filter:blur(10px)!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif!important}.lil-gui .title{background:linear-gradient(135deg,#f8f9fa,#e9ecef)!important;color:#495057!important;border-bottom:1px solid #dee2e6!important;font-weight:600!important;padding:0 12px!important;border-radius:8px 8px 0 0!important}.lil-gui .controller{border-bottom:1px solid #f1f3f4!important;background:transparent!important}.lil-gui .controller:last-child{border-bottom:none!important}.lil-gui .controller .name{color:#495057!important;font-weight:500!important;font-size:12px!important}.lil-gui .controller .widget{background:#f8f9fa!important;border:1px solid #ced4da!important;border-radius:4px!important;color:#495057!important}.lil-gui .controller .widget:focus,.lil-gui .controller .widget:hover{border-color:#80bdff!important;box-shadow:0 0 0 2px rgba(0,123,255,.25)!important}.lil-gui .controller .widget:focus{outline:none!important}.lil-gui .controller input[type=range]{background:#e9ecef!important;height:4px!important;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;border-radius:2px!important}.lil-gui .controller.number .fill{border-right:solid #008de9}.lil-gui .controller input[type=range]::-webkit-slider-thumb{background:#007bff!important;border:2px solid #fff!important;box-shadow:0 2px 4px rgba(0,0,0,.2)!important;width:16px!important;height:16px!important;border-radius:50%!important;-webkit-appearance:none!important;appearance:none!important;cursor:pointer!important}.lil-gui .controller input[type=range]::-moz-range-thumb{background:#007bff!important;border:2px solid #fff!important;box-shadow:0 2px 4px rgba(0,0,0,.2)!important;width:16px!important;height:16px!important;border-radius:50%!important;cursor:pointer!important}.lil-gui .controller .option{background:#fff!important;color:#495057!important;border-bottom:1px solid #f1f3f4!important}.lil-gui .controller .option:hover{background:#f8f9fa!important}.lil-gui .controller .option:last-child{border-bottom:none!important}.lil-gui input:active{background:#e6eff4}.lil-gui .controller button{background:linear-gradient(135deg,#007bff,#0056b3)!important;color:#fff!important;border:none!important;border-radius:4px!important;font-weight:500!important;transition:all .2s ease!important}.lil-gui .controller button:hover{background:linear-gradient(135deg,#0056b3,#004085)!important;transform:translateY(-1px)!important;box-shadow:0 4px 8px rgba(0,123,255,.3)!important}.lil-gui .controller .color{border:2px solid #fff!important;border-radius:4px!important;box-shadow:0 2px 4px rgba(0,0,0,.1)!important}.lil-gui .controller.number .slider,.lil-gui .controller.number .slider:hover{background-color:#e6eff4}.lil-gui input,.lil-gui input:hover,.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:#e6eff4}.lil-gui .controller>.name{min-width:25px}.lil-gui .controller.number input{color:#2e3136}.lil-gui .controller.number .slider:active{background-color:#e6eff4}.lil-gui .folder>.title{background:linear-gradient(135deg,#f1f3f4,#e9ecef)!important;color:#495057!important;border-bottom:1px solid #dee2e6!important}.lil-gui .folder>.title:before{color:#6c757d!important}.lil-gui .folder.closed>.children{display:none!important}#konva-container[data-v-3507a900]{z-index:3;width:100%;height:100%;cursor:pointer;overflow:hidden}span[data-v-f547d5c6]{font-weight:bolder}.text[data-v-f547d5c6]{margin-top:20px}.line[data-v-f547d5c6]{border-bottom:1px solid #dcdfe6;margin:20px 0}.center[data-v-f547d5c6]{display:flex;flex-direction:column;align-items:center}.center .cen span[data-v-f547d5c6],.center .top span[data-v-f547d5c6]{color:"#53a8ff";display:inline-block;width:30px;height:30px;text-align:center;line-height:30px;border:1px solid;padding:5px;margin-bottom:10px;background-color:#e9f3ff}.center .cen span[data-v-f547d5c6]{margin:10px}.button[data-v-f547d5c6]{display:flex;justify-content:end;margin-top:20px}@font-face{font-family:iconfont;src:url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.woff2?t=1646635700216) format("woff2"),url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.woff?t=1646635700216) format("woff"),url(//at.alicdn.com/t/font_3226805_qqvo3ag3r8.ttf?t=1646635700216) format("truetype")}.iconfont[data-v-f547d5c6]{font-family:iconfont!important;font-size:50px;font-style:normal;color:"#53a8ff";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-shubiao[data-v-f547d5c6]:before{content:""}#svg-tigger[data-v-0ec35ee4]{cursor:pointer;height:100%;width:100%}
|
package/package.json
CHANGED
|
@@ -2,25 +2,29 @@ import bSpline from "./bspline";
|
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
|
|
4
4
|
export function handleFn(functionName, recordDxf, entity, group, key, configParams, konvaLayer) {
|
|
5
|
+
console.log(functionName);
|
|
6
|
+
|
|
5
7
|
switch (functionName) {
|
|
6
8
|
case 'LINE': drawLine(recordDxf, entity, group, key, configParams)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
break;
|
|
10
|
+
case 'TEXT': drawText(recordDxf, entity, group, key, configParams)
|
|
11
|
+
break;
|
|
12
|
+
case 'LWPOLYLINE': drawLwLine(recordDxf, entity, group, key, configParams)
|
|
13
|
+
break;
|
|
14
|
+
case 'ARC': drawArc(recordDxf, entity, group, key, configParams)
|
|
15
|
+
break;
|
|
16
|
+
case 'CIRCLE': drawArc(recordDxf, entity, group, key, configParams)
|
|
17
|
+
break;
|
|
18
|
+
case 'ELLIPSE': drawEllpse(recordDxf, entity, group, key, configParams)
|
|
19
|
+
break;
|
|
20
|
+
case 'HATCH':drawHatch(recordDxf, entity, group, key, configParams)
|
|
21
|
+
break;
|
|
22
|
+
//case 'MTEXT': drawMtext(recordDxf, entity, group, key, configParams)
|
|
23
|
+
//break;
|
|
24
|
+
case 'SPLINE': drawSpline(recordDxf, entity, group, key, configParams)
|
|
25
|
+
break;
|
|
26
|
+
// case 'INSERT': drawInsert(recordDxf, entity, group, key, configParams, konvaLayer)
|
|
27
|
+
// break;
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
export function formatEntity(entities) {
|
|
@@ -67,8 +71,6 @@ export function centering(obj, container, konvaStage, scaleBy) {
|
|
|
67
71
|
} else if (target[0].className === "Line") {
|
|
68
72
|
const p = getAbsolutePoints(target[0].getPoints());
|
|
69
73
|
computedCenter(p.x, p.y, container, konvaStage, scaleBy)
|
|
70
|
-
} else {
|
|
71
|
-
computedCenter(target[0].px, target[0].py, container, konvaStage, scaleBy)
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
} else {
|
|
@@ -78,24 +80,22 @@ export function centering(obj, container, konvaStage, scaleBy) {
|
|
|
78
80
|
} else if (target[0].className === "Line") {
|
|
79
81
|
const p = getAbsolutePoints(target[0].getPoints());
|
|
80
82
|
computedCenter(p.x, p.y, container, konvaStage, scaleBy)
|
|
81
|
-
} else {
|
|
82
|
-
computedCenter(target[0].px, target[0].py, container, konvaStage, scaleBy)
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
// 计算居中位置
|
|
87
87
|
function computedCenter(x, y, container, konvaStage, scaleBy) {
|
|
88
|
-
let newX = container.clientWidth / 2 - x * scaleBy;
|
|
89
|
-
let newY = container.clientHeight / 2 -y * scaleBy;
|
|
90
|
-
konvaStage.position({ x: newX, y: newY });
|
|
88
|
+
let newX = container.clientWidth / 2 - x * scaleBy;
|
|
89
|
+
let newY = container.clientHeight / 2 -y * scaleBy;
|
|
90
|
+
konvaStage.position({ x: newX, y: newY });
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
function getBSplinePolyline(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
controlPoints,
|
|
95
|
+
degree,
|
|
96
|
+
knots,
|
|
97
|
+
interpolationsPerSplineSegment,
|
|
98
|
+
weights
|
|
99
99
|
) {
|
|
100
100
|
const polyline = [];
|
|
101
101
|
const controlPointsForLib = controlPoints.map(function (p) {
|
|
@@ -124,9 +124,9 @@ function getBSplinePolyline(
|
|
|
124
124
|
return polyline;
|
|
125
125
|
}
|
|
126
126
|
function mtextContentAndFormattingToTextAndStyle(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
textAndControlChars,
|
|
128
|
+
entity,
|
|
129
|
+
configParams
|
|
130
130
|
) {
|
|
131
131
|
let activeStyle = {
|
|
132
132
|
horizontalAlignment: "left",
|
|
@@ -149,9 +149,9 @@ function mtextContentAndFormattingToTextAndStyle(
|
|
|
149
149
|
}
|
|
150
150
|
} else if (Array.isArray(item)) {
|
|
151
151
|
var nestedFormat = mtextContentAndFormattingToTextAndStyle(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
item,
|
|
153
|
+
entity,
|
|
154
|
+
configParams
|
|
155
155
|
);
|
|
156
156
|
text.push(nestedFormat.text);
|
|
157
157
|
} else if (typeof item === "object") {
|
|
@@ -178,11 +178,11 @@ function drawArc(recordDxf, entity, group, key, configParams) {
|
|
|
178
178
|
endAngle = entity.endAngle;
|
|
179
179
|
}
|
|
180
180
|
let curve = new THREE.ArcCurve(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
entity.center.x,
|
|
182
|
+
parseFloat(entity.center.y),
|
|
183
|
+
entity.radius,
|
|
184
|
+
startAngle,
|
|
185
|
+
endAngle
|
|
186
186
|
);
|
|
187
187
|
let points = curve.getPoints(32);
|
|
188
188
|
|
|
@@ -225,24 +225,25 @@ function drawArc(recordDxf, entity, group, key, configParams) {
|
|
|
225
225
|
|
|
226
226
|
function drawEllpse(recordDxf, entity, group, key, configParams) {
|
|
227
227
|
let xrad = Math.sqrt(
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
Math.pow(parseFloat(entity.majorAxisEndPoint.x), 2) +
|
|
229
|
+
Math.pow(parseFloat(entity.majorAxisEndPoint.y), 2)
|
|
230
230
|
);
|
|
231
231
|
let yrad = xrad * parseFloat(entity.axisRatio);
|
|
232
232
|
let rotation = Math.atan2(
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
parseFloat(entity.majorAxisEndPoint.y),
|
|
234
|
+
parseFloat(entity.majorAxisEndPoint.x)
|
|
235
235
|
);
|
|
236
|
-
|
|
236
|
+
console.log(entity.startAngle);
|
|
237
|
+
console.log(entity.endAngle);
|
|
237
238
|
let curve = new THREE.EllipseCurve(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
239
|
+
parseFloat(entity.center.x),
|
|
240
|
+
parseFloat(entity.center.y),
|
|
241
|
+
xrad,
|
|
242
|
+
yrad,
|
|
243
|
+
parseFloat(entity.startAngle),
|
|
244
|
+
parseFloat(entity.endAngle),
|
|
245
|
+
false, // Always counterclockwise
|
|
246
|
+
rotation
|
|
246
247
|
);
|
|
247
248
|
let points = curve.getPoints(200);
|
|
248
249
|
let list = [];
|
|
@@ -251,6 +252,9 @@ function drawEllpse(recordDxf, entity, group, key, configParams) {
|
|
|
251
252
|
list.push(-parseFloat(points[i].y));
|
|
252
253
|
}
|
|
253
254
|
let width = 0.2;
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
254
258
|
group.push({
|
|
255
259
|
type:'polyline',
|
|
256
260
|
points:list,
|
|
@@ -294,7 +298,7 @@ function drawLine(recordDxf, entity, group, key, configParams) {
|
|
|
294
298
|
entityId: key,
|
|
295
299
|
isGroup: false,
|
|
296
300
|
stroke: configParams ? configParams.color : "#000",
|
|
297
|
-
customColor: configParams ? configParams.color : "
|
|
301
|
+
customColor: configParams ? configParams.color : "",
|
|
298
302
|
strokeWidth: width,
|
|
299
303
|
visible: configParams ? configParams.visible : true,
|
|
300
304
|
oldstrokeLength:width,
|
|
@@ -329,6 +333,8 @@ function drawText(recordDxf, entity, group, key, configParams) {
|
|
|
329
333
|
}else{
|
|
330
334
|
fontSize=entity.textHeight+0.35;
|
|
331
335
|
}
|
|
336
|
+
|
|
337
|
+
|
|
332
338
|
let startPoint = entity.startPoint;
|
|
333
339
|
let x = startPoint.x;
|
|
334
340
|
let y = startPoint.y;
|
|
@@ -338,7 +344,7 @@ function drawText(recordDxf, entity, group, key, configParams) {
|
|
|
338
344
|
text: text,
|
|
339
345
|
fontSize: fontSize,
|
|
340
346
|
fill: configParams ? configParams.color : "#000",
|
|
341
|
-
customColor: configParams ? configParams.color : "
|
|
347
|
+
customColor: configParams ? configParams.color : "",
|
|
342
348
|
name: key.replace(/\s*/g, ""),
|
|
343
349
|
entityId: key,
|
|
344
350
|
fontFamily: "SimSun",
|
|
@@ -347,36 +353,50 @@ function drawText(recordDxf, entity, group, key, configParams) {
|
|
|
347
353
|
strokeWidth:0.1,
|
|
348
354
|
});
|
|
349
355
|
if (entity.rotation) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
dim.attrs.rotation = 360-entity.rotation ;
|
|
367
|
-
|
|
356
|
+
if(entity.rotation==90||parseInt(entity.rotation)==90||parseInt(entity.rotation)==89||parseInt(entity.rotation)==450) {
|
|
357
|
+
dim.attrs.x = parseFloat(x) - fontSize;
|
|
358
|
+
}
|
|
359
|
+
if(entity.rotation==270||parseInt(entity.rotation)==270)
|
|
360
|
+
{
|
|
361
|
+
dim.attrs.x = parseFloat(x) + fontSize;
|
|
362
|
+
}
|
|
363
|
+
if(entity.rotation==180||parseInt(entity.rotation)==180){
|
|
364
|
+
dim.attrs.y= -parseFloat(y) - fontSize;
|
|
365
|
+
}
|
|
366
|
+
if(entity.rotation==360||parseFloat(entity.rotation)==360){
|
|
367
|
+
dim.attrs.y= -parseFloat(y) - fontSize;
|
|
368
|
+
}
|
|
369
|
+
dim.attrs.rotation = 360-entity.rotation ;
|
|
368
370
|
}else{
|
|
369
371
|
dim.attrs.y= -parseFloat(y) - fontSize;
|
|
370
372
|
}
|
|
371
373
|
if (entity.xScale) {
|
|
372
374
|
dim.attrs.fontSize =(fontSize+0.35)* entity.xScale;
|
|
373
375
|
}
|
|
376
|
+
|
|
377
|
+
let width=dim.getTextWidth()
|
|
378
|
+
//let clientRect=dim.getClientRect()
|
|
379
|
+
//let clientWidth=clientRect.width;
|
|
380
|
+
|
|
381
|
+
if(entity.halign){
|
|
382
|
+
if(entity.halign==1){
|
|
383
|
+
dim.attrs.x= dim.attrs.x-(width*1.15/2);
|
|
384
|
+
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
//dim.attrs.x= dim.attrs.x-parseFloat(2);
|
|
374
388
|
group.push({
|
|
375
389
|
"type":'text',
|
|
376
390
|
'obj':dim,
|
|
377
391
|
})
|
|
378
392
|
// group.add(dim);
|
|
379
393
|
}
|
|
394
|
+
|
|
395
|
+
function drawHatch(recordDxf,entity,group,key,configParams){
|
|
396
|
+
|
|
397
|
+
console.log("hatch");
|
|
398
|
+
}
|
|
399
|
+
|
|
380
400
|
function drawLwLine(recordDxf, entity, group, key, configParams) {
|
|
381
401
|
let closed = entity.shape;
|
|
382
402
|
let list=[];
|
|
@@ -385,23 +405,23 @@ function drawLwLine(recordDxf, entity, group, key, configParams) {
|
|
|
385
405
|
list.push(-parseFloat(entity.vertices[i].y));
|
|
386
406
|
}
|
|
387
407
|
let width = 0.2;
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
408
|
+
if(entity.width){
|
|
409
|
+
width=width+parseFloat(entity.width);
|
|
410
|
+
}else{
|
|
411
|
+
width=0.2;
|
|
412
|
+
}
|
|
413
|
+
group.push({
|
|
414
|
+
type:"polyline",
|
|
415
|
+
points:list,
|
|
416
|
+
closed:closed,
|
|
417
|
+
name: key.replace(/\s*/g, ""),
|
|
418
|
+
entityId: key,
|
|
419
|
+
stroke: configParams ? configParams.color : "#000",
|
|
420
|
+
customColor: configParams ? configParams.color : "",
|
|
421
|
+
strokeWidth: width,
|
|
422
|
+
visible: configParams ? configParams.visible : true,
|
|
423
|
+
oldstrokeLength:width,
|
|
424
|
+
})
|
|
405
425
|
// let line = new Konva.Line({
|
|
406
426
|
// name: key.replace(/\s*/g, ""),
|
|
407
427
|
// entityId: key,
|
|
@@ -420,10 +440,10 @@ function drawLwLine(recordDxf, entity, group, key, configParams) {
|
|
|
420
440
|
}
|
|
421
441
|
function drawSpline(recordDxf, entity, group, key, configParams) {
|
|
422
442
|
let points = getBSplinePolyline(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
443
|
+
entity.controlPoints,
|
|
444
|
+
entity.degreeOfSplineCurve,
|
|
445
|
+
entity.knotValues,
|
|
446
|
+
100
|
|
427
447
|
);
|
|
428
448
|
let list = [];
|
|
429
449
|
for (let i = 0; i < points.length; i++) {
|
|
@@ -438,7 +458,7 @@ function drawSpline(recordDxf, entity, group, key, configParams) {
|
|
|
438
458
|
entityId: key,
|
|
439
459
|
isGroup: false,
|
|
440
460
|
stroke: configParams ? configParams : "#000",
|
|
441
|
-
customColor: configParams ? configParams.color : "
|
|
461
|
+
customColor: configParams ? configParams.color : "",
|
|
442
462
|
strokeWidth: width,
|
|
443
463
|
visible: configParams ? configParams.visible : true,
|
|
444
464
|
oldstrokeLength: width
|
|
@@ -487,13 +507,13 @@ function drawInsert(recordDxf, entities, group, key, configParams, konvaLayer) {
|
|
|
487
507
|
group2.attrs.y = -parseFloat(entity.position.y);
|
|
488
508
|
}
|
|
489
509
|
if(entity.position.x<0){
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
510
|
+
group2.attrs.x = parseFloat(entity.position.x)*-1;
|
|
511
|
+
if(entity.xScale<0){
|
|
512
|
+
group2.scale({ x: Math.abs(entity.xScale), y: entity.yScale });
|
|
513
|
+
}
|
|
494
514
|
}
|
|
495
515
|
if(block.entities==undefined){
|
|
496
|
-
|
|
516
|
+
return ;
|
|
497
517
|
}
|
|
498
518
|
for (let j = 0; j < block.entities.length; j++) {
|
|
499
519
|
let type = block.entities[j].type;
|
|
@@ -505,3 +525,262 @@ function drawInsert(recordDxf, entities, group, key, configParams, konvaLayer) {
|
|
|
505
525
|
konvaLayer.add(group)
|
|
506
526
|
}
|
|
507
527
|
}
|
|
528
|
+
|
|
529
|
+
let color= [
|
|
530
|
+
'0,0,0',//1
|
|
531
|
+
'255,0,0',//2
|
|
532
|
+
'255,255,0',//3
|
|
533
|
+
'0,255,0',//4
|
|
534
|
+
'0,255,255',//5
|
|
535
|
+
'0,0,255',//6
|
|
536
|
+
'255,0,255',//7
|
|
537
|
+
'255,255,255',//8
|
|
538
|
+
'128,128,128',//9
|
|
539
|
+
'192,192,192',//10
|
|
540
|
+
'255,0,0',//11
|
|
541
|
+
'255,120,112',//12
|
|
542
|
+
'192,0,0',//13
|
|
543
|
+
'207,103,96',//14
|
|
544
|
+
'144,0,0',//15
|
|
545
|
+
'144,72,79',//16
|
|
546
|
+
'127,0,0',//17
|
|
547
|
+
'112,56,48',//18
|
|
548
|
+
'79,0,0',//19
|
|
549
|
+
'79,39,32',//20
|
|
550
|
+
'255,56,0',//21
|
|
551
|
+
'255,159,127',//22
|
|
552
|
+
'192,48,0',//23
|
|
553
|
+
'207,127,96',//24
|
|
554
|
+
'144,32,0',//25
|
|
555
|
+
'144,88,64',// 26
|
|
556
|
+
'112,24,0',//27
|
|
557
|
+
'127,72,63',//28
|
|
558
|
+
'79,16,0',//29
|
|
559
|
+
'64,40,31',//30
|
|
560
|
+
'255,127,0',//31
|
|
561
|
+
'255,191,127',//32
|
|
562
|
+
'207,103,0',//33
|
|
563
|
+
'192,151,96',//34
|
|
564
|
+
'159,72,0',//35
|
|
565
|
+
'144,112,79',//36
|
|
566
|
+
'127,63,0',//37
|
|
567
|
+
'127,95,63',//38
|
|
568
|
+
'64,32,0',//39
|
|
569
|
+
'64,55,31',//40
|
|
570
|
+
'255,191,0',// 41
|
|
571
|
+
'255,216,127',//42
|
|
572
|
+
'207,152,0',//43
|
|
573
|
+
'192,175,96',//44
|
|
574
|
+
'144,112,0',//45
|
|
575
|
+
'144,128,64',//46
|
|
576
|
+
'112,88,0',//47
|
|
577
|
+
'127,111,63',//48
|
|
578
|
+
'64,55,0',//49
|
|
579
|
+
'64,63,31',//50
|
|
580
|
+
'255,255,0',//51
|
|
581
|
+
'255,255,112',//52
|
|
582
|
+
'207,200,0',//53
|
|
583
|
+
'192,200,96',//54
|
|
584
|
+
'144,151,0',//55
|
|
585
|
+
'144,151,64',//56
|
|
586
|
+
'144,152,0',//57
|
|
587
|
+
'127,120,63',//58
|
|
588
|
+
'79,72,0',//59
|
|
589
|
+
'79,72,32',//60
|
|
590
|
+
'191,255,0',//61
|
|
591
|
+
'208,255,112',//62
|
|
592
|
+
'144,200,0',//63
|
|
593
|
+
'176,200,96',//64
|
|
594
|
+
'111,151,0',//65
|
|
595
|
+
'128,151,79',//66
|
|
596
|
+
'95,127,0',//67
|
|
597
|
+
'111,127,63',//68
|
|
598
|
+
'48,72,0',//69
|
|
599
|
+
'63,72,31',//70
|
|
600
|
+
'127,255,0',//71
|
|
601
|
+
'191,255,127',//72
|
|
602
|
+
'95,200,0',//73
|
|
603
|
+
'159,200,96',//74
|
|
604
|
+
'64,151,0',//75
|
|
605
|
+
'111,151,64',//76
|
|
606
|
+
'63,120,0',//77
|
|
607
|
+
'95,127,63',//78
|
|
608
|
+
'31,72,0',//79
|
|
609
|
+
'48,72,32',//80
|
|
610
|
+
'63,255,0',//81
|
|
611
|
+
'159,255,127',//82
|
|
612
|
+
'47,200,0',//83
|
|
613
|
+
'127,200,96',//84
|
|
614
|
+
'31,151,0',//85
|
|
615
|
+
'80,151,64',//86
|
|
616
|
+
'31,127,0',//87
|
|
617
|
+
'79,127,63',//88
|
|
618
|
+
'15,72,0',//89
|
|
619
|
+
'47,72,32',//90
|
|
620
|
+
'0,255,0',//91
|
|
621
|
+
'127,255,127',//92
|
|
622
|
+
'0,200,0',//93
|
|
623
|
+
'95,200,95',//94
|
|
624
|
+
'0,151,0',//95
|
|
625
|
+
'79,151,79',//96
|
|
626
|
+
'0,127,0',//97
|
|
627
|
+
'63,127,63',//98
|
|
628
|
+
'0,72,0',//99
|
|
629
|
+
'32,72,32',//100
|
|
630
|
+
'0,255,63',//101
|
|
631
|
+
'127,255,159',//102
|
|
632
|
+
'0,200,47',//103
|
|
633
|
+
'95,200,112',//104
|
|
634
|
+
'0,151,32',//105
|
|
635
|
+
'64,151,95',//106
|
|
636
|
+
'0,120,31',//107
|
|
637
|
+
'63,127,79',//108
|
|
638
|
+
'0,72,15',//109
|
|
639
|
+
'32,72,47',//110
|
|
640
|
+
'0,255,127',//111
|
|
641
|
+
'127,255,191',//112
|
|
642
|
+
'0,200,96',//113
|
|
643
|
+
'95,200,144',//114
|
|
644
|
+
'0,151,64',//115
|
|
645
|
+
'79,151,111',//116
|
|
646
|
+
'0,127,63',//117
|
|
647
|
+
'63,127,95',//118
|
|
648
|
+
'0,72,32',//119
|
|
649
|
+
'31,72,48',//120
|
|
650
|
+
'0,255,191',//121
|
|
651
|
+
'127,255,223',//122
|
|
652
|
+
'0,200,144',//123
|
|
653
|
+
'95,200,175',//124
|
|
654
|
+
'0,151,111',//125
|
|
655
|
+
'79,151,128',//126
|
|
656
|
+
'0,120,95',//127
|
|
657
|
+
'63,127,111',//128
|
|
658
|
+
'0,72,48',//129
|
|
659
|
+
'32,72,63',//130
|
|
660
|
+
'0,255,255',//131
|
|
661
|
+
'127,255,255',//132
|
|
662
|
+
'0,200,207',//133
|
|
663
|
+
'96,200,207',//134
|
|
664
|
+
'0,151,144',//135
|
|
665
|
+
'64,151,144',//136
|
|
666
|
+
'0,127,127',//137
|
|
667
|
+
'63,127,127',//138
|
|
668
|
+
'0,72,79',//139
|
|
669
|
+
'32,72,79',//140
|
|
670
|
+
'0,191,255',//141
|
|
671
|
+
'127,223,255',//142
|
|
672
|
+
'0,152,207',//143
|
|
673
|
+
'96,176,207',//144
|
|
674
|
+
'0,111,144',//145
|
|
675
|
+
'64,128,144',//146
|
|
676
|
+
'0,95,127',//147
|
|
677
|
+
'63,111,127',//148
|
|
678
|
+
'0,55,64',//149
|
|
679
|
+
'31,63,64',//150
|
|
680
|
+
'0,127,255',//151
|
|
681
|
+
'112,184,255',//152
|
|
682
|
+
'0,96,192',//153
|
|
683
|
+
'96,151,207',//154
|
|
684
|
+
'0,72,159',//155
|
|
685
|
+
'79,112,144',//156
|
|
686
|
+
'0,63,127',//157
|
|
687
|
+
'63,95,127',//158
|
|
688
|
+
'0,39,79',//159
|
|
689
|
+
'32,56,79',//160
|
|
690
|
+
'0,63,255',//161
|
|
691
|
+
'127,159,255',//162
|
|
692
|
+
'0,48,207',//163
|
|
693
|
+
'96,127,207',//164
|
|
694
|
+
'0,39,159',//165
|
|
695
|
+
'64,95,144',//166
|
|
696
|
+
'0,24,127',//167
|
|
697
|
+
'63,79,127',//168
|
|
698
|
+
'0,15,64',//169
|
|
699
|
+
'32,47,79',//170
|
|
700
|
+
'0,0,255',//171
|
|
701
|
+
'127,127,255',//172
|
|
702
|
+
'0,0,207',//173
|
|
703
|
+
'95,96,192',//174
|
|
704
|
+
'0,0,144',//175
|
|
705
|
+
'79,72,159',//176
|
|
706
|
+
'0,0,127',//177
|
|
707
|
+
'63,63,127',//178
|
|
708
|
+
'0,0,64',//179
|
|
709
|
+
'32,39,79',//180
|
|
710
|
+
'63,0,255',//181
|
|
711
|
+
'159,127,255',//182
|
|
712
|
+
'47,0,192',//183
|
|
713
|
+
'127,103,207',//184
|
|
714
|
+
'32,0,144',//185
|
|
715
|
+
'80,72,144',//186
|
|
716
|
+
'31,0,127',//187
|
|
717
|
+
'79,63,127',//188
|
|
718
|
+
'15,0,79',//189
|
|
719
|
+
'47,39,79',//190
|
|
720
|
+
'127,0,255',//191
|
|
721
|
+
'191,127,255',//192
|
|
722
|
+
'96,0,207',//193
|
|
723
|
+
'144,103,207',//194
|
|
724
|
+
'79,0,144',//195
|
|
725
|
+
'111,72,144',//196
|
|
726
|
+
'63,0,127',//197
|
|
727
|
+
'95,63,127',//198
|
|
728
|
+
'31,0,64',//199
|
|
729
|
+
'48,39,79',//200
|
|
730
|
+
'191,0,255',//201
|
|
731
|
+
'223,127,255',//202
|
|
732
|
+
'144,0,207',//203
|
|
733
|
+
'175,96,192',//204
|
|
734
|
+
'111,0,144',//205
|
|
735
|
+
'128,72,159',//206
|
|
736
|
+
'95,0,127',//207
|
|
737
|
+
'96,56,112',//208
|
|
738
|
+
'48,0,64',//209
|
|
739
|
+
'64,39,79',//210
|
|
740
|
+
'255,0,255',//211
|
|
741
|
+
'255,127,255',//212
|
|
742
|
+
'192,0,192',//213
|
|
743
|
+
'192,96,192',//214
|
|
744
|
+
'144,0,144',//215
|
|
745
|
+
'144,72,144',//216
|
|
746
|
+
'127,0,127',//217
|
|
747
|
+
'127,63,127',//218
|
|
748
|
+
'79,0,79',//219
|
|
749
|
+
'64,32,64',//220
|
|
750
|
+
'255,0,191',//221
|
|
751
|
+
'255,127,223',//222
|
|
752
|
+
'192,0,144',//223
|
|
753
|
+
'192,96,175',//224
|
|
754
|
+
'144,0,111',//225
|
|
755
|
+
'144,72,128',//226
|
|
756
|
+
'127,0,95',//227
|
|
757
|
+
'127,56,111',//228
|
|
758
|
+
'64,0,48',//229
|
|
759
|
+
'79,39,63',//230
|
|
760
|
+
'255,0,127',//231
|
|
761
|
+
'255,127,191',//232
|
|
762
|
+
'192,0,95',//233
|
|
763
|
+
'192,96,144',//234
|
|
764
|
+
'159,0,79',//235
|
|
765
|
+
'144,72,111',//236
|
|
766
|
+
'127,0,63',//237
|
|
767
|
+
'127,63,95',//238
|
|
768
|
+
'64,0,31',//239
|
|
769
|
+
'64,32,48',//240
|
|
770
|
+
'255,0,63',//241
|
|
771
|
+
'255,127,159',//242
|
|
772
|
+
'207,0,48',//243
|
|
773
|
+
'207,103,127',//244
|
|
774
|
+
'144,0,32',//245
|
|
775
|
+
'144,72,95',//246
|
|
776
|
+
'127,0,31',//247
|
|
777
|
+
'127,63,79',//248
|
|
778
|
+
'79,0,15',//249
|
|
779
|
+
'64,32,47',//250
|
|
780
|
+
'47,47,47',//251
|
|
781
|
+
'80,88,80',//252
|
|
782
|
+
'128,128,128',//253
|
|
783
|
+
'175,175,175',//254
|
|
784
|
+
'208,215,208',//255
|
|
785
|
+
'255,255,255'//256
|
|
786
|
+
];
|