@equinor/esv-intersection 4.0.0 → 4.1.1
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/components/axis.d.ts.map +1 -1
- package/dist/control/ExtendedCurveInterpolator.d.ts.map +1 -1
- package/dist/control/IntersectionReferenceSystem.d.ts.map +1 -1
- package/dist/control/LayerManager.d.ts.map +1 -1
- package/dist/control/MainController.d.ts.map +1 -1
- package/dist/control/ZoomPanHandler.d.ts.map +1 -1
- package/dist/control/overlay.d.ts.map +1 -1
- package/dist/datautils/colortable.d.ts.map +1 -1
- package/dist/datautils/findsample.d.ts.map +1 -1
- package/dist/datautils/picks.d.ts.map +1 -1
- package/dist/datautils/schematicShapeGenerator.d.ts +5 -5
- package/dist/datautils/schematicShapeGenerator.d.ts.map +1 -1
- package/dist/datautils/seismicimage.d.ts.map +1 -1
- package/dist/datautils/surfacedata.d.ts.map +1 -1
- package/dist/datautils/trajectory.d.ts.map +1 -1
- package/dist/index.cjs +1 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2168 -1290
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1 -14
- package/dist/index.umd.js.map +1 -1
- package/dist/layers/CalloutCanvasLayer.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/ComplexRope.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/UniformTextureStretchRope.d.ts.map +1 -1
- package/dist/layers/GeomodelCanvasLayer.d.ts.map +1 -1
- package/dist/layers/GeomodelLabelsLayer.d.ts.map +1 -1
- package/dist/layers/GeomodelLayerV2.d.ts.map +1 -1
- package/dist/layers/GridLayer.d.ts.map +1 -1
- package/dist/layers/ImageCanvasLayer.d.ts.map +1 -1
- package/dist/layers/ReferenceLineLayer.d.ts.map +1 -1
- package/dist/layers/SchematicLayer.d.ts.map +1 -1
- package/dist/layers/WellborePathLayer.d.ts.map +1 -1
- package/dist/layers/base/CanvasLayer.d.ts.map +1 -1
- package/dist/layers/base/HTMLLayer.d.ts.map +1 -1
- package/dist/layers/base/Layer.d.ts.map +1 -1
- package/dist/layers/base/PixiLayer.d.ts.map +1 -1
- package/dist/layers/base/SVGLayer.d.ts.map +1 -1
- package/dist/layers/schematicInterfaces.d.ts.map +1 -1
- package/dist/utils/arc-length.d.ts.map +1 -1
- package/dist/utils/root-finder.d.ts.map +1 -1
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/vectorUtils.d.ts.map +1 -1
- package/dist/vendor/pixi-dashed-line/index.d.ts.map +1 -1
- package/package.json +15 -17
- package/src/components/axis.ts +40 -10
- package/src/control/ExtendedCurveInterpolator.ts +47 -9
- package/src/control/IntersectionReferenceSystem.ts +110 -30
- package/src/control/LayerManager.ts +76 -24
- package/src/control/MainController.ts +37 -8
- package/src/control/ZoomPanHandler.ts +76 -14
- package/src/control/overlay.ts +18 -6
- package/src/datautils/colortable.ts +7 -2
- package/src/datautils/findsample.ts +12 -2
- package/src/datautils/picks.ts +66 -18
- package/src/datautils/schematicShapeGenerator.ts +570 -146
- package/src/datautils/seismicimage.ts +36 -10
- package/src/datautils/surfacedata.ts +119 -40
- package/src/datautils/trajectory.ts +56 -17
- package/src/layers/CalloutCanvasLayer.ts +129 -26
- package/src/layers/CustomDisplayObjects/ComplexRope.ts +2 -1
- package/src/layers/CustomDisplayObjects/ComplexRopeGeometry.ts +5 -5
- package/src/layers/CustomDisplayObjects/UniformTextureStretchRope.ts +6 -2
- package/src/layers/GeomodelCanvasLayer.ts +10 -3
- package/src/layers/GeomodelLabelsLayer.ts +212 -87
- package/src/layers/GeomodelLayerV2.ts +8 -3
- package/src/layers/GridLayer.ts +14 -3
- package/src/layers/ImageCanvasLayer.ts +17 -3
- package/src/layers/ReferenceLineLayer.ts +31 -9
- package/src/layers/SchematicLayer.ts +499 -150
- package/src/layers/WellborePathLayer.ts +22 -7
- package/src/layers/base/CanvasLayer.ts +18 -4
- package/src/layers/base/HTMLLayer.ts +11 -3
- package/src/layers/base/Layer.ts +10 -2
- package/src/layers/base/PixiLayer.ts +27 -7
- package/src/layers/base/SVGLayer.ts +13 -3
- package/src/layers/schematicInterfaces.ts +16 -6
- package/src/utils/arc-length.ts +31 -5
- package/src/utils/root-finder.ts +32 -4
- package/src/utils/text.ts +34 -7
- package/src/utils/vectorUtils.ts +23 -6
- package/src/vendor/pixi-dashed-line/index.ts +66 -13
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { ScaleLinear } from 'd3-scale';
|
|
2
2
|
|
|
3
3
|
import { CanvasLayer } from './base/CanvasLayer';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
OnUpdateEvent,
|
|
6
|
+
Annotation,
|
|
7
|
+
OnRescaleEvent,
|
|
8
|
+
BoundingBox,
|
|
9
|
+
} from '../interfaces';
|
|
5
10
|
import { calcSize, isOverlapping, getOverlapOffset } from '../utils';
|
|
6
11
|
import { LayerOptions } from './base/Layer';
|
|
7
12
|
|
|
@@ -46,7 +51,9 @@ export type Callout = {
|
|
|
46
51
|
dy: number;
|
|
47
52
|
};
|
|
48
53
|
|
|
49
|
-
export interface CalloutOptions<
|
|
54
|
+
export interface CalloutOptions<
|
|
55
|
+
T extends Annotation[],
|
|
56
|
+
> extends LayerOptions<T> {
|
|
50
57
|
minFontSize?: number;
|
|
51
58
|
maxFontSize?: number;
|
|
52
59
|
fontSizeFactor?: number;
|
|
@@ -98,8 +105,12 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
98
105
|
this.backgroundColor = DEFAULT_BACKGROUND_COLOR;
|
|
99
106
|
}
|
|
100
107
|
|
|
101
|
-
this.backgroundPadding =
|
|
102
|
-
|
|
108
|
+
this.backgroundPadding =
|
|
109
|
+
options?.backgroundPadding || DEFAULT_BACKGROUND_PADDING;
|
|
110
|
+
this.backgroundBorderRadius = getValueOrDefault(
|
|
111
|
+
options?.backgroundBorderRadius,
|
|
112
|
+
DEFAULT_BACKGROUND_BORDER_RADIUS,
|
|
113
|
+
);
|
|
103
114
|
}
|
|
104
115
|
|
|
105
116
|
setGroupFilter(filter: string[]): void {
|
|
@@ -116,7 +127,8 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
116
127
|
|
|
117
128
|
override onRescale(event: OnRescaleEvent): void {
|
|
118
129
|
super.onRescale(event);
|
|
119
|
-
const isPanning =
|
|
130
|
+
const isPanning =
|
|
131
|
+
this.rescaleEvent && this.rescaleEvent.xRatio === event.xRatio;
|
|
120
132
|
this.rescaleEvent = event;
|
|
121
133
|
|
|
122
134
|
this.render(isPanning);
|
|
@@ -132,21 +144,45 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
132
144
|
|
|
133
145
|
const { xScale, yScale, xBounds } = this.rescaleEvent;
|
|
134
146
|
|
|
135
|
-
const fontSize = calcSize(
|
|
147
|
+
const fontSize = calcSize(
|
|
148
|
+
this.fontSizeFactor,
|
|
149
|
+
this.minFontSize,
|
|
150
|
+
this.maxFontSize,
|
|
151
|
+
xScale,
|
|
152
|
+
);
|
|
136
153
|
|
|
137
154
|
if (!isPanning || this.callouts.length <= 0) {
|
|
138
155
|
const { data, ctx, groupFilter } = this;
|
|
139
|
-
const { calculateDisplacementFromBottom } =
|
|
140
|
-
|
|
156
|
+
const { calculateDisplacementFromBottom } =
|
|
157
|
+
this.referenceSystem.options;
|
|
158
|
+
const isLeftToRight = calculateDisplacementFromBottom
|
|
159
|
+
? xBounds[0] < xBounds[1]
|
|
160
|
+
: xBounds[0] > xBounds[1];
|
|
141
161
|
const scale = 0;
|
|
142
162
|
|
|
143
163
|
ctx != null && (ctx.font = `bold ${fontSize}px arial`);
|
|
144
|
-
const filtered = data.filter(
|
|
145
|
-
|
|
146
|
-
|
|
164
|
+
const filtered = data.filter(
|
|
165
|
+
(d: Annotation) =>
|
|
166
|
+
groupFilter.length <= 0 || groupFilter.includes(d.group),
|
|
167
|
+
);
|
|
168
|
+
const offset = calcSize(
|
|
169
|
+
this.offsetFactor,
|
|
170
|
+
this.offsetMin,
|
|
171
|
+
this.offsetMax,
|
|
172
|
+
xScale,
|
|
173
|
+
);
|
|
174
|
+
this.callouts = this.positionCallouts(
|
|
175
|
+
filtered,
|
|
176
|
+
isLeftToRight,
|
|
177
|
+
xScale,
|
|
178
|
+
yScale,
|
|
179
|
+
scale,
|
|
180
|
+
fontSize,
|
|
181
|
+
offset,
|
|
182
|
+
);
|
|
147
183
|
}
|
|
148
184
|
|
|
149
|
-
this.callouts.forEach(
|
|
185
|
+
this.callouts.forEach(callout => {
|
|
150
186
|
const { pos, title, color } = callout;
|
|
151
187
|
const x = xScale(pos.x);
|
|
152
188
|
const y = yScale(pos.y);
|
|
@@ -160,12 +196,24 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
160
196
|
offsetY: callout.dy,
|
|
161
197
|
};
|
|
162
198
|
|
|
163
|
-
this.renderCallout(
|
|
199
|
+
this.renderCallout(
|
|
200
|
+
title,
|
|
201
|
+
callout.label,
|
|
202
|
+
calloutBB,
|
|
203
|
+
color,
|
|
204
|
+
callout.alignment,
|
|
205
|
+
);
|
|
164
206
|
});
|
|
165
207
|
});
|
|
166
208
|
}
|
|
167
209
|
|
|
168
|
-
private renderBackground(
|
|
210
|
+
private renderBackground(
|
|
211
|
+
title: string,
|
|
212
|
+
label: string,
|
|
213
|
+
x: number,
|
|
214
|
+
y: number,
|
|
215
|
+
fontSize: number,
|
|
216
|
+
): void {
|
|
169
217
|
const { ctx } = this;
|
|
170
218
|
|
|
171
219
|
if (ctx == null) {
|
|
@@ -209,12 +257,27 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
209
257
|
}
|
|
210
258
|
}
|
|
211
259
|
|
|
212
|
-
private renderAnnotation = (
|
|
260
|
+
private renderAnnotation = (
|
|
261
|
+
title: string,
|
|
262
|
+
label: string,
|
|
263
|
+
x: number,
|
|
264
|
+
y: number,
|
|
265
|
+
fontSize: number,
|
|
266
|
+
color: string,
|
|
267
|
+
): void => {
|
|
213
268
|
this.renderText(title, x, y - fontSize, fontSize, color, 'arial', 'bold');
|
|
214
269
|
this.renderText(label, x, y, fontSize, color);
|
|
215
270
|
};
|
|
216
271
|
|
|
217
|
-
private renderText(
|
|
272
|
+
private renderText(
|
|
273
|
+
title: string,
|
|
274
|
+
x: number,
|
|
275
|
+
y: number,
|
|
276
|
+
fontSize: number,
|
|
277
|
+
color: string,
|
|
278
|
+
font = 'arial',
|
|
279
|
+
fontStyle = 'normal',
|
|
280
|
+
): void {
|
|
218
281
|
const { ctx } = this;
|
|
219
282
|
if (ctx != null) {
|
|
220
283
|
ctx.font = `${fontStyle} ${fontSize}px ${font}`;
|
|
@@ -223,7 +286,12 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
223
286
|
}
|
|
224
287
|
}
|
|
225
288
|
|
|
226
|
-
private measureTextWidth(
|
|
289
|
+
private measureTextWidth(
|
|
290
|
+
title: string,
|
|
291
|
+
fontSize: number,
|
|
292
|
+
font = 'arial',
|
|
293
|
+
fontStyle = 'normal',
|
|
294
|
+
): number {
|
|
227
295
|
const { ctx } = this;
|
|
228
296
|
|
|
229
297
|
if (ctx == null) {
|
|
@@ -246,12 +314,19 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
246
314
|
}
|
|
247
315
|
}
|
|
248
316
|
|
|
249
|
-
private renderCallout(
|
|
317
|
+
private renderCallout(
|
|
318
|
+
title: string,
|
|
319
|
+
label: string,
|
|
320
|
+
boundingBox: BoundingBox,
|
|
321
|
+
color: string,
|
|
322
|
+
location: string,
|
|
323
|
+
): void {
|
|
250
324
|
const pos = this.getPosition(boundingBox, location);
|
|
251
325
|
const { x, y } = pos;
|
|
252
326
|
const { height, width, x: dotX, y: dotY } = boundingBox;
|
|
253
327
|
|
|
254
|
-
const placeLeft =
|
|
328
|
+
const placeLeft =
|
|
329
|
+
location === Location.topright || location === Location.bottomright;
|
|
255
330
|
|
|
256
331
|
if (this.backgroundActive) {
|
|
257
332
|
this.renderBackground(title, label, x, y, height);
|
|
@@ -262,7 +337,15 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
262
337
|
this.renderLine(x, y, width, dotX, dotY, color, placeLeft);
|
|
263
338
|
}
|
|
264
339
|
|
|
265
|
-
private renderLine = (
|
|
340
|
+
private renderLine = (
|
|
341
|
+
x: number,
|
|
342
|
+
y: number,
|
|
343
|
+
width: number,
|
|
344
|
+
dotX: number,
|
|
345
|
+
dotY: number,
|
|
346
|
+
color: string,
|
|
347
|
+
placeLeft = true,
|
|
348
|
+
): void => {
|
|
266
349
|
const { ctx } = this;
|
|
267
350
|
const textX = placeLeft ? x : x + width;
|
|
268
351
|
const inverseTextX = placeLeft ? x + width : x;
|
|
@@ -327,7 +410,7 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
327
410
|
}
|
|
328
411
|
const alignment = isLeftToRight ? Location.topleft : Location.topright;
|
|
329
412
|
|
|
330
|
-
const nodes = annotations.map(
|
|
413
|
+
const nodes = annotations.map(a => {
|
|
331
414
|
const pos = a.pos ? a.pos : this.referenceSystem?.project(a.md!)!;
|
|
332
415
|
return {
|
|
333
416
|
title: a.title,
|
|
@@ -336,7 +419,14 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
336
419
|
pos: { x: pos?.[0]!, y: pos?.[1]! },
|
|
337
420
|
group: a.group,
|
|
338
421
|
alignment,
|
|
339
|
-
boundingBox: this.getAnnotationBoundingBox(
|
|
422
|
+
boundingBox: this.getAnnotationBoundingBox(
|
|
423
|
+
a.title,
|
|
424
|
+
a.label,
|
|
425
|
+
pos,
|
|
426
|
+
xScale,
|
|
427
|
+
yScale,
|
|
428
|
+
fontSize,
|
|
429
|
+
),
|
|
340
430
|
dx: offset,
|
|
341
431
|
dy: offset,
|
|
342
432
|
};
|
|
@@ -382,14 +472,21 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
382
472
|
return bbox;
|
|
383
473
|
}
|
|
384
474
|
|
|
385
|
-
chooseTopOrBottomPosition(
|
|
475
|
+
chooseTopOrBottomPosition(
|
|
476
|
+
nodes: Callout[],
|
|
477
|
+
bottom: Callout[],
|
|
478
|
+
top: Callout[],
|
|
479
|
+
): void {
|
|
386
480
|
for (let i = nodes.length - 2; i >= 0; --i) {
|
|
387
481
|
const node = nodes[i]!;
|
|
388
482
|
const prevNode = top[0]!;
|
|
389
483
|
|
|
390
484
|
const overlap = isOverlapping(node.boundingBox, prevNode.boundingBox);
|
|
391
485
|
if (overlap) {
|
|
392
|
-
node.alignment =
|
|
486
|
+
node.alignment =
|
|
487
|
+
node.alignment === Location.topleft
|
|
488
|
+
? Location.bottomright
|
|
489
|
+
: Location.bottomleft;
|
|
393
490
|
bottom.push(node);
|
|
394
491
|
if (i > 0) {
|
|
395
492
|
top.unshift(nodes[--i]!);
|
|
@@ -405,7 +502,10 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
405
502
|
const currentNode = top[i]!;
|
|
406
503
|
for (let j = top.length - 1; j > i; --j) {
|
|
407
504
|
const prevNode = top[j]!;
|
|
408
|
-
const overlap = getOverlapOffset(
|
|
505
|
+
const overlap = getOverlapOffset(
|
|
506
|
+
currentNode.boundingBox,
|
|
507
|
+
prevNode.boundingBox,
|
|
508
|
+
);
|
|
409
509
|
if (overlap) {
|
|
410
510
|
currentNode.dy += overlap.dy;
|
|
411
511
|
currentNode.boundingBox.y -= overlap.dy;
|
|
@@ -419,7 +519,10 @@ export class CalloutCanvasLayer<T extends Annotation[]> extends CanvasLayer<T> {
|
|
|
419
519
|
const currentNode = bottom[i]!;
|
|
420
520
|
for (let j = bottom.length - 1; j > i; --j) {
|
|
421
521
|
const prevNode = bottom[j]!;
|
|
422
|
-
const overlap = getOverlapOffset(
|
|
522
|
+
const overlap = getOverlapOffset(
|
|
523
|
+
prevNode.boundingBox,
|
|
524
|
+
currentNode.boundingBox,
|
|
525
|
+
);
|
|
423
526
|
if (overlap) {
|
|
424
527
|
currentNode.dy += overlap.dy;
|
|
425
528
|
currentNode.boundingBox.y += overlap.dy;
|
|
@@ -31,7 +31,8 @@ export class ComplexRope extends Mesh {
|
|
|
31
31
|
this.autoUpdate = true;
|
|
32
32
|
|
|
33
33
|
this.onRender = () => {
|
|
34
|
-
const geometry: ComplexRopeGeometry = this
|
|
34
|
+
const geometry: ComplexRopeGeometry = this
|
|
35
|
+
.geometry as ComplexRopeGeometry;
|
|
35
36
|
|
|
36
37
|
if (this.autoUpdate) {
|
|
37
38
|
geometry.update();
|
|
@@ -13,7 +13,7 @@ export class ComplexRopeGeometry extends MeshGeometry {
|
|
|
13
13
|
* @param segments - An array of segments with points and diameter to construct this rope.
|
|
14
14
|
*/
|
|
15
15
|
constructor(segments: ComplexRopeSegment[]) {
|
|
16
|
-
const pointCount = sum(segments,
|
|
16
|
+
const pointCount = sum(segments, segment => segment.points.length);
|
|
17
17
|
|
|
18
18
|
super({
|
|
19
19
|
positions: new Float32Array(pointCount * 4),
|
|
@@ -32,7 +32,7 @@ export class ComplexRopeGeometry extends MeshGeometry {
|
|
|
32
32
|
* @readonly
|
|
33
33
|
*/
|
|
34
34
|
get width(): number {
|
|
35
|
-
return max(this.segments,
|
|
35
|
+
return max(this.segments, segment => segment.diameter)!;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/** Refreshes Rope indices and uvs */
|
|
@@ -47,7 +47,7 @@ export class ComplexRopeGeometry extends MeshGeometry {
|
|
|
47
47
|
const uvBuffer = this.getBuffer('aUV');
|
|
48
48
|
const indexBuffer = this.getIndex();
|
|
49
49
|
|
|
50
|
-
const pointCount = sum(segments,
|
|
50
|
+
const pointCount = sum(segments, segment => segment.points.length);
|
|
51
51
|
|
|
52
52
|
// if too few points, or texture hasn't got UVs set yet just move on.
|
|
53
53
|
if (pointCount < 1) {
|
|
@@ -70,7 +70,7 @@ export class ComplexRopeGeometry extends MeshGeometry {
|
|
|
70
70
|
uvs[3] = 1;
|
|
71
71
|
|
|
72
72
|
const segmentCount = segments.length;
|
|
73
|
-
const maxDiameter = max(segments,
|
|
73
|
+
const maxDiameter = max(segments, segment => segment.diameter)!;
|
|
74
74
|
|
|
75
75
|
let amount = 0;
|
|
76
76
|
let uvIndex = 0;
|
|
@@ -126,7 +126,7 @@ export class ComplexRopeGeometry extends MeshGeometry {
|
|
|
126
126
|
/** refreshes vertices of Rope mesh */
|
|
127
127
|
public updateVertices(): void {
|
|
128
128
|
const segments = this.segments;
|
|
129
|
-
const pointCount = sum(segments,
|
|
129
|
+
const pointCount = sum(segments, segment => segment.points.length);
|
|
130
130
|
|
|
131
131
|
if (pointCount < 1) {
|
|
132
132
|
return;
|
|
@@ -16,14 +16,18 @@ export class UniformTextureStretchRope extends Mesh {
|
|
|
16
16
|
* @param points - An array of {@link Point} objects to construct this rope.
|
|
17
17
|
*/
|
|
18
18
|
constructor(texture: Texture, points: Point[]) {
|
|
19
|
-
const ropeGeometry = new UniformTextureStretchRopeGeometry(
|
|
19
|
+
const ropeGeometry = new UniformTextureStretchRopeGeometry(
|
|
20
|
+
points,
|
|
21
|
+
texture.height,
|
|
22
|
+
);
|
|
20
23
|
|
|
21
24
|
super({ geometry: ropeGeometry, texture });
|
|
22
25
|
|
|
23
26
|
this.autoUpdate = true;
|
|
24
27
|
|
|
25
28
|
this.onRender = () => {
|
|
26
|
-
const geometry: UniformTextureStretchRopeGeometry = this
|
|
29
|
+
const geometry: UniformTextureStretchRopeGeometry = this
|
|
30
|
+
.geometry as UniformTextureStretchRopeGeometry;
|
|
27
31
|
|
|
28
32
|
if (this.autoUpdate || geometry._width !== this.shader?.texture.height) {
|
|
29
33
|
geometry._width = this.shader?.texture.height ?? 0;
|
|
@@ -59,8 +59,12 @@ export class GeomodelCanvasLayer<T extends SurfaceData> extends CanvasLayer<T> {
|
|
|
59
59
|
|
|
60
60
|
requestAnimationFrame(() => {
|
|
61
61
|
this.clearCanvas();
|
|
62
|
-
this.surfaceAreasPaths.forEach((p: SurfacePaths) =>
|
|
63
|
-
|
|
62
|
+
this.surfaceAreasPaths.forEach((p: SurfacePaths) =>
|
|
63
|
+
this.drawPolygonPath(p.color, p.path),
|
|
64
|
+
);
|
|
65
|
+
this.surfaceLinesPaths.forEach((l: SurfacePaths) =>
|
|
66
|
+
this.drawLinePath(l.color, l.path),
|
|
67
|
+
);
|
|
64
68
|
});
|
|
65
69
|
}
|
|
66
70
|
|
|
@@ -85,7 +89,10 @@ export class GeomodelCanvasLayer<T extends SurfaceData> extends CanvasLayer<T> {
|
|
|
85
89
|
this.surfaceLinesPaths =
|
|
86
90
|
this.data?.lines.reduce((acc: SurfacePaths[], l: SurfaceLine) => {
|
|
87
91
|
const lines = this.generateLinePaths(l);
|
|
88
|
-
const mapped: SurfacePaths[] = lines.map((path: Path2D) => ({
|
|
92
|
+
const mapped: SurfacePaths[] = lines.map((path: Path2D) => ({
|
|
93
|
+
color: this.colorToCSSColor(l.color),
|
|
94
|
+
path,
|
|
95
|
+
}));
|
|
89
96
|
acc.push(...mapped);
|
|
90
97
|
return acc;
|
|
91
98
|
}, []) ?? [];
|