@inweb/viewer-visualize 25.8.10 → 25.8.12

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.
@@ -12298,7 +12298,7 @@
12298
12298
  this._ref.draggable(value);
12299
12299
  }
12300
12300
  type() {
12301
- return "line";
12301
+ return "Line";
12302
12302
  }
12303
12303
  getColor() {
12304
12304
  return this._ref.stroke();
@@ -12418,7 +12418,7 @@
12418
12418
  this._ref.draggable(value);
12419
12419
  }
12420
12420
  type() {
12421
- return "text";
12421
+ return "Text";
12422
12422
  }
12423
12423
  getColor() {
12424
12424
  return this._ref.fill();
@@ -12543,7 +12543,7 @@
12543
12543
  this._ref.draggable(value);
12544
12544
  }
12545
12545
  type() {
12546
- return "rectangle";
12546
+ return "Rectangle";
12547
12547
  }
12548
12548
  getColor() {
12549
12549
  return this._ref.stroke();
@@ -12671,7 +12671,7 @@
12671
12671
  this._ref.draggable(value);
12672
12672
  }
12673
12673
  type() {
12674
- return "ellipse";
12674
+ return "Ellipse";
12675
12675
  }
12676
12676
  getColor() {
12677
12677
  return this._ref.stroke();
@@ -12732,7 +12732,7 @@
12732
12732
  this._ref.draggable(value);
12733
12733
  }
12734
12734
  type() {
12735
- return "arrow";
12735
+ return "Arrow";
12736
12736
  }
12737
12737
  getColor() {
12738
12738
  return this._ref.stroke();
@@ -12885,7 +12885,7 @@
12885
12885
  this._ref.draggable(value);
12886
12886
  }
12887
12887
  type() {
12888
- return "image";
12888
+ return "Image";
12889
12889
  }
12890
12890
  getRotation() {
12891
12891
  return this._ref.rotation();
@@ -13036,7 +13036,7 @@
13036
13036
  this._ref.draggable(value);
13037
13037
  }
13038
13038
  type() {
13039
- return "cloud";
13039
+ return "Cloud";
13040
13040
  }
13041
13041
  getColor() {
13042
13042
  return this._ref.stroke();
@@ -13096,8 +13096,7 @@
13096
13096
  },
13097
13097
  Line: {
13098
13098
  name: "Line",
13099
- initializer: (ref, params = null) => new KonvaLine(params, ref),
13100
- zIndex: 1
13099
+ initializer: (ref, params = null) => new KonvaLine(params, ref)
13101
13100
  },
13102
13101
  Text: {
13103
13102
  name: "Text",
@@ -13105,28 +13104,23 @@
13105
13104
  },
13106
13105
  Rectangle: {
13107
13106
  name: "Rect",
13108
- initializer: (ref, params = null) => new KonvaRectangle(params, ref),
13109
- zIndex: 1
13107
+ initializer: (ref, params = null) => new KonvaRectangle(params, ref)
13110
13108
  },
13111
13109
  Ellipse: {
13112
13110
  name: "Ellipse",
13113
- initializer: (ref, params = null) => new KonvaEllipse(params, ref),
13114
- zIndex: 1
13111
+ initializer: (ref, params = null) => new KonvaEllipse(params, ref)
13115
13112
  },
13116
13113
  Arrow: {
13117
13114
  name: "Arrow",
13118
- initializer: (ref, params = null) => new KonvaArrow(params, ref),
13119
- zIndex: 1
13115
+ initializer: (ref, params = null) => new KonvaArrow(params, ref)
13120
13116
  },
13121
13117
  Image: {
13122
13118
  name: "Image",
13123
- initializer: (ref, params = null) => new KonvaImage(params, ref),
13124
- zIndex: 0
13119
+ initializer: (ref, params = null) => new KonvaImage(params, ref)
13125
13120
  },
