fl-web-component 2.0.0-beta.9 → 2.0.0

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.
Files changed (33) hide show
  1. package/dist/fl-web-component.common.js +34592 -1519
  2. package/dist/fl-web-component.common.js.map +1 -1
  3. package/dist/fl-web-component.css +1 -1
  4. package/package.json +4 -15
  5. package/packages/components/com-card/index.vue +1 -1
  6. package/packages/components/com-flcanvas/components/bspline.js +31 -34
  7. package/packages/components/com-flcanvas/components/entityFormatting.js +810 -823
  8. package/packages/components/com-flcanvas/components/round10.js +17 -17
  9. package/packages/components/com-flcanvas/index.vue +314 -333
  10. package/packages/components/com-formDialog/index.vue +6 -4
  11. package/packages/components/com-graphics/component/ann-tool.vue +263 -208
  12. package/packages/components/com-graphics/index.vue +366 -773
  13. package/packages/components/com-graphics/pid.vue +304 -295
  14. package/packages/components/com-table/column-default.vue +2 -3
  15. package/packages/components/com-table/column-dynamic.vue +7 -4
  16. package/packages/components/com-table/column.vue +1 -2
  17. package/packages/components/com-table/index.vue +6 -5
  18. package/packages/components/com-tabs/index.vue +1 -2
  19. package/packages/components/com-tiles/index.vue +134 -136
  20. package/packages/components/com-treeDynamic/index.vue +1 -1
  21. package/packages/utils/StreamLoader.js +1548 -1489
  22. package/packages/utils/StreamLoaderParser.worker.js +9 -14
  23. package/src/main.js +2 -8
  24. package/src/utils/cloud.js +28 -28
  25. package/src/utils/cursor.js +11 -9
  26. package/src/utils/flgltf-parser.js +257 -245
  27. package/src/utils/instance-parser.js +20 -22
  28. package/src/utils/mini-devtool.js +94 -39
  29. package/src/utils/threejs/measure-angle.js +51 -13
  30. package/src/utils/threejs/measure-area.js +43 -12
  31. package/src/utils/threejs/measure-distance.js +43 -12
  32. package/src/utils/threejs/rain-shader.js +10 -10
  33. package/src/utils/threejs/snow-shader.js +9 -9
@@ -1,876 +1,863 @@
1
- import bSpline from "./bspline";
2
- import * as THREE from "three";
1
+ import bSpline from './bspline';
2
+ import * as THREE from 'three';
3
3
 
4
4
  //rgb转换
5
5
 
6
6
  function decimalToRGBHex(decimalValue) {
7
- // Ensure the input is a valid integer
8
- if (!Number.isInteger(decimalValue)) {
9
- throw new Error("Input must be an integer.");
10
- }
11
-
12
- // Ensure the input is within the valid range for 24-bit colors
13
- if (decimalValue < 0 || decimalValue > 0xFFFFFF) {
14
- throw new Error("Input must be between 0 and 16777215 (0xFFFFFF).");
15
- }
16
-
17
- // Extract the red, green, and blue components
18
- var red = (decimalValue >> 16) & 0xFF;
19
- var green = (decimalValue >> 8) & 0xFF;
20
- var blue = decimalValue & 0xFF;
21
-
22
- // Convert the RGB components to hexadecimal and format as a string
23
- var hex = "#" + red.toString(16).padStart(2, '0') +
24
- green.toString(16).padStart(2, '0') +
25
- blue.toString(16).padStart(2, '0');
26
-
27
- return {
28
- red: red,
29
- green: green,
30
- blue: blue,
31
- hex: hex.toUpperCase()
32
- };
7
+ // Ensure the input is a valid integer
8
+ if (!Number.isInteger(decimalValue)) {
9
+ throw new Error('Input must be an integer.');
10
+ }
11
+
12
+ // Ensure the input is within the valid range for 24-bit colors
13
+ if (decimalValue < 0 || decimalValue > 0xffffff) {
14
+ throw new Error('Input must be between 0 and 16777215 (0xFFFFFF).');
15
+ }
16
+
17
+ // Extract the red, green, and blue components
18
+ var red = (decimalValue >> 16) & 0xff;
19
+ var green = (decimalValue >> 8) & 0xff;
20
+ var blue = decimalValue & 0xff;
21
+
22
+ // Convert the RGB components to hexadecimal and format as a string
23
+ var hex =
24
+ '#' +
25
+ red.toString(16).padStart(2, '0') +
26
+ green.toString(16).padStart(2, '0') +
27
+ blue.toString(16).padStart(2, '0');
28
+
29
+ return {
30
+ red: red,
31
+ green: green,
32
+ blue: blue,
33
+ hex: hex.toUpperCase(),
34
+ };
33
35
  }
34
36
  export function handleFn(functionName, recordDxf, entity, group, key, configParams, konvaLayer) {
35
- console.log(functionName);
36
-
37
- switch (functionName) {
38
- case 'LINE': drawLine(recordDxf, entity, group, key, configParams)
39
- break;
40
- case 'TEXT': drawText(recordDxf, entity, group, key, configParams)
41
- break;
42
- case 'LWPOLYLINE': drawLwLine(recordDxf, entity, group, key, configParams)
43
- break;
44
- case 'ARC': drawArc(recordDxf, entity, group, key, configParams)
45
- break;
46
- case 'CIRCLE': drawArc(recordDxf, entity, group, key, configParams)
47
- break;
48
- case 'ELLIPSE': drawEllpse(recordDxf, entity, group, key, configParams)
49
- break;
50
- case 'HATCH':drawHatch(recordDxf, entity, group, key, configParams)
51
- break;
52
- //case 'MTEXT': drawMtext(recordDxf, entity, group, key, configParams)
53
- //break;
54
- case 'SPLINE': drawSpline(recordDxf, entity, group, key, configParams)
55
- break;
56
- // case 'INSERT': drawInsert(recordDxf, entity, group, key, configParams, konvaLayer)
57
- // break;
58
- }
37
+ console.log(functionName);
38
+
39
+ switch (functionName) {
40
+ case 'LINE':
41
+ drawLine(recordDxf, entity, group, key, configParams);
42
+ break;
43
+ case 'TEXT':
44
+ drawText(recordDxf, entity, group, key, configParams);
45
+ break;
46
+ case 'LWPOLYLINE':
47
+ drawLwLine(recordDxf, entity, group, key, configParams);
48
+ break;
49
+ case 'ARC':
50
+ drawArc(recordDxf, entity, group, key, configParams);
51
+ break;
52
+ case 'CIRCLE':
53
+ drawArc(recordDxf, entity, group, key, configParams);
54
+ break;
55
+ case 'ELLIPSE':
56
+ drawEllpse(recordDxf, entity, group, key, configParams);
57
+ break;
58
+ case 'HATCH':
59
+ drawHatch(recordDxf, entity, group, key, configParams);
60
+ break;
61
+ //case 'MTEXT': drawMtext(recordDxf, entity, group, key, configParams)
62
+ //break;
63
+ case 'SPLINE':
64
+ drawSpline(recordDxf, entity, group, key, configParams);
65
+ break;
66
+ // case 'INSERT': drawInsert(recordDxf, entity, group, key, configParams, konvaLayer)
67
+ // break;
68
+ }
59
69
  }
