Skip to content

Commit

Permalink
Rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Dec 6, 2023
1 parent dc7c598 commit b26100e
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 61 deletions.
99 changes: 74 additions & 25 deletions dist/xeokit-sdk.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11898,7 +11898,25 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {

this._currentAngleMeasurement = null;

// init markerDiv element (think about making its style configurable)
this._initMarkerDiv();

this._onMouseHoverSurface = null;
this._onHoverNothing = null;
this._onPickedNothing = null;
this._onPickedSurface = null;

this._onInputMouseDown = null;
this._onInputMouseUp = null;

this._snapping = cfg.snapping !== false;

this._attachPlugin(angleMeasurementsPlugin, cfg);
}

_initMarkerDiv() {
const markerDiv = document.createElement('div');
markerDiv.setAttribute('id', 'myMarkerDiv');
const canvas = this.scene.canvas.canvas;
canvas.parentNode.insertBefore(markerDiv, canvas);

Expand All @@ -11913,17 +11931,14 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
markerDiv.style.pointerEvents = "none";

this.markerDiv = markerDiv;
this._onMouseHoverSurface = null;
this._onHoverNothing = null;
this._onPickedNothing = null;
this._onPickedSurface = null;

this._onInputMouseDown = null;
this._onInputMouseUp = null;

this._snapping = cfg.snapping !== false;
}

this._attachPlugin(angleMeasurementsPlugin, cfg);
_destroyMarkerDiv() {
if (this._markerDiv) {
const element = document.getElementById('myMarkerDiv');
element.parentNode.removeChild(element);
this._markerDiv = null;
}
}