13126
13121
  Cloud: {
13127
13122
  name: "Cloud",
13128
- initializer: (ref, params = null) => new KonvaCloud(params, ref),
13129
- zIndex: 1
13123
+ initializer: (ref, params = null) => new KonvaCloud(params, ref)
13130
13124
  }
13131
13125
  };
13132
13126
 
@@ -13135,7 +13129,6 @@
13135
13129
  this._pointerEvents = [];
13136
13130
  this._markupIsActive = false;
13137
13131
  this._markupColor = new MarkupColor(255, 0, 0);
13138
- this._zIndex = 1;
13139
13132
  this.lineWidth = 4;
13140
13133
  this.lineType = "solid";
13141
13134
  this.fontSize = 34;
@@ -13235,6 +13228,9 @@
13235
13228
  }
13236
13229
  setViewpoint(viewpoint) {
13237
13230
  var _a, _b, _c, _d, _e, _f, _g, _h;
13231
+ this.clearSelected();
13232
+ this.removeTextInput();
13233
+ this.removeImageInput();
13238
13234
  const markupColor = ((_a = viewpoint.custom_fields) === null || _a === void 0 ? void 0 : _a.markup_color) || {
13239
13235
  r: 255,
13240
13236
  g: 0,
@@ -13297,6 +13293,8 @@
13297
13293
  enableEditMode(mode) {
13298
13294
  if (!mode || !MarkupMode2Konva[mode]) {
13299
13295
  this.clearSelected();
13296
+ this.removeTextInput();
13297
+ this.removeImageInput();
13300
13298
  this._markupIsActive = false;
13301
13299
  } else {
13302
13300
  this._markupMode = mode;
@@ -13305,13 +13303,10 @@
13305
13303
  return this;
13306
13304
  }
13307
13305
  createObject(type, params) {
13308
- var _a;
13309
13306
  const konvaShape = MarkupMode2Konva[type];
13310
13307
  if (!konvaShape || !konvaShape.initializer) throw new Error(`Markup CreateObject - unsupported markup type ${type}`);
13311
13308
  const object = konvaShape.initializer(null, params);
13312
13309
  this.addObject(object);
13313
- object.setZIndex((_a = konvaShape.zIndex) !== null && _a !== void 0 ? _a : this._zIndex);
13314
- this._zIndex++;
13315
13310
  return object;
13316
13311
  }
13317
13312
  getObjects() {
@@ -13339,13 +13334,13 @@
13339
13334
  if (this._konvaTransformer) this._konvaTransformer.nodes([]);
13340
13335
  }
13341
13336
  addObject(object) {
13342
- if (this._konvaLayer) this._konvaLayer.add(object.ref());
13337
+ if (object.type() === "Image") this._groupImages.add(object.ref()); else if (object.type() === "Text") this._groupTexts.add(object.ref()); else this._groupGeometry.add(object.ref());
13343
13338
  }
13344
13339
  konvaLayerFind(type) {
13345
13340
  if (!this._konvaLayer) return [];
13346
13341
  const konvaShape = MarkupMode2Konva[type];
13347
13342
  if (!konvaShape || !konvaShape.initializer) return [];
13348
- return this._konvaLayer.find(konvaShape.name).filter((ref => ref.parent === this._konvaLayer));
13343
+ return this._konvaLayer.find(konvaShape.name).filter((ref => ref.parent === this._konvaLayer || ref.parent === this._groupImages || ref.parent === this._groupGeometry || ref.parent === this._groupTexts));
13349
13344
  }
13350
13345
  initializeKonva() {
13351
13346
  const stage = new Konva.Stage({
@@ -13358,6 +13353,12 @@
13358
13353
  pixelRation: window.devicePixelRatio
13359
13354
  });
13360
13355
  stage.add(layer);
13356
+ this._groupImages = new Konva.Group;
13357
+ layer.add(this._groupImages);
13358
+ this._groupGeometry = new Konva.Group;
13359
+ layer.add(this._groupGeometry);
13360
+ this._groupTexts = new Konva.Group;
13361
+ layer.add(this._groupTexts);
13361
13362
  this._konvaLayer = layer;
13362
13363
  const transformer = new Konva.Transformer({
13363
13364
  shouldOverdrawWholeArea: false,
@@ -13523,7 +13524,7 @@
13523
13524
  this.removeImageInput();
13524
13525
  }
13525
13526
  }
13526
- if (transformer.nodes().filter((x => x.className === "Cloud")).length > 0 || e.target.className === "Cloud") {
13527
+ if (transformer.nodes().filter((x => x.className === "Cloud" || x.className === "Image")).length > 0 || e.target.className === "Cloud" || e.target.className === "Image") {
13527
13528
  transformer.rotateEnabled(false);
13528
13529
  } else {
13529
13530
  transformer.rotateEnabled(true);
@@ -13556,8 +13557,13 @@
13556
13557
  }
13557
13558
  destroyKonva() {
13558
13559
  var _a;
13560
+ this.removeTextInput();
13561
+ this.removeImageInput();
13559
13562
  this.clearOverlay();
13560
13563
  (_a = this._konvaStage) === null || _a === void 0 ? void 0 : _a.destroy();
13564
+ this._groupImages = undefined;
13565
+ this._groupGeometry = undefined;
13566
+ this._groupTexts = undefined;
13561
13567
  this._konvaLayer = undefined;
13562
13568
  this._konvaTransformer = undefined;
13563
13569
  this._konvaStage = undefined;
@@ -13754,6 +13760,9 @@
13754
13760
  this._textInputRef.style.display = "block";
13755
13761
  this._textInputRef.style.top = inputY + "px";
13756
13762
  this._textInputRef.style.left = inputX + "px";
13763
+ this._textInputRef.style.fontSize = `${this.fontSize}px`;
13764
+ this._textInputRef.style.color = `${this._markupColor.HexColor}`;
13765
+ this._textInputRef.style.fontFamily = "Calibri";
13757
13766
  this._textInputRef.onkeydown = event => {
13758
13767
  if (event.key === "Enter" && !event.shiftKey) {
13759
13768
  event.preventDefault();
@@ -16388,7 +16397,6 @@
16388
16397
  }
16389
16398
  }
16390
16399
 
16391
- const OVERLAY_VIEW_NAME = "$OVERLAY_VIEW_NAME";
16392
16400
  class VisualizeMarkup {
16393
16401
  constructor() {
16394
16402
  this._markupColor = { r: 255, g: 0, b: 0 };
@@ -16401,31 +16409,7 @@
16401
16409
  this._viewer.registerDragger("Text", OdaTextDragger);
16402
16410
  }
16403
16411
  dispose() { }
16404
- syncOverlay() {
16405
- if (!this._viewer.visualizeJs)
16406
- return;
16407
- const visViewer = this._viewer.visViewer();
16408
- const activeView = visViewer.activeView;
16409
- let overlayView = visViewer.getViewByName(OVERLAY_VIEW_NAME);
16410
- if (!overlayView) {
16411
- const overlayModel = visViewer.getMarkupModel();
16412
- const pDevice = visViewer.getActiveDevice();
16413
- overlayView = pDevice.createView(OVERLAY_VIEW_NAME, false);
16414
- overlayView.addModel(overlayModel);
16415
- activeView.addSibling(overlayView);
16416
- pDevice.addView(overlayView);
16417
- }
16418
- overlayView.viewPosition = activeView.viewPosition;
16419
- overlayView.viewTarget = activeView.viewTarget;
16420
- overlayView.upVector = activeView.upVector;
16421
- overlayView.viewFieldWidth = activeView.viewFieldWidth;
16422
- overlayView.viewFieldHeight = activeView.viewFieldHeight;
16423
- const viewPort = overlayView.getViewport();
16424
- overlayView.setViewport(viewPort.lowerLeft, viewPort.upperRight);
16425
- overlayView.vportRect = activeView.vportRect;
16426
- this._viewer.update();
16427
- return overlayView;
16428
- }
16412
+ syncOverlay() { }
16429
16413
  clearOverlay() {
16430
16414
  if (!this._viewer.visualizeJs)
16431
16415
  return;
@@ -16433,7 +16417,6 @@
16433
16417
  const model = visViewer.getMarkupModel();
16434
16418
  model.clearEntities();
16435
16419
  model.delete();
16436
- this._viewer.update();
16437
16420
  }
16438
16421
  getMarkupColor() {
16439
16422
  return this._markupColor;
@@ -16571,23 +16554,19 @@
16571
16554
  return viewpoint;
16572
16555
  }
16573
16556
  enableEditMode(mode) {
16574
- throw new Error("Not implemented yet");
16557
+ return this;
16575
16558
  }
16576
16559
  createObject(type, params) {
16577
- throw new Error("Not implemented yet");
16560
+ return undefined;
16578
16561
  }
16579
16562
  getObjects() {
16580
- throw new Error("Not implemented yet");
16563
+ return [];
16581
16564
  }
16582
16565
  getSelectedObjects() {
16583
- throw new Error("Not implemented yet");
16584
- }
16585
- selectObjects(objects) {
16586
- throw new Error("Not implemented yet");
16587
- }
16588
- clearSelected() {
16589
- throw new Error("Not implemented yet");
16566
+ return [];
16590
16567
  }
16568
+ selectObjects(objects) { }
16569
+ clearSelected() { }
16591
16570
  }
16592
16571
 
16593
16572
  ///////////////////////////////////////////////////////////////////////////////
@@ -16618,6 +16597,7 @@
16618
16597
  }
16619
16598
 
16620
16599
  ///////////////////////////////////////////////////////////////////////////////
16600
+ const OVERLAY_VIEW_NAME = "$OVERLAY_VIEW_NAME";
16621
16601
  const isExist = (value) => value !== undefined && value !== null;
16622
16602
  /**
16623
16603
  * The `Client.js` library class that provides methods to integrate with the
@@ -17143,16 +17123,41 @@
17143
17123
  this.update();
17144
17124
  }
17145
17125
  /**
17146
- * Remove markup overlay.
17126
+ * Clear overlay view.
17147
17127
  */
17148
17128
  clearOverlay() {
17129
+ if (!this.visualizeJs)
17130
+ return;
17149
17131
  this._markup.clearOverlay();
17132
+ this.update();
17150
17133
  }
17151
17134
  /**
17152
- * Synchronize markup overlay.
17135
+ * Create overlay view.
17153
17136
  */
17154
17137
  syncOverlay() {
17155
- return this._markup.syncOverlay();
17138
+ if (!this.visualizeJs)
17139
+ return;
17140
+ const visViewer = this.visViewer();
17141
+ const activeView = visViewer.activeView;
17142
+ let overlayView = visViewer.getViewByName(OVERLAY_VIEW_NAME);
17143
+ if (!overlayView) {
17144
+ const markupModel = visViewer.getMarkupModel();
17145
+ const pDevice = visViewer.getActiveDevice();
17146
+ overlayView = pDevice.createView(OVERLAY_VIEW_NAME, false);
17147
+ overlayView.addModel(markupModel);
17148
+ activeView.addSibling(overlayView);
17149
+ pDevice.addView(overlayView);
17150
+ }
17151
+ overlayView.viewPosition = activeView.viewPosition;
17152
+ overlayView.viewTarget = activeView.viewTarget;
17153
+ overlayView.upVector = activeView.upVector;
17154
+ overlayView.viewFieldWidth = activeView.viewFieldWidth;
17155
+ overlayView.viewFieldHeight = activeView.viewFieldHeight;
17156
+ const viewPort = overlayView.getViewport();
17157
+ overlayView.setViewport(viewPort.lowerLeft, viewPort.upperRight);
17158
+ overlayView.vportRect = activeView.vportRect;
17159
+ this._markup.syncOverlay();
17160
+ this.update();
17156
17161
  }
17157
17162
  /**
17158
17163
  * Returns `true` if current drawing is 3D drawing.