60
- export function formatEntity(entities) {
61
- var obj = {}
62
- for (let i = 0; i < entities.length; i++) {
63
- if (obj.hasOwnProperty(entities[i].layer)) {
64
- obj[entities[i].layer].push(entities[i])
65
- } else {
66
- obj[entities[i].layer] = []
67
- obj[entities[i].layer].push(entities[i])
68
- }
70
+ export function formatEntity(entities) {
71
+ var obj = {};
72
+ for (let i = 0; i < entities.length; i++) {
73
+ if (obj.hasOwnProperty(entities[i].layer)) {
74
+ obj[entities[i].layer].push(entities[i]);
75
+ } else {
76
+ obj[entities[i].layer] = [];
77
+ obj[entities[i].layer].push(entities[i]);
69
78
  }
70
- return obj
79
+ }
80
+ return obj;
71
81
  }
72
82
  export function getAbsolutePoints(points) {
73
- let x = 0;
74
- let y = 0;
75
- points.forEach((point, index) => {
76
- if (index % 2 === 0) {
77
- x = x + point;
78
- } else {
79
- y = y + point;
80
- }
81
- });
82
- return {
83
- x: Math.ceil(x / (points.length / 2)),
84
- y: Math.ceil(y / (points.length / 2)),
85
- };
83
+ let x = 0;
84
+ let y = 0;
85
+ points.forEach((point, index) => {
86
+ if (index % 2 === 0) {
87
+ x = x + point;
88
+ } else {
89
+ y = y + point;
90
+ }
91
+ });
92
+ return {
93
+ x: Math.ceil(x / (points.length / 2)),
94
+ y: Math.ceil(y / (points.length / 2)),
95
+ };
86
96
  }
87
97
  export function getColors() {
88
- return colors;
98
+ return colors;
89
99
  }
90
100
  // 居中定位
91
101
  export function centering(obj, container, konvaStage, scaleBy) {
92
- // 由于图纸结构解析的变更 可能最外层的group x y 都是0所以 需要拿到x y有值的group
93
- const filterGroup = obj.filter(item => item.attrs.isGroup && !item.attrs.isMix)
94
- if (filterGroup.length > 0) {
95
- if (filterGroup[0].attrs.hasOwnProperty('isBlock') && filterGroup[0].attrs.isBlock) {
96
- computedCenter(filterGroup[0].attrs.x, filterGroup[0].attrs.y, container, konvaStage, scaleBy)
97
- } else {
98
- const target = obj.filter((item) => !item.attrs.isGroup);
99
- if (target[0].className === "Text") {
100
- computedCenter(target[0].x(), target[0].y(), container, konvaStage, scaleBy)
101
- } else if (target[0].className === "Line") {
102
- const p = getAbsolutePoints(target[0].getPoints());
103
- computedCenter(p.x, p.y, container, konvaStage, scaleBy)
104
- }
105
- }
102
+ // 由于图纸结构解析的变更 可能最外层的group x y 都是0所以 需要拿到x y有值的group
103
+ const filterGroup = obj.filter(item => item.attrs.isGroup && !item.attrs.isMix);
104
+ if (filterGroup.length > 0) {
105
+ if (filterGroup[0].attrs.hasOwnProperty('isBlock') && filterGroup[0].attrs.isBlock) {
106
+ computedCenter(
107
+ filterGroup[0].attrs.x,
108
+ filterGroup[0].attrs.y,
109
+ container,
110
+ konvaStage,
111
+ scaleBy
112
+ );
106
113
  } else {
107
- const target = obj.filter((item) => !item.attrs.isGroup);
108
- if (target[0].className === "Text") {
109
- computedCenter(target[0].x(), target[0].y(), container, konvaStage, scaleBy)
110
- } else if (target[0].className === "Line") {
111
- const p = getAbsolutePoints(target[0].getPoints());
112
- computedCenter(p.x, p.y, container, konvaStage, scaleBy)
113
- }
114
+ const target = obj.filter(item => !item.attrs.isGroup);
115
+ if (target[0].className === 'Text') {
116
+ computedCenter(target[0].x(), target[0].y(), container, konvaStage, scaleBy);
117
+ } else if (target[0].className === 'Line') {
118
+ const p = getAbsolutePoints(target[0].getPoints());
119
+ computedCenter(p.x, p.y, container, konvaStage, scaleBy);
120
+ }
121
+ }
122
+ } else {
123
+ const target = obj.filter(item => !item.attrs.isGroup);
124
+ if (target[0].className === 'Text') {
125
+ computedCenter(target[0].x(), target[0].y(), container, konvaStage, scaleBy);
126
+ } else if (target[0].className === 'Line') {
127
+ const p = getAbsolutePoints(target[0].getPoints());
128
+ computedCenter(p.x, p.y, container, konvaStage, scaleBy);
114
129
  }
130
+ }
115
131
  }
116
132
  // 计算居中位置
117
133
  function computedCenter(x, y, container, konvaStage, scaleBy) {
118
- let newX = container.clientWidth / 2 - x * scaleBy;
119
- let newY = container.clientHeight / 2 -y * scaleBy;
120
- konvaStage.position({ x: newX, y: newY });
134
+ let newX = container.clientWidth / 2 - x * scaleBy;
135
+ let newY = container.clientHeight / 2 - y * scaleBy;
136
+ konvaStage.position({ x: newX, y: newY });
121
137
  }
122
138
 
123
- function getBSplinePolyline(
124
- controlPoints,
125
- degree,
126
- knots,
127
- interpolationsPerSplineSegment,
128
- weights
129
- ) {
130
- const polyline = [];
131
- const controlPointsForLib = controlPoints.map(function (p) {
132
- return [p.x, p.y];
133
- });
134
- const segmentTs = [knots[degree]];
135
- const domain = [knots[degree], knots[knots.length - 1 - degree]];
136
- for (let k = degree + 1; k < knots.length - degree; ++k) {
137
- if (segmentTs[segmentTs.length - 1] !== knots[k]) {
138
- segmentTs.push(knots[k]);
139
- }
139
+ function getBSplinePolyline(controlPoints, degree, knots, interpolationsPerSplineSegment, weights) {
140
+ const polyline = [];
141
+ const controlPointsForLib = controlPoints.map(function (p) {
142
+ return [p.x, p.y];
143
+ });
144
+ const segmentTs = [knots[degree]];
145
+ const domain = [knots[degree], knots[knots.length - 1 - degree]];
146
+ for (let k = degree + 1; k < knots.length - degree; ++k) {
147
+ if (segmentTs[segmentTs.length - 1] !== knots[k]) {
148
+ segmentTs.push(knots[k]);
140
149
  }
141
- interpolationsPerSplineSegment = interpolationsPerSplineSegment || 25;
142
- for (let i = 1; i < segmentTs.length; ++i) {
143
- const uMin = segmentTs[i - 1];
144
- const uMax = segmentTs[i];
145
- for (let k = 0; k <= interpolationsPerSplineSegment; ++k) {
146
- const u = (k / interpolationsPerSplineSegment) * (uMax - uMin) + uMin;
147
- let t = (u - domain[0]) / (domain[1] - domain[0]);
148
- t = Math.max(t, 0);
149
- t = Math.min(t, 1);
150
- const p = bSpline(t, degree, controlPointsForLib, knots, weights);
151
- polyline.push(new THREE.Vector2(p[0], p[1]));
152
- }
150
+ }
151
+ interpolationsPerSplineSegment = interpolationsPerSplineSegment || 25;
152
+ for (let i = 1; i < segmentTs.length; ++i) {
153
+ const uMin = segmentTs[i - 1];
154
+ const uMax = segmentTs[i];
155
+ for (let k = 0; k <= interpolationsPerSplineSegment; ++k) {
156
+ const u = (k / interpolationsPerSplineSegment) * (uMax - uMin) + uMin;
157
+ let t = (u - domain[0]) / (domain[1] - domain[0]);
158
+ t = Math.max(t, 0);
159
+ t = Math.min(t, 1);
160
+ const p = bSpline(t, degree, controlPointsForLib, knots, weights);
161
+ polyline.push(new THREE.Vector2(p[0], p[1]));
153
162
  }
154
- return polyline;
163
+ }
164
+ return polyline;
155
165
  }
156
- function mtextContentAndFormattingToTextAndStyle(
157
- textAndControlChars,
158
- entity,
159
- configParams
160
- ) {
161
- let activeStyle = {
162
- horizontalAlignment: "left",
163
- textHeight: entity.height,
164
- };
165
- var text = [];
166
- for (let item of textAndControlChars) {
167
- if (typeof item === "string") {
168
- if (item.startsWith("pxq") && item.endsWith(";")) {
169
- if (item.indexOf("c") !== -1)
170
- activeStyle.horizontalAlignment = "center";
171
- else if (item.indexOf("l") !== -1)
172
- activeStyle.horizontalAlignment = "left";
173
- else if (item.indexOf("r") !== -1)
174
- activeStyle.horizontalAlignment = "right";
175
- else if (item.indexOf("j") !== -1)
176
- activeStyle.horizontalAlignment = "justify";
177
- } else {
178
- text.push(item);
179
- }
180
- } else if (Array.isArray(item)) {
181
- var nestedFormat = mtextContentAndFormattingToTextAndStyle(
182
- item,
183
- entity,
184
- configParams
185
- );
186
- text.push(nestedFormat.text);
187
- } else if (typeof item === "object") {
188
- if (item["S"] && item["S"].length === 3) {
189
- text.push(item["S"][0] + "/" + item["S"][2]);
190
- } else {
191
- // not yet supported.
192
- }
193
- }
166
+ function mtextContentAndFormattingToTextAndStyle(textAndControlChars, entity, configParams) {
167
+ let activeStyle = {
168
+ horizontalAlignment: 'left',
169
+ textHeight: entity.height,
170
+ };
171
+ var text = [];
172
+ for (let item of textAndControlChars) {
173
+ if (typeof item === 'string') {
174
+ if (item.startsWith('pxq') && item.endsWith(';')) {
175
+ if (item.indexOf('c') !== -1) activeStyle.horizontalAlignment = 'center';
176
+ else if (item.indexOf('l') !== -1) activeStyle.horizontalAlignment = 'left';
177
+ else if (item.indexOf('r') !== -1) activeStyle.horizontalAlignment = 'right';
178
+ else if (item.indexOf('j') !== -1) activeStyle.horizontalAlignment = 'justify';
179
+ } else {
180
+ text.push(item);
181
+ }
182
+ } else if (Array.isArray(item)) {
183
+ var nestedFormat = mtextContentAndFormattingToTextAndStyle(item, entity, configParams);
184
+ text.push(nestedFormat.text);
185
+ } else if (typeof item === 'object') {
186
+ if (item['S'] && item['S'].length === 3) {
187
+ text.push(item['S'][0] + '/' + item['S'][2]);
188
+ } else {
189
+ // not yet supported.
190
+ }
194
191
  }
195
- return {
196
- text: text.join(),
197
- style: activeStyle,
198
- };
192
+ }
193
+ return {
194
+ text: text.join(),
195
+ style: activeStyle,
196
+ };
199
197
  }
200
198
 
201
199
  function drawArc(recordDxf, entity, group, key, configParams) {
202
-
203
- let color=entity.color;
204
- let rgb=decimalToRGBHex(color);
205
- console.log(rgb);
206
- let hex=rgb.hex;
207
- let startAngle, endAngle;
208
- if (entity.type === "CIRCLE") {
209
- startAngle = entity.startAngle || 0;
210
- endAngle = startAngle + 2 * Math.PI;
211
- } else {
212
- startAngle = entity.startAngle;
213
- endAngle = entity.endAngle;
214
- }
215
- let curve = new THREE.ArcCurve(
216
- entity.center.x,
217
- parseFloat(entity.center.y),
218
- entity.radius,
219
- startAngle,
220
- endAngle
221
- );
222
- let points = curve.getPoints(32);
223
-
224
- let list = [];
225
- for (let i = 0; i < points.length; i++) {
226
- list.push(points[i].x);
227
- list.push(-parseFloat(points[i].y));
228
- }
229
- let width = 0.2;
230
- group.push({
231
- type:'polyline',
232
- points:list,
233
- name: key.replace(/\s*/g, ""),
234
- entityId: key,
235
- stroke: hex,
236
- customColor: configParams ? configParams.color : "",
237
- strokeWidth: width,
238
- visible: configParams ? configParams.visible :true,
239
- oldstrokeLength:width
240
- });
241
- // if(group.attrs.isBlock){
242
- // let scale=group.scale();
243
- // width=width/Math.abs(scale.x);
244
- // }
245
- // let line = new Konva.Line({
246
- // name: key.replace(/\s*/g, ""),
247
- // entityId: key,
248
- // isGroup: false,
249
- // points: list,
250
- // stroke: configParams ? configParams.color : "#000",
251
- // customColor: configParams ? configParams.color : "",
252
- // strokeWidth: width,
253
- // lineCap: "round",
254
- // lineJoin: "round",
255
- // visible: configParams ? configParams.visible :true,
256
- // oldstrokeLength:width
257
- // });
258
- // group.add(line);
200
+ let color = entity.color;
201
+ let rgb = decimalToRGBHex(color);
202
+ console.log(rgb);
203
+ let hex = rgb.hex;
204
+ let startAngle, endAngle;
205
+ if (entity.type === 'CIRCLE') {
206
+ startAngle = entity.startAngle || 0;
207
+ endAngle = startAngle + 2 * Math.PI;
208
+ } else {
209
+ startAngle = entity.startAngle;
210
+ endAngle = entity.endAngle;
211
+ }
212
+ let curve = new THREE.ArcCurve(
213
+ entity.center.x,
214
+ parseFloat(entity.center.y),
215
+ entity.radius,
216
+ startAngle,
217
+ endAngle
218
+ );
219
+ let points = curve.getPoints(32);
220
+
221
+ let list = [];
222
+ for (let i = 0; i < points.length; i++) {
223
+ list.push(points[i].x);
224
+ list.push(-parseFloat(points[i].y));
225
+ }
226
+ let width = 0.2;
227
+ group.push({
228
+ type: 'polyline',
229
+ points: list,
230
+ name: key.replace(/\s*/g, ''),
231
+ entityId: key,
232
+ stroke: hex,
233
+ customColor: configParams ? configParams.color : '',
234
+ strokeWidth: width,
235
+ visible: configParams ? configParams.visible : true,
236
+ oldstrokeLength: width,
237
+ });
238
+ // if(group.attrs.isBlock){
239
+ // let scale=group.scale();
240
+ // width=width/Math.abs(scale.x);
241
+ // }
242
+ // let line = new Konva.Line({
243
+ // name: key.replace(/\s*/g, ""),
244
+ // entityId: key,
245
+ // isGroup: false,
246
+ // points: list,
247
+ // stroke: configParams ? configParams.color : "#000",
248
+ // customColor: configParams ? configParams.color : "",
249
+ // strokeWidth: width,
250
+ // lineCap: "round",
251
+ // lineJoin: "round",
252
+ // visible: configParams ? configParams.visible :true,
253
+ // oldstrokeLength:width
254
+ // });
255
+ // group.add(line);
259
256
  }
260
257
 
261
258
  function drawEllpse(recordDxf, entity, group, key, configParams) {
262
- let xrad = Math.sqrt(
263
- Math.pow(parseFloat(entity.majorAxisEndPoint.x), 2) +
264
- Math.pow(parseFloat(entity.majorAxisEndPoint.y), 2)
265
- );
266
- let yrad = xrad * parseFloat(entity.axisRatio);
267
- let rotation = Math.atan2(
268
- parseFloat(entity.majorAxisEndPoint.y),
269
- parseFloat(entity.majorAxisEndPoint.x)
270
- );
271
- console.log(entity.startAngle);
272
- console.log(entity.endAngle);
273
- let curve = new THREE.EllipseCurve(
274
- parseFloat(entity.center.x),
275
- parseFloat(entity.center.y),
276
- xrad,
277
- yrad,
278
- parseFloat(entity.startAngle),
279
- parseFloat(entity.endAngle),
280
- false, // Always counterclockwise
281
- rotation
282
- );
283
- let points = curve.getPoints(200);
284
- let list = [];
285
- for (let i = 0; i < points.length; i++) {
286
- list.push(points[i].x);
287
- list.push(-parseFloat(points[i].y));
288
- }
289
- let width = 0.2;
290
-
291
-
292
-
293
- group.push({
294
- type:'polyline',
295
- points:list,
296
- name: key.replace(/\s*/g, ""),
297
- entityId: key,
298
- stroke: configParams ? configParams.color : "#000",
299
- customColor: configParams ? configParams.color : "",
300
- strokeWidth: width,
301
- visible: configParams ? configParams.visible : true,
302
- oldstrokeLength:width
303
- });
304
- // let line = new Konva.Line({
305
- // name: key.replace(/\s*/g, ""),
306
- // entityId: key,
307
- // isGroup: false,
308
- // points: list,
309
- // stroke: configParams ? configParams.color : "#000",
310
- // customColor: configParams ? configParams.color : "",
311
- // strokeWidth: width,
312
- // lineCap: "round",
313
- // lineJoin: "round",
314
- // visible: configParams ? configParams.visible : true,
315
- // oldstrokeLength:width
316
-
317
- // });
318
- // group.add(line);
259
+ let xrad = Math.sqrt(
260
+ Math.pow(parseFloat(entity.majorAxisEndPoint.x), 2) +
261
+ Math.pow(parseFloat(entity.majorAxisEndPoint.y), 2)
262
+ );
263
+ let yrad = xrad * parseFloat(entity.axisRatio);
264
+ let rotation = Math.atan2(
265
+ parseFloat(entity.majorAxisEndPoint.y),
266
+ parseFloat(entity.majorAxisEndPoint.x)
267
+ );
268
+ console.log(entity.startAngle);
269
+ console.log(entity.endAngle);
270
+ let curve = new THREE.EllipseCurve(
271
+ parseFloat(entity.center.x),
272
+ parseFloat(entity.center.y),
273
+ xrad,
274
+ yrad,
275
+ parseFloat(entity.startAngle),
276
+ parseFloat(entity.endAngle),
277
+ false, // Always counterclockwise
278
+ rotation
279
+ );
280
+ let points = curve.getPoints(200);
281
+ let list = [];
282
+ for (let i = 0; i < points.length; i++) {
283
+ list.push(points[i].x);
284
+ list.push(-parseFloat(points[i].y));
285
+ }
286
+ let width = 0.2;
287
+
288
+ group.push({
289
+ type: 'polyline',
290
+ points: list,
291
+ name: key.replace(/\s*/g, ''),
292
+ entityId: key,
293
+ stroke: configParams ? configParams.color : '#000',
294
+ customColor: configParams ? configParams.color : '',
295
+ strokeWidth: width,
296
+ visible: configParams ? configParams.visible : true,
297
+ oldstrokeLength: width,
298
+ });
299
+ // let line = new Konva.Line({
300
+ // name: key.replace(/\s*/g, ""),
301
+ // entityId: key,
302
+ // isGroup: false,
303
+ // points: list,
304
+ // stroke: configParams ? configParams.color : "#000",
305
+ // customColor: configParams ? configParams.color : "",
306
+ // strokeWidth: width,
307
+ // lineCap: "round",
308
+ // lineJoin: "round",
309
+ // visible: configParams ? configParams.visible : true,
310
+ // oldstrokeLength:width
311
+
312
+ // });
313
+ // group.add(line);
319
314
  }
320
315
  function drawLine(recordDxf, entity, group, key, configParams) {
321
- let color=entity.color;
322
- let rgb=decimalToRGBHex(color);
323
- console.log(rgb);
324
- let hex=rgb.hex;
325
- let x1 = entity.vertices[0].x;
326
- let y1 = entity.vertices[0].y;
327
- let x2 = entity.vertices[1].x;
328
- let y2 = entity.vertices[1].y;
329
- let width = 0.2;
330
- group.push({
331
- type:"line",
332
- x1:x1,
333
- x2:x2,
334
- y1:y1,
335
- y2:y2,
336
- name: key.replace(/\s*/g, ""),
337
- entityId: key,
338
- isGroup: false,
339
- stroke: hex,
340
- customColor: configParams ? configParams.color : "",
341
- strokeWidth: width,
342
- visible: configParams ? configParams.visible : true,
343
- oldstrokeLength:width,
344
- });
345
- // if(group.attrs.isBlock){
346
- // let scale=group.scale();
347
- // width=width/Math.abs(scale.x);
348
- // }
349
- // let line = new Konva.Line({
350
- // name: key.replace(/\s*/g, ""),
351
- // entityId: key,
352
- // isGroup: false,
353
- // points: [x1, -parseFloat(y1), parseFloat(x2), -parseFloat(y2)],
354
- // stroke: configParams ? configParams.color : "#000",
355
- // customColor: configParams ? configParams.color : "",
356
- // strokeWidth: width,
357
- // //lineCap: "round",
358
- // //lineJoin: "round",
359
- // visible: configParams ? configParams.visible : true,
360
- // oldstrokeLength:width,
361
- // handle:entity.handle
362
-
363
- // });
364
-
365
- // group.add(line);
316
+ let color = entity.color;
317
+ let rgb = decimalToRGBHex(color);
318
+ console.log(rgb);
319
+ let hex = rgb.hex;
320
+ let x1 = entity.vertices[0].x;
321
+ let y1 = entity.vertices[0].y;
322
+ let x2 = entity.vertices[1].x;
323
+ let y2 = entity.vertices[1].y;
324
+ let width = 0.2;
325
+ group.push({
326
+ type: 'line',
327
+ x1: x1,
328
+ x2: x2,
329
+ y1: y1,
330
+ y2: y2,
331
+ name: key.replace(/\s*/g, ''),
332
+ entityId: key,
333
+ isGroup: false,
334
+ stroke: hex,
335
+ customColor: configParams ? configParams.color : '',
336
+ strokeWidth: width,
337
+ visible: configParams ? configParams.visible : true,
338
+ oldstrokeLength: width,
339
+ });
340
+ // if(group.attrs.isBlock){
341
+ // let scale=group.scale();
342
+ // width=width/Math.abs(scale.x);
343
+ // }
344
+ // let line = new Konva.Line({
345
+ // name: key.replace(/\s*/g, ""),
346
+ // entityId: key,
347
+ // isGroup: false,
348
+ // points: [x1, -parseFloat(y1), parseFloat(x2), -parseFloat(y2)],
349
+ // stroke: configParams ? configParams.color : "#000",
350
+ // customColor: configParams ? configParams.color : "",
351
+ // strokeWidth: width,
352
+ // //lineCap: "round",
353
+ // //lineJoin: "round",
354
+ // visible: configParams ? configParams.visible : true,
355
+ // oldstrokeLength:width,
356
+ // handle:entity.handle
357
+
358
+ // });
359
+
360
+ // group.add(line);
366
361
  }
367
362
 
368
363
  function drawText(recordDxf, entity, group, key, configParams) {
369
-
370
- let color=entity.color;
371
- let rgb=decimalToRGBHex(color);
372
- console.log(rgb);
373
- let hex=rgb.hex;
374
-
375
- if(hex=='#FFFFFF'){
376
- hex='#000';
377
- }
378
- let text = entity.text;
379
- const fontSize = entity.textHeight;
380
-
381
- // AutoCAD TEXT 一致:绕插入点对齐锚点旋转;Y 轴翻转后角度用 360°-θ
382
- const insert =
383
- entity.endPoint &&
384
- (entity.halign !== undefined || entity.valign !== undefined)
385
- ? entity.endPoint
386
- : entity.startPoint;
387
-
388
- const dim = new Konva.Text({
389
- x: 0,
390
- y: 0,
391
- text: text,
392
- fontSize: fontSize,
393
- align: "left",
394
- verticalAlign: "top",
395
- fill: hex,
396
- customColor: configParams ? configParams.color : "",
397
- name: key.replace(/\s*/g, ""),
398
- entityId: key,
399
- fontFamily: "SimSun",
400
- visible: configParams ? configParams.visible : true,
401
- stroke: hex,
402
- strokeWidth:0.1,
403
- });
404
-
405
- if (entity.xScale) {
406
- dim.scaleX(entity.xScale);
364
+ let color = entity.color;
365
+ let rgb = decimalToRGBHex(color);
366
+ console.log(rgb);
367
+ let hex = rgb.hex;
368
+
369
+ if (hex == '#FFFFFF') {
370
+ hex = '#000';
371
+ }
372
+ let text = entity.text;
373
+ const fontSize = entity.textHeight;
374
+
375
+ // 与 AutoCAD TEXT 一致:绕插入点对齐锚点旋转;Y 轴翻转后角度用 360°-θ
376
+ const insert =
377
+ entity.endPoint && (entity.halign !== undefined || entity.valign !== undefined)
378
+ ? entity.endPoint
379
+ : entity.startPoint;
380
+
381
+ const dim = new Konva.Text({
382
+ x: 0,
383
+ y: 0,
384
+ text: text,
385
+ fontSize: fontSize,
386
+ align: 'left',
387
+ verticalAlign: 'top',
388
+ fill: hex,
389
+ customColor: configParams ? configParams.color : '',
390
+ name: key.replace(/\s*/g, ''),
391
+ entityId: key,
392
+ fontFamily: 'SimSun',
393
+ visible: configParams ? configParams.visible : true,
394
+ stroke: hex,
395
+ strokeWidth: 0.1,
396
+ });
397
+
398
+ if (entity.xScale) {
399
+ dim.scaleX(entity.xScale);
400
+ }
401
+
402
+ const tw = dim.width();
403
+ const th = dim.height();
404
+ const lh = dim.lineHeight() || 1;
405
+ // 用字体度量计算锚点,避免 valign=2(中线) 与 baseline 近似重合
406
+ let ascent = fontSize * lh * 0.8;
407
+ let descent = fontSize * lh * 0.2;
408
+ try {
409
+ const metrics = dim.measureSize(text || 'M');
410
+ const mAscent = metrics?.fontBoundingBoxAscent ?? metrics?.actualBoundingBoxAscent;
411
+ const mDescent = metrics?.fontBoundingBoxDescent ?? metrics?.actualBoundingBoxDescent;
412
+ if (typeof mAscent === 'number' && mAscent > 0) {
413
+ ascent = mAscent;
407
414
  }
408
-
409
- const tw = dim.width();
410
- const th = dim.height();
411
- const lh = dim.lineHeight() || 1;
412
- // 用字体度量计算锚点,避免 valign=2(中线) 与 baseline 近似重合
413
- let ascent = fontSize * lh * 0.8;
414
- let descent = fontSize * lh * 0.2;
415
- try {
416
- const metrics = dim.measureSize(text || "M");
417
- const mAscent =
418
- metrics?.fontBoundingBoxAscent ??
419
- metrics?.actualBoundingBoxAscent;
420
- const mDescent =
421
- metrics?.fontBoundingBoxDescent ??
422
- metrics?.actualBoundingBoxDescent;
423
- if (typeof mAscent === "number" && mAscent > 0) {
424
- ascent = mAscent;
425
- }
426
- if (typeof mDescent === "number" && mDescent >= 0) {
427
- descent = mDescent;
428
- }
429
- } catch (e) {
430
- // ignore
415
+ if (typeof mDescent === 'number' && mDescent >= 0) {
416
+ descent = mDescent;
431
417
  }
432
- const baselineOffset = ascent;
433
-
434
- const halign = entity.halign != null ? Number(entity.halign) : 0;
435
- const valign = entity.valign != null ? Number(entity.valign) : 0;
436
-
437
- let anchorX = 0;
438
- if (halign === 1 || halign === 4) {
439
- anchorX = tw / 2;
440
- } else if (halign === 2) {
441
- anchorX = tw;
442
- }
443
-
444
- let anchorY = baselineOffset;
445
- if (valign === 3) {
446
- anchorY = 0;
447
- } else if (valign === 2) {
448
- // DXF Middle: 使用字形上下边界中心,而不是 Konva 文本框中心
449
- anchorY = (ascent + descent) / 2;
450
- } else if (valign === 1) {
451
- anchorY = ascent + descent;
452
-
453
- }
454
-
455
- dim.x(-anchorX);
456
- dim.y(-anchorY);
457
-
458
- const rotation = Number(entity.rotation || 0);
459
- const g = new Konva.Group({
460
- x: parseFloat(insert.x),
461
- y: -parseFloat(insert.y),
462
- rotation: 360 - rotation,
463
- name: key.replace(/\s*/g, ""),
464
- entityId: key,
465
- visible: configParams ? configParams.visible : true,
466
- customColor: configParams ? configParams.color : "",
467
- });
468
- g.add(dim);
469
-
470
- group.push({
471
- "type":'text',
472
- 'obj': g,
473
- })
474
- // group.add(dim);
418
+ } catch (e) {
419
+ // ignore
420
+ }
421
+ const baselineOffset = ascent;
422
+
423
+ const halign = entity.halign != null ? Number(entity.halign) : 0;
424
+ const valign = entity.valign != null ? Number(entity.valign) : 0;
425
+
426
+ let anchorX = 0;
427
+ if (halign === 1 || halign === 4) {
428
+ anchorX = tw / 2;
429
+ } else if (halign === 2) {
430
+ anchorX = tw;
431
+ }
432
+
433
+ let anchorY = baselineOffset;
434
+ if (valign === 3) {
435
+ anchorY = 0;
436
+ } else if (valign === 2) {
437
+ // DXF Middle: 使用字形上下边界中心,而不是 Konva 文本框中心
438
+ anchorY = (ascent + descent) / 2;
439
+ } else if (valign === 1) {
440
+ anchorY = ascent + descent;
441
+ }
442
+
443
+ dim.x(-anchorX);
444
+ dim.y(-anchorY);
445
+
446
+ const rotation = Number(entity.rotation || 0);
447
+ const g = new Konva.Group({
448
+ x: parseFloat(insert.x),
449
+ y: -parseFloat(insert.y),
450
+ rotation: 360 - rotation,
451
+ name: key.replace(/\s*/g, ''),
452
+ entityId: key,
453
+ visible: configParams ? configParams.visible : true,
454
+ customColor: configParams ? configParams.color : '',
455
+ });
456
+ g.add(dim);
457
+
458
+ group.push({
459
+ type: 'text',
460
+ obj: g,
461
+ });
462
+ // group.add(dim);
475
463
  }
476
464
 
477
- function drawHatch(recordDxf,entity,group,key,configParams){
478
-
479
- console.log("hatch");
465
+ function drawHatch(recordDxf, entity, group, key, configParams) {
466
+ console.log('hatch');
480
467
  }
481
468
 
482
469
  function drawLwLine(recordDxf, entity, group, key, configParams) {
483
- let color=entity.color;
484
- let rgb=decimalToRGBHex(color);
485
- console.log(rgb);
486
- let hex=rgb.hex;
470
+ let color = entity.color;
471
+ let rgb = decimalToRGBHex(color);
472
+ console.log(rgb);
473
+ let hex = rgb.hex;
474
+
475
+ if (hex == '#FFFFFF') {
476
+ hex = '#000';
477
+ }
478
+ let closed = entity.shape;
479
+ let list = [];
480
+ for (let i = 0; i < entity.vertices.length; i++) {
481
+ list.push(entity.vertices[i].x);
482
+ list.push(-parseFloat(entity.vertices[i].y));
483
+ }
484
+ let width = 0.2;
485
+ if (entity.width) {
486
+ width = width + parseFloat(entity.width);
487
+ } else {
488
+ width = 0.2;
489
+ }
490
+ group.push({
491
+ type: 'polyline',
492
+ points: list,
493
+ closed: closed,
494
+ name: key.replace(/\s*/g, ''),
495
+ entityId: key,
496
+ stroke: hex,
497
+ customColor: configParams ? configParams.color : '',
498
+ strokeWidth: width,
499
+ visible: configParams ? configParams.visible : true,
500
+ oldstrokeLength: width,
501
+ });
502
+ // let line = new Konva.Line({
503
+ // name: key.replace(/\s*/g, ""),
504
+ // entityId: key,
505
+ // isGroup: false,
506
+ // points: list,
507
+ // stroke: configParams ? configParams.color : "#000",
508
+ // customColor: configParams ? configParams.color : "",
509
+ // strokeWidth: width,
510
+ // visible: configParams ? configParams.visible : true,
511
+ // closed:closed,
512
+ // oldstrokeLength:width,
513
+ // handle:entity.handle
514
+
515
+ // });
516
+ // group.add(line);
517
+ }
518
+ function drawSpline(recordDxf, entity, group, key, configParams) {
519
+ let points = getBSplinePolyline(
520
+ entity.controlPoints,
521
+ entity.degreeOfSplineCurve,
522
+ entity.knotValues,
523
+ 100
524
+ );
525
+ let list = [];
526
+ for (let i = 0; i < points.length; i++) {
527
+ list.push(points[i].x);
528
+ list.push(-parseFloat(points[i].y));
529
+ }
530
+ let width = 0.1;
531
+ group.push({
532
+ type: 'polyline',
533
+ points: list,
534
+ name: key.replace(/\s*/g, ''),
535
+ entityId: key,
536
+ isGroup: false,
537
+ stroke: configParams ? configParams : '#000',
538
+ customColor: configParams ? configParams.color : '',
539
+ strokeWidth: width,
540
+ visible: configParams ? configParams.visible : true,
541
+ oldstrokeLength: width,
542
+ });
543
+ // let line = new Konva.Line({
544
+ // name: key.replace(/\s*/g, ""),
545
+ // entityId: key,
546
+ // isGroup: false,
547
+ // points: list,
548
+ // stroke: configParams ? configParams : "#000",
549
+ // customColor: configParams ? configParams.color : "",
550
+ // strokeWidth: width,
551
+ // lineCap: "round",
552
+ // lineJoin: "round",
553
+ // visible: configParams ? configParams.visible : true,
554
+ // oldstrokeLength:width
555
+ // });
556
+ // group.add(line);
557
+ }
558
+ function drawInsert(recordDxf, entities, group, key, configParams, konvaLayer) {
559
+ if (recordDxf.blocks[entities.name]) {
560
+ let group2 = new Konva.Group({
561
+ x: 0,
562
+ y: 0,
563
+ name: key.replace(/\s*/g, ''),
564
+ isBlock: true,
565
+ blockName: entities.name,
566
+ entityId: key,
567
+ isGroup: true,
568
+ visible: true,
569
+ });
570
+ let entity = entities;
571
+ let block = recordDxf.blocks[entities.name];
572
+ if (entity.rotation) {
573
+ group2.rotation(360 - entity.rotation);
574
+ }
487
575
 
488
- if(hex=='#FFFFFF'){
489
- hex='#000';
576
+ if (entity.xScale) {
577
+ group2.scale({ x: entity.xScale, y: entity.yScale });
490
578
  }
491
- let closed = entity.shape;
492
- let list=[];
493
- for(let i =0;i<entity.vertices.length;i++){
494
- list.push(entity.vertices[i].x);
495
- list.push(-parseFloat(entity.vertices[i].y));
579
+ if (entity.yScale) {
580
+ group2.scale({ x: entity.xScale, y: entity.yScale });
496
581
  }
497
- let width = 0.2;
498
- if(entity.width){
499
- width=width+parseFloat(entity.width);
500
- }else{
501
- width=0.2;
582
+ if (entity.position) {
583
+ group2.attrs.x = parseFloat(entity.position.x);
584
+ group2.attrs.y = -parseFloat(entity.position.y);
502
585
  }
503
- group.push({
504
- type:"polyline",
505
- points:list,
506
- closed:closed,
507
- name: key.replace(/\s*/g, ""),
508
- entityId: key,
509
- stroke: hex,
510
- customColor: configParams ? configParams.color : "",
511
- strokeWidth: width,
512
- visible: configParams ? configParams.visible : true,
513
- oldstrokeLength:width,
514
- })
515
- // let line = new Konva.Line({
516
- // name: key.replace(/\s*/g, ""),
517
- // entityId: key,
518
- // isGroup: false,
519
- // points: list,
520
- // stroke: configParams ? configParams.color : "#000",
521
- // customColor: configParams ? configParams.color : "",
522
- // strokeWidth: width,
523
- // visible: configParams ? configParams.visible : true,
524
- // closed:closed,
525
- // oldstrokeLength:width,
526
- // handle:entity.handle
527
-
528
- // });
529
- // group.add(line);
530
- }
531
- function drawSpline(recordDxf, entity, group, key, configParams) {
532
- let points = getBSplinePolyline(
533
- entity.controlPoints,
534
- entity.degreeOfSplineCurve,
535
- entity.knotValues,
536
- 100
537
- );
538
- let list = [];
539
- for (let i = 0; i < points.length; i++) {
540
- list.push(points[i].x);
541
- list.push(-parseFloat(points[i].y));
586
+ if (entity.position.x < 0) {
587
+ group2.attrs.x = parseFloat(entity.position.x) * -1;
588
+ if (entity.xScale < 0) {
589
+ group2.scale({ x: Math.abs(entity.xScale), y: entity.yScale });
590
+ }
542
591
  }
543
- let width = 0.1;
544
- group.push({
545
- type:'polyline',
546
- points: list,
547
- name: key.replace(/\s*/g, ""),
548
- entityId: key,
549
- isGroup: false,
550
- stroke: configParams ? configParams : "#000",
551
- customColor: configParams ? configParams.color : "",
552
- strokeWidth: width,
553
- visible: configParams ? configParams.visible : true,
554
- oldstrokeLength: width
555
- });
556
- // let line = new Konva.Line({
557
- // name: key.replace(/\s*/g, ""),
558
- // entityId: key,
559
- // isGroup: false,
560
- // points: list,
561
- // stroke: configParams ? configParams : "#000",
562
- // customColor: configParams ? configParams.color : "",
563
- // strokeWidth: width,
564
- // lineCap: "round",
565
- // lineJoin: "round",
566
- // visible: configParams ? configParams.visible : true,
567
- // oldstrokeLength:width
568
- // });
569
- // group.add(line);
570
- }
571
- function drawInsert(recordDxf, entities, group, key, configParams, konvaLayer) {
572
- if (recordDxf.blocks[entities.name]) {
573
- let group2 = new Konva.Group({
574
- x: 0,
575
- y: 0,
576
- name: key.replace(/\s*/g, ""),
577
- isBlock: true,
578
- blockName: entities.name,
579
- entityId: key,
580
- isGroup: true,
581
- visible: true,
582
- });
583
- let entity = entities;
584
- let block = recordDxf.blocks[entities.name];
585
- if (entity.rotation) {
586
- group2.rotation(360-entity.rotation);
587
- }
588
-
589
- if (entity.xScale) {
590
- group2.scale({ x: entity.xScale, y: entity.yScale });
591
- }
592
- if (entity.yScale) {
593
- group2.scale({ x: entity.xScale, y: entity.yScale });
594
- }
595
- if (entity.position) {
596
- group2.attrs.x = parseFloat(entity.position.x);
597
- group2.attrs.y = -parseFloat(entity.position.y);
598
- }
599
- if(entity.position.x<0){
600
- group2.attrs.x = parseFloat(entity.position.x)*-1;
601
- if(entity.xScale<0){
602
- group2.scale({ x: Math.abs(entity.xScale), y: entity.yScale });
603
- }
604
- }
605
- if(block.entities==undefined){
606
- return ;
607
- }
608
- for (let j = 0; j < block.entities.length; j++) {
609
- let type = block.entities[j].type;
610
- handleFn(type, recordDxf, block.entities[j], group2, key, configParams, konvaLayer)
611
- }
612
- group.add(group2)
613
- // 区分块 因为有的块里面包含块 不区分会对点击定位有影响
614
- group.attrs.isMix = true
615
- konvaLayer.add(group)
592
+ if (block.entities == undefined) {
593
+ return;
594
+ }
595
+ for (let j = 0; j < block.entities.length; j++) {
596
+ let type = block.entities[j].type;
597
+ handleFn(type, recordDxf, block.entities[j], group2, key, configParams, konvaLayer);
616
598
  }
599
+ group.add(group2);
600
+ // 区分块 因为有的块里面包含块 不区分会对点击定位有影响
601
+ group.attrs.isMix = true;
602
+ konvaLayer.add(group);
603
+ }
617
604
  }
618
605
 
619
- let color= [
620
- '0,0,0',//1
621
- '255,0,0',//2
622
- '255,255,0',//3
623
- '0,255,0',//4
624
- '0,255,255',//5
625
- '0,0,255',//6
626
- '255,0,255',//7
627
- '255,255,255',//8
628
- '128,128,128',//9
629
- '192,192,192',//10
630
- '255,0,0',//11
631
- '255,120,112',//12
632
- '192,0,0',//13
633
- '207,103,96',//14
634
- '144,0,0',//15
635
- '144,72,79',//16
636
- '127,0,0',//17
637
- '112,56,48',//18
638
- '79,0,0',//19
639
- '79,39,32',//20
640
- '255,56,0',//21
641
- '255,159,127',//22
642
- '192,48,0',//23
643
- '207,127,96',//24
644
- '144,32,0',//25
645
- '144,88,64',// 26
646
- '112,24,0',//27
647
- '127,72,63',//28
648
- '79,16,0',//29
649
- '64,40,31',//30
650
- '255,127,0',//31
651
- '255,191,127',//32
652
- '207,103,0',//33
653
- '192,151,96',//34
654
- '159,72,0',//35
655
- '144,112,79',//36
656
- '127,63,0',//37
657
- '127,95,63',//38
658
- '64,32,0',//39
659
- '64,55,31',//40
660
- '255,191,0',// 41
661
- '255,216,127',//42
662
- '207,152,0',//43
663
- '192,175,96',//44
664
- '144,112,0',//45
665
- '144,128,64',//46
666
- '112,88,0',//47
667
- '127,111,63',//48
668
- '64,55,0',//49
669
- '64,63,31',//50
670
- '255,255,0',//51
671
- '255,255,112',//52
672
- '207,200,0',//53
673
- '192,200,96',//54
674
- '144,151,0',//55
675
- '144,151,64',//56
676
- '144,152,0',//57
677
- '127,120,63',//58
678
- '79,72,0',//59
679
- '79,72,32',//60
680
- '191,255,0',//61
681
- '208,255,112',//62
682
- '144,200,0',//63
683
- '176,200,96',//64
684
- '111,151,0',//65
685
- '128,151,79',//66
686
- '95,127,0',//67
687
- '111,127,63',//68
688
- '48,72,0',//69
689
- '63,72,31',//70
690
- '127,255,0',//71
691
- '191,255,127',//72
692
- '95,200,0',//73
693
- '159,200,96',//74
694
- '64,151,0',//75
695
- '111,151,64',//76
696
- '63,120,0',//77
697
- '95,127,63',//78
698
- '31,72,0',//79
699
- '48,72,32',//80
700
- '63,255,0',//81
701
- '159,255,127',//82
702
- '47,200,0',//83
703
- '127,200,96',//84
704
- '31,151,0',//85
705
- '80,151,64',//86
706
- '31,127,0',//87
707
- '79,127,63',//88
708
- '15,72,0',//89
709
- '47,72,32',//90
710
- '0,255,0',//91
711
- '127,255,127',//92
712
- '0,200,0',//93
713
- '95,200,95',//94
714
- '0,151,0',//95
715
- '79,151,79',//96
716
- '0,127,0',//97
717
- '63,127,63',//98
718
- '0,72,0',//99
719
- '32,72,32',//100
720
- '0,255,63',//101
721
- '127,255,159',//102
722
- '0,200,47',//103
723
- '95,200,112',//104
724
- '0,151,32',//105
725
- '64,151,95',//106
726
- '0,120,31',//107
727
- '63,127,79',//108
728
- '0,72,15',//109
729
- '32,72,47',//110
730
- '0,255,127',//111
731
- '127,255,191',//112
732
- '0,200,96',//113
733
- '95,200,144',//114
734
- '0,151,64',//115
735
- '79,151,111',//116
736
- '0,127,63',//117
737
- '63,127,95',//118
738
- '0,72,32',//119
739
- '31,72,48',//120
740
- '0,255,191',//121
741
- '127,255,223',//122
742
- '0,200,144',//123
743
- '95,200,175',//124
744
- '0,151,111',//125
745
- '79,151,128',//126
746
- '0,120,95',//127
747
- '63,127,111',//128
748
- '0,72,48',//129
749
- '32,72,63',//130
750
- '0,255,255',//131
751
- '127,255,255',//132
752
- '0,200,207',//133
753
- '96,200,207',//134
754
- '0,151,144',//135
755
- '64,151,144',//136
756
- '0,127,127',//137
757
- '63,127,127',//138
758
- '0,72,79',//139
759
- '32,72,79',//140
760
- '0,191,255',//141
761
- '127,223,255',//142
762
- '0,152,207',//143
763
- '96,176,207',//144
764
- '0,111,144',//145
765
- '64,128,144',//146
766
- '0,95,127',//147
767
- '63,111,127',//148
768
- '0,55,64',//149
769
- '31,63,64',//150
770
- '0,127,255',//151
771
- '112,184,255',//152
772
- '0,96,192',//153
773
- '96,151,207',//154
774
- '0,72,159',//155
775
- '79,112,144',//156
776
- '0,63,127',//157
777
- '63,95,127',//158
778
- '0,39,79',//159
779
- '32,56,79',//160
780
- '0,63,255',//161
781
- '127,159,255',//162
782
- '0,48,207',//163
783
- '96,127,207',//164
784
- '0,39,159',//165
785
- '64,95,144',//166
786
- '0,24,127',//167
787
- '63,79,127',//168
788
- '0,15,64',//169
789
- '32,47,79',//170
790
- '0,0,255',//171
791
- '127,127,255',//172
792
- '0,0,207',//173
793
- '95,96,192',//174
794
- '0,0,144',//175
795
- '79,72,159',//176
796
- '0,0,127',//177
797
- '63,63,127',//178
798
- '0,0,64',//179
799
- '32,39,79',//180
800
- '63,0,255',//181
801
- '159,127,255',//182
802
- '47,0,192',//183
803
- '127,103,207',//184
804
- '32,0,144',//185
805
- '80,72,144',//186
806
- '31,0,127',//187
807
- '79,63,127',//188
808
- '15,0,79',//189
809
- '47,39,79',//190
810
- '127,0,255',//191
811
- '191,127,255',//192
812
- '96,0,207',//193
813
- '144,103,207',//194
814
- '79,0,144',//195
815
- '111,72,144',//196
816
- '63,0,127',//197
817
- '95,63,127',//198
818
- '31,0,64',//199
819
- '48,39,79',//200
820
- '191,0,255',//201
821
- '223,127,255',//202
822
- '144,0,207',//203
823
- '175,96,192',//204
824
- '111,0,144',//205
825
- '128,72,159',//206
826
- '95,0,127',//207
827
- '96,56,112',//208
828
- '48,0,64',//209
829
- '64,39,79',//210
830
- '255,0,255',//211
831
- '255,127,255',//212
832
- '192,0,192',//213
833
- '192,96,192',//214
834
- '144,0,144',//215
835
- '144,72,144',//216
836
- '127,0,127',//217
837
- '127,63,127',//218
838
- '79,0,79',//219
839
- '64,32,64',//220
840
- '255,0,191',//221
841
- '255,127,223',//222
842
- '192,0,144',//223
843
- '192,96,175',//224
844
- '144,0,111',//225
845
- '144,72,128',//226
846
- '127,0,95',//227
847
- '127,56,111',//228
848
- '64,0,48',//229
849
- '79,39,63',//230
850
- '255,0,127',//231
851
- '255,127,191',//232
852
- '192,0,95',//233
853
- '192,96,144',//234
854
- '159,0,79',//235
855
- '144,72,111',//236
856
- '127,0,63',//237
857
- '127,63,95',//238
858
- '64,0,31',//239
859
- '64,32,48',//240
860
- '255,0,63',//241
861
- '255,127,159',//242
862
- '207,0,48',//243
863
- '207,103,127',//244
864
- '144,0,32',//245
865
- '144,72,95',//246
866
- '127,0,31',//247
867
- '127,63,79',//248
868
- '79,0,15',//249
869
- '64,32,47',//250
870
- '47,47,47',//251
871
- '80,88,80',//252
872
- '128,128,128',//253
873
- '175,175,175',//254
874
- '208,215,208',//255
875
- '255,255,255'//256
606
+ let color = [
607
+ '0,0,0', //1
608
+ '255,0,0', //2
609
+ '255,255,0', //3
610
+ '0,255,0', //4
611
+ '0,255,255', //5
612
+ '0,0,255', //6
613
+ '255,0,255', //7
614
+ '255,255,255', //8
615
+ '128,128,128', //9
616
+ '192,192,192', //10
617
+ '255,0,0', //11
618
+ '255,120,112', //12
619
+ '192,0,0', //13
620
+ '207,103,96', //14
621
+ '144,0,0', //15
622
+ '144,72,79', //16
623
+ '127,0,0', //17
624
+ '112,56,48', //18
625
+ '79,0,0', //19
626
+ '79,39,32', //20
627
+ '255,56,0', //21
628
+ '255,159,127', //22
629
+ '192,48,0', //23
630
+ '207,127,96', //24
631
+ '144,32,0', //25
632
+ '144,88,64', // 26
633
+ '112,24,0', //27
634
+ '127,72,63', //28
635
+ '79,16,0', //29
636
+ '64,40,31', //30
637
+ '255,127,0', //31
638
+ '255,191,127', //32
639
+ '207,103,0', //33
640
+ '192,151,96', //34
641
+ '159,72,0', //35
642
+ '144,112,79', //36
643
+ '127,63,0', //37
644
+ '127,95,63', //38
645
+ '64,32,0', //39
646
+ '64,55,31', //40
647
+ '255,191,0', // 41
648
+ '255,216,127', //42
649
+ '207,152,0', //43
650
+ '192,175,96', //44
651
+ '144,112,0', //45
652
+ '144,128,64', //46
653
+ '112,88,0', //47
654
+ '127,111,63', //48
655
+ '64,55,0', //49
656
+ '64,63,31', //50
657
+ '255,255,0', //51
658
+ '255,255,112', //52
659
+ '207,200,0', //53
660
+ '192,200,96', //54
661
+ '144,151,0', //55
662
+ '144,151,64', //56
663
+ '144,152,0', //57
664
+ '127,120,63', //58
665
+ '79,72,0', //59
666
+ '79,72,32', //60
667
+ '191,255,0', //61
668
+ '208,255,112', //62
669
+ '144,200,0', //63
670
+ '176,200,96', //64
671
+ '111,151,0', //65
672
+ '128,151,79', //66
673
+ '95,127,0', //67
674
+ '111,127,63', //68
675
+ '48,72,0', //69
676
+ '63,72,31', //70
677
+ '127,255,0', //71
678
+ '191,255,127', //72
679
+ '95,200,0', //73
680
+ '159,200,96', //74
681
+ '64,151,0', //75
682
+ '111,151,64', //76
683
+ '63,120,0', //77
684
+ '95,127,63', //78
685
+ '31,72,0', //79
686
+ '48,72,32', //80
687
+ '63,255,0', //81
688
+ '159,255,127', //82
689
+ '47,200,0', //83
690
+ '127,200,96', //84
691
+ '31,151,0', //85
692
+ '80,151,64', //86
693
+ '31,127,0', //87
694
+ '79,127,63', //88
695
+ '15,72,0', //89
696
+ '47,72,32', //90
697
+ '0,255,0', //91
698
+ '127,255,127', //92
699
+ '0,200,0', //93
700
+ '95,200,95', //94
701
+ '0,151,0', //95
702
+ '79,151,79', //96
703
+ '0,127,0', //97
704
+ '63,127,63', //98
705
+ '0,72,0', //99
706
+ '32,72,32', //100
707
+ '0,255,63', //101
708
+ '127,255,159', //102
709
+ '0,200,47', //103
710
+ '95,200,112', //104
711
+ '0,151,32', //105
712
+ '64,151,95', //106
713
+ '0,120,31', //107
714
+ '63,127,79', //108
715
+ '0,72,15', //109
716
+ '32,72,47', //110
717
+ '0,255,127', //111
718
+ '127,255,191', //112
719
+ '0,200,96', //113
720
+ '95,200,144', //114
721
+ '0,151,64', //115
722
+ '79,151,111', //116
723
+ '0,127,63', //117
724
+ '63,127,95', //118
725
+ '0,72,32', //119
726
+ '31,72,48', //120
727
+ '0,255,191', //121
728
+ '127,255,223', //122
729
+ '0,200,144', //123
730
+ '95,200,175', //124
731
+ '0,151,111', //125
732
+ '79,151,128', //126
733
+ '0,120,95', //127
734
+ '63,127,111', //128
735
+ '0,72,48', //129
736
+ '32,72,63', //130
737
+ '0,255,255', //131
738
+ '127,255,255', //132
739
+ '0,200,207', //133
740
+ '96,200,207', //134
741
+ '0,151,144', //135
742
+ '64,151,144', //136
743
+ '0,127,127', //137
744
+ '63,127,127', //138
745
+ '0,72,79', //139
746
+ '32,72,79', //140
747
+ '0,191,255', //141
748
+ '127,223,255', //142
749
+ '0,152,207', //143
750
+ '96,176,207', //144
751
+ '0,111,144', //145
752
+ '64,128,144', //146
753
+ '0,95,127', //147
754
+ '63,111,127', //148
755
+ '0,55,64', //149
756
+ '31,63,64', //150
757
+ '0,127,255', //151
758
+ '112,184,255', //152
759
+ '0,96,192', //153
760
+ '96,151,207', //154
761
+ '0,72,159', //155
762
+ '79,112,144', //156
763
+ '0,63,127', //157
764
+ '63,95,127', //158
765
+ '0,39,79', //159
766
+ '32,56,79', //160
767
+ '0,63,255', //161
768
+ '127,159,255', //162
769
+ '0,48,207', //163
770
+ '96,127,207', //164
771
+ '0,39,159', //165
772
+ '64,95,144', //166
773
+ '0,24,127', //167
774
+ '63,79,127', //168
775
+ '0,15,64', //169
776
+ '32,47,79', //170
777
+ '0,0,255', //171
778
+ '127,127,255', //172
779
+ '0,0,207', //173
780
+ '95,96,192', //174
781
+ '0,0,144', //175
782
+ '79,72,159', //176
783
+ '0,0,127', //177
784
+ '63,63,127', //178
785
+ '0,0,64', //179
786
+ '32,39,79', //180
787
+ '63,0,255', //181
788
+ '159,127,255', //182
789
+ '47,0,192', //183
790
+ '127,103,207', //184
791
+ '32,0,144', //185
792
+ '80,72,144', //186
793
+ '31,0,127', //187
794
+ '79,63,127', //188
795
+ '15,0,79', //189
796
+ '47,39,79', //190
797
+ '127,0,255', //191
798
+ '191,127,255', //192
799
+ '96,0,207', //193
800
+ '144,103,207', //194
801
+ '79,0,144', //195
802
+ '111,72,144', //196
803
+ '63,0,127', //197
804
+ '95,63,127', //198
805
+ '31,0,64', //199
806
+ '48,39,79', //200
807
+ '191,0,255', //201
808
+ '223,127,255', //202
809
+ '144,0,207', //203
810
+ '175,96,192', //204
811
+ '111,0,144', //205
812
+ '128,72,159', //206
813
+ '95,0,127', //207
814
+ '96,56,112', //208
815
+ '48,0,64', //209
816
+ '64,39,79', //210
817
+ '255,0,255', //211
818
+ '255,127,255', //212
819
+ '192,0,192', //213
820
+ '192,96,192', //214
821
+ '144,0,144', //215
822
+ '144,72,144', //216
823
+ '127,0,127', //217
824
+ '127,63,127', //218
825
+ '79,0,79', //219
826
+ '64,32,64', //220
827
+ '255,0,191', //221
828
+ '255,127,223', //222
829
+ '192,0,144', //223
830
+ '192,96,175', //224
831
+ '144,0,111', //225
832
+ '144,72,128', //226
833
+ '127,0,95', //227
834
+ '127,56,111', //228
835
+ '64,0,48', //229
836
+ '79,39,63', //230
837
+ '255,0,127', //231
838
+ '255,127,191', //232
839
+ '192,0,95', //233
840
+ '192,96,144', //234
841
+ '159,0,79', //235
842
+ '144,72,111', //236
843
+ '127,0,63', //237
844
+ '127,63,95', //238
845
+ '64,0,31', //239
846
+ '64,32,48', //240
847
+ '255,0,63', //241
848
+ '255,127,159', //242
849
+ '207,0,48', //243
850
+ '207,103,127', //244
851
+ '144,0,32', //245
852
+ '144,72,95', //246
853
+ '127,0,31', //247
854
+ '127,63,79', //248
855
+ '79,0,15', //249
856
+ '64,32,47', //250
857
+ '47,47,47', //251
858
+ '80,88,80', //252
859
+ '128,128,128', //253
860
+ '175,175,175', //254
861
+ '208,215,208', //255
862
+ '255,255,255', //256
876
863
  ];