_attachPlugin(angleMeasurementsPlugin, cfg = {}) {
Expand Down Expand Up @@ -11991,6 +12006,9 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
if (this._active) {
return;
}
if (!this.markerDiv) {
this._initMarkerDiv(); // if the marker is destroyed after deactivation, we recreate it
}
this.angleMeasurementsPlugin;
const scene = this.scene;
scene.input;
Expand Down Expand Up @@ -12195,6 +12213,9 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
if (this.pointerLens) {
this.pointerLens.visible = false;
}
if (this._markerDiv) {
this._destroyMarkerDiv();
}
this.reset();
const canvas = this.scene.canvas.canvas;
canvas.removeEventListener("mousedown", this._onMouseDown);
Expand All @@ -12219,6 +12240,10 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
if (!this._active) {
return;
}

this._destroyMarkerDiv();
this._initMarkerDiv();

if (this._currentAngleMeasurement) {
this._currentAngleMeasurement.destroy();
this._currentAngleMeasurement = null;
Expand Down Expand Up @@ -49963,21 +49988,6 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {

this._active = false;

const markerDiv = document.createElement('div');
const canvas = this.scene.canvas.canvas;
canvas.parentNode.insertBefore(markerDiv, canvas);
markerDiv.style.background = "black";
markerDiv.style.border = "2px solid blue";
markerDiv.style.borderRadius = "10px";
markerDiv.style.width = "5px";
markerDiv.style.height = "5px";
markerDiv.style.margin = "-200px -200px";
markerDiv.style.zIndex = "100";
markerDiv.style.position = "absolute";
markerDiv.style.pointerEvents = "none";

this._markerDiv = markerDiv;

this._currentDistanceMeasurement = null;

this._currentDistanceMeasurementInitState = {
Expand All @@ -49989,6 +49999,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
targetVisible: null,
};

this._initMarkerDiv();

this._onCameraControlHoverSnapOrSurface = null;
this._onCameraControlHoverSnapOrSurfaceOff = null;
this._onMouseDown = null;
Expand All @@ -50001,6 +50013,32 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
this._attachPlugin(distanceMeasurementsPlugin, cfg);
}

_initMarkerDiv() {
const markerDiv = document.createElement('div');
markerDiv.setAttribute('id', 'myMarkerDiv');
const canvas = this.scene.canvas.canvas;
canvas.parentNode.insertBefore(markerDiv, canvas);
markerDiv.style.background = "black";
markerDiv.style.border = "2px solid blue";
markerDiv.style.borderRadius = "10px";
markerDiv.style.width = "5px";
markerDiv.style.height = "5px";
markerDiv.style.margin = "-200px -200px";
markerDiv.style.zIndex = "100";
markerDiv.style.position = "absolute";
markerDiv.style.pointerEvents = "none";

this._markerDiv = markerDiv;
}

_destroyMarkerDiv() {
if (this._markerDiv) {
const element = document.getElementById('myMarkerDiv');
element.parentNode.removeChild(element);
this._markerDiv = null;
}
}

_attachPlugin(distanceMeasurementsPlugin, cfg = {}) {

/**
Expand Down Expand Up @@ -50066,6 +50104,10 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
return;
}

if (!this._markerDiv) {
this._initMarkerDiv();
}

this.fire("activated", true);

const distanceMeasurementsPlugin = this.distanceMeasurementsPlugin;
Expand Down Expand Up @@ -50221,6 +50263,9 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
if (this.pointerLens) {
this.pointerLens.visible = false;
}
if (this._markerDiv) {
this._destroyMarkerDiv();
}
this.reset();
const canvas = this.scene.canvas.canvas;
canvas.removeEventListener("mousedown", this._onMouseDown);
Expand All @@ -50247,6 +50292,10 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
if (!this._active) {
return;
}

this._destroyMarkerDiv();
this._initMarkerDiv();

if (this._currentDistanceMeasurement) {
this.distanceMeasurementsPlugin.fire("measurementCancel", this._currentDistanceMeasurement);
this._currentDistanceMeasurement.destroy();
Expand Down
99 changes: 74 additions & 25 deletions dist/xeokit-sdk.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -11894,7 +11894,25 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {

this._currentAngleMeasurement = null;

// init markerDiv element (think about making its style configurable)
this._initMarkerDiv();

this._onMouseHoverSurface = null;
this._onHoverNothing = null;
this._onPickedNothing = null;
this._onPickedSurface = null;

this._onInputMouseDown = null;
this._onInputMouseUp = null;

this._snapping = cfg.snapping !== false;

this._attachPlugin(angleMeasurementsPlugin, cfg);
}

_initMarkerDiv() {
const markerDiv = document.createElement('div');
markerDiv.setAttribute('id', 'myMarkerDiv');
const canvas = this.scene.canvas.canvas;
canvas.parentNode.insertBefore(markerDiv, canvas);

Expand All @@ -11909,17 +11927,14 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
markerDiv.style.pointerEvents = "none";

this.markerDiv = markerDiv;
this._onMouseHoverSurface = null;
this._onHoverNothing = null;
this._onPickedNothing = null;
this._onPickedSurface = null;

this._onInputMouseDown = null;
this._onInputMouseUp = null;

this._snapping = cfg.snapping !== false;
}

this._attachPlugin(angleMeasurementsPlugin, cfg);
_destroyMarkerDiv() {
if (this._markerDiv) {
const element = document.getElementById('myMarkerDiv');
element.parentNode.removeChild(element);
this._markerDiv = null;
}
}

_attachPlugin(angleMeasurementsPlugin, cfg = {}) {
Expand Down Expand Up @@ -11987,6 +12002,9 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
if (this._active) {
return;
}
if (!this.markerDiv) {
this._initMarkerDiv(); // if the marker is destroyed after deactivation, we recreate it
}
this.angleMeasurementsPlugin;
const scene = this.scene;
scene.input;
Expand Down Expand Up @@ -12191,6 +12209,9 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
if (this.pointerLens) {
this.pointerLens.visible = false;
}
if (this._markerDiv) {
this._destroyMarkerDiv();
}
this.reset();
const canvas = this.scene.canvas.canvas;
canvas.removeEventListener("mousedown", this._onMouseDown);
Expand All @@ -12215,6 +12236,10 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
if (!this._active) {
return;
}

this._destroyMarkerDiv();
this._initMarkerDiv();

if (this._currentAngleMeasurement) {
this._currentAngleMeasurement.destroy();
this._currentAngleMeasurement = null;
Expand Down Expand Up @@ -49959,21 +49984,6 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {

this._active = false;

const markerDiv = document.createElement('div');
const canvas = this.scene.canvas.canvas;
canvas.parentNode.insertBefore(markerDiv, canvas);
markerDiv.style.background = "black";
markerDiv.style.border = "2px solid blue";
markerDiv.style.borderRadius = "10px";
markerDiv.style.width = "5px";
markerDiv.style.height = "5px";
markerDiv.style.margin = "-200px -200px";
markerDiv.style.zIndex = "100";
markerDiv.style.position = "absolute";
markerDiv.style.pointerEvents = "none";

this._markerDiv = markerDiv;

this._currentDistanceMeasurement = null;

this._currentDistanceMeasurementInitState = {
Expand All @@ -49985,6 +49995,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
targetVisible: null,
};

this._initMarkerDiv();

this._onCameraControlHoverSnapOrSurface = null;
this._onCameraControlHoverSnapOrSurfaceOff = null;
this._onMouseDown = null;
Expand All @@ -49997,6 +50009,32 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
this._attachPlugin(distanceMeasurementsPlugin, cfg);
}

_initMarkerDiv() {
const markerDiv = document.createElement('div');
markerDiv.setAttribute('id', 'myMarkerDiv');
const canvas = this.scene.canvas.canvas;
canvas.parentNode.insertBefore(markerDiv, canvas);
markerDiv.style.background = "black";
markerDiv.style.border = "2px solid blue";
markerDiv.style.borderRadius = "10px";
markerDiv.style.width = "5px";
markerDiv.style.height = "5px";
markerDiv.style.margin = "-200px -200px";
markerDiv.style.zIndex = "100";
markerDiv.style.position = "absolute";
markerDiv.style.pointerEvents = "none";

this._markerDiv = markerDiv;
}

_destroyMarkerDiv() {
if (this._markerDiv) {
const element = document.getElementById('myMarkerDiv');
element.parentNode.removeChild(element);
this._markerDiv = null;
}
}

_attachPlugin(distanceMeasurementsPlugin, cfg = {}) {

/**
Expand Down Expand Up @@ -50062,6 +50100,10 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
return;
}

if (!this._markerDiv) {
this._initMarkerDiv();
}

this.fire("activated", true);

const distanceMeasurementsPlugin = this.distanceMeasurementsPlugin;
Expand Down Expand Up @@ -50217,6 +50259,9 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
if (this.pointerLens) {
this.pointerLens.visible = false;
}
if (this._markerDiv) {
this._destroyMarkerDiv();
}
this.reset();
const canvas = this.scene.canvas.canvas;
canvas.removeEventListener("mousedown", this._onMouseDown);
Expand All @@ -50243,6 +50288,10 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
if (!this._active) {
return;
}

this._destroyMarkerDiv();
this._initMarkerDiv();

if (this._currentDistanceMeasurement) {
this.distanceMeasurementsPlugin.fire("measurementCancel", this._currentDistanceMeasurement);
this._currentDistanceMeasurement.destroy();
Expand Down
Loading

0 comments on commit b26100e

Please sign in to comment.