@xeokit/xeokit-sdk 2.4.0-alpha-53 → 2.4.0-alpha-54
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/xeokit-sdk.cjs.js +27 -95
- package/dist/xeokit-sdk.es.js +27 -95
- package/dist/xeokit-sdk.es5.js +15 -12
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +1 -1
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -13536,9 +13536,6 @@ class Canvas extends Component {
|
|
|
13536
13536
|
*/
|
|
13537
13537
|
this.transparent = !!cfg.transparent;
|
|
13538
13538
|
|
|
13539
|
-
// data-textures: avoid to continuos DOM layout calculations
|
|
13540
|
-
this.optimizeResizeDetection = true;
|
|
13541
|
-
|
|
13542
13539
|
/**
|
|
13543
13540
|
* Attributes for the WebGL context
|
|
13544
13541
|
*
|
|
@@ -13619,106 +13616,39 @@ class Canvas extends Component {
|
|
|
13619
13616
|
},
|
|
13620
13617
|
false);
|
|
13621
13618
|
|
|
13622
|
-
//
|
|
13623
|
-
|
|
13624
|
-
let lastResolutionScale = null;
|
|
13625
|
-
|
|
13626
|
-
let lastWindowWidth = null;
|
|
13627
|
-
let lastWindowHeight = null;
|
|
13628
|
-
|
|
13629
|
-
let lastCanvasWidth = null;
|
|
13630
|
-
let lastCanvasHeight = null;
|
|
13631
|
-
|
|
13632
|
-
let lastCanvasOffsetLeft = null;
|
|
13633
|
-
let lastCanvasOffsetTop = null;
|
|
13634
|
-
|
|
13635
|
-
let lastParent = null;
|
|
13636
|
-
|
|
13637
|
-
let tickCount = 0;
|
|
13638
|
-
|
|
13639
|
-
this._tick = this.scene.on("tick", () => {
|
|
13640
|
-
|
|
13641
|
-
tickCount++;
|
|
13619
|
+
// Attach to resize events on the canvas
|
|
13620
|
+
let dirtyBoundary = true; // make sure we publish the 1st boundary event
|
|
13642
13621
|
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
return;
|
|
13622
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
13623
|
+
for (const entry of entries) {
|
|
13624
|
+
if (entry.contentBoxSize) {
|
|
13625
|
+
dirtyBoundary = true;
|
|
13648
13626
|
}
|
|
13649
13627
|
}
|
|
13628
|
+
});
|
|
13629
|
+
|
|
13630
|
+
resizeObserver.observe(this.canvas);
|
|
13650
13631
|
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
|
|
13657
|
-
|
|
13658
|
-
const newCanvasSize = (canvas.clientWidth !== lastCanvasWidth || canvas.clientHeight !== lastCanvasHeight);
|
|
13659
|
-
const newCanvasPos = (canvas.offsetLeft !== lastCanvasOffsetLeft || canvas.offsetTop !== lastCanvasOffsetTop);
|
|
13660
|
-
|
|
13661
|
-
const parent = canvas.parentElement;
|
|
13662
|
-
const newParent = (parent !== lastParent);
|
|
13663
|
-
|
|
13664
|
-
if (newResolutionScale || newWindowSize || newCanvasSize || newCanvasPos || newParent) {
|
|
13665
|
-
|
|
13666
|
-
self._canvasSizeChanged = true;
|
|
13667
|
-
|
|
13668
|
-
this._spinner._adjustPosition();
|
|
13669
|
-
|
|
13670
|
-
if (newResolutionScale || newCanvasSize || newCanvasPos) {
|
|
13671
|
-
|
|
13672
|
-
const newWidth = canvas.clientWidth;
|
|
13673
|
-
const newHeight = canvas.clientHeight;
|
|
13674
|
-
|
|
13675
|
-
// TODO: Wasteful to re-count pixel size of each canvas on each canvas' resize
|
|
13676
|
-
if (newResolutionScale || newCanvasSize) {
|
|
13677
|
-
let countPixels = 0;
|
|
13678
|
-
let scene;
|
|
13679
|
-
for (const sceneId in core.scenes) {
|
|
13680
|
-
if (core.scenes.hasOwnProperty(sceneId)) {
|
|
13681
|
-
scene = core.scenes[sceneId];
|
|
13682
|
-
countPixels += Math.round((scene.canvas.canvas.clientWidth * this._resolutionScale) * (scene.canvas.canvas.clientHeight * this._resolutionScale));
|
|
13683
|
-
}
|
|
13684
|
-
}
|
|
13685
|
-
stats.memory.pixels = countPixels;
|
|
13686
|
-
|
|
13687
|
-
canvas.width = Math.round(canvas.clientWidth * this._resolutionScale);
|
|
13688
|
-
canvas.height = Math.round(canvas.clientHeight * this._resolutionScale);
|
|
13689
|
-
}
|
|
13690
|
-
|
|
13691
|
-
const boundary = this.boundary;
|
|
13692
|
-
|
|
13693
|
-
boundary[0] = canvas.offsetLeft;
|
|
13694
|
-
boundary[1] = canvas.offsetTop;
|
|
13695
|
-
boundary[2] = newWidth;
|
|
13696
|
-
boundary[3] = newHeight;
|
|
13697
|
-
|
|
13698
|
-
if (!newResolutionScale) {
|
|
13699
|
-
this.fire("boundary", boundary);
|
|
13700
|
-
}
|
|
13701
|
-
|
|
13702
|
-
lastCanvasWidth = newWidth;
|
|
13703
|
-
lastCanvasHeight = newHeight;
|
|
13704
|
-
}
|
|
13632
|
+
// Publish canvas size and position changes on each scene tick
|
|
13633
|
+
this._tick = this.scene.on("tick", () => {
|
|
13634
|
+
// Only publish if the canvas bounds changed
|
|
13635
|
+
if (!dirtyBoundary) {
|
|
13636
|
+
return;
|
|
13637
|
+
}
|
|
13705
13638
|
|
|
13706
|
-
|
|
13707
|
-
lastResolutionScale = this._resolutionScale;
|
|
13708
|
-
}
|
|
13639
|
+
dirtyBoundary = false;
|
|
13709
13640
|
|
|
13710
|
-
|
|
13711
|
-
|
|
13712
|
-
|
|
13713
|
-
}
|
|
13641
|
+
// Set the real size of the canvas (the drawable w*h)
|
|
13642
|
+
self.canvas.width = Math.round(self.canvas.clientWidth * self._resolutionScale);
|
|
13643
|
+
self.canvas.height = Math.round(self.canvas.clientHeight * self._resolutionScale);
|
|
13714
13644
|
|
|
13715
|
-
|
|
13716
|
-
|
|
13717
|
-
|
|
13718
|
-
|
|
13645
|
+
// Publish the boundary change
|
|
13646
|
+
self.boundary[0] = self.canvas.offsetLeft;
|
|
13647
|
+
self.boundary[1] = self.canvas.offsetTop;
|
|
13648
|
+
self.boundary[2] = self.canvas.clientWidth;
|
|
13649
|
+
self.boundary[3] = self.canvas.clientHeight;
|
|
13719
13650
|
|
|
13720
|
-
|
|
13721
|
-
}
|
|
13651
|
+
self.fire("boundary", self.boundary);
|
|
13722
13652
|
});
|
|
13723
13653
|
|
|
13724
13654
|
this._spinner = new Spinner(this.scene, {
|
|
@@ -17678,6 +17608,8 @@ class Perspective extends Component {
|
|
|
17678
17608
|
|
|
17679
17609
|
this.glRedraw();
|
|
17680
17610
|
|
|
17611
|
+
this.camera._updateScheduled = true;
|
|
17612
|
+
|
|
17681
17613
|
this.fire("matrix", this._state.matrix);
|
|
17682
17614
|
}
|
|
17683
17615
|
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -13532,9 +13532,6 @@ class Canvas extends Component {
|
|
|
13532
13532
|
*/
|
|
13533
13533
|
this.transparent = !!cfg.transparent;
|
|
13534
13534
|
|
|
13535
|
-
// data-textures: avoid to continuos DOM layout calculations
|
|
13536
|
-
this.optimizeResizeDetection = true;
|
|
13537
|
-
|
|
13538
13535
|
/**
|
|
13539
13536
|
* Attributes for the WebGL context
|
|
13540
13537
|
*
|
|
@@ -13615,106 +13612,39 @@ class Canvas extends Component {
|
|
|
13615
13612
|
},
|
|
13616
13613
|
false);
|
|
13617
13614
|
|
|
13618
|
-
//
|
|
13619
|
-
|
|
13620
|
-
let lastResolutionScale = null;
|
|
13621
|
-
|
|
13622
|
-
let lastWindowWidth = null;
|
|
13623
|
-
let lastWindowHeight = null;
|
|
13624
|
-
|
|
13625
|
-
let lastCanvasWidth = null;
|
|
13626
|
-
let lastCanvasHeight = null;
|
|
13627
|
-
|
|
13628
|
-
let lastCanvasOffsetLeft = null;
|
|
13629
|
-
let lastCanvasOffsetTop = null;
|
|
13630
|
-
|
|
13631
|
-
let lastParent = null;
|
|
13632
|
-
|
|
13633
|
-
let tickCount = 0;
|
|
13634
|
-
|
|
13635
|
-
this._tick = this.scene.on("tick", () => {
|
|
13636
|
-
|
|
13637
|
-
tickCount++;
|
|
13615
|
+
// Attach to resize events on the canvas
|
|
13616
|
+
let dirtyBoundary = true; // make sure we publish the 1st boundary event
|
|
13638
13617
|
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
return;
|
|
13618
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
13619
|
+
for (const entry of entries) {
|
|
13620
|
+
if (entry.contentBoxSize) {
|
|
13621
|
+
dirtyBoundary = true;
|
|
13644
13622
|
}
|
|
13645
13623
|
}
|
|
13624
|
+
});
|
|
13625
|
+
|
|
13626
|
+
resizeObserver.observe(this.canvas);
|
|
13646
13627
|
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
const newCanvasSize = (canvas.clientWidth !== lastCanvasWidth || canvas.clientHeight !== lastCanvasHeight);
|
|
13655
|
-
const newCanvasPos = (canvas.offsetLeft !== lastCanvasOffsetLeft || canvas.offsetTop !== lastCanvasOffsetTop);
|
|
13656
|
-
|
|
13657
|
-
const parent = canvas.parentElement;
|
|
13658
|
-
const newParent = (parent !== lastParent);
|
|
13659
|
-
|
|
13660
|
-
if (newResolutionScale || newWindowSize || newCanvasSize || newCanvasPos || newParent) {
|
|
13661
|
-
|
|
13662
|
-
self._canvasSizeChanged = true;
|
|
13663
|
-
|
|
13664
|
-
this._spinner._adjustPosition();
|
|
13665
|
-
|
|
13666
|
-
if (newResolutionScale || newCanvasSize || newCanvasPos) {
|
|
13667
|
-
|
|
13668
|
-
const newWidth = canvas.clientWidth;
|
|
13669
|
-
const newHeight = canvas.clientHeight;
|
|
13670
|
-
|
|
13671
|
-
// TODO: Wasteful to re-count pixel size of each canvas on each canvas' resize
|
|
13672
|
-
if (newResolutionScale || newCanvasSize) {
|
|
13673
|
-
let countPixels = 0;
|
|
13674
|
-
let scene;
|
|
13675
|
-
for (const sceneId in core.scenes) {
|
|
13676
|
-
if (core.scenes.hasOwnProperty(sceneId)) {
|
|
13677
|
-
scene = core.scenes[sceneId];
|
|
13678
|
-
countPixels += Math.round((scene.canvas.canvas.clientWidth * this._resolutionScale) * (scene.canvas.canvas.clientHeight * this._resolutionScale));
|
|
13679
|
-
}
|
|
13680
|
-
}
|
|
13681
|
-
stats.memory.pixels = countPixels;
|
|
13682
|
-
|
|
13683
|
-
canvas.width = Math.round(canvas.clientWidth * this._resolutionScale);
|
|
13684
|
-
canvas.height = Math.round(canvas.clientHeight * this._resolutionScale);
|
|
13685
|
-
}
|
|
13686
|
-
|
|
13687
|
-
const boundary = this.boundary;
|
|
13688
|
-
|
|
13689
|
-
boundary[0] = canvas.offsetLeft;
|
|
13690
|
-
boundary[1] = canvas.offsetTop;
|
|
13691
|
-
boundary[2] = newWidth;
|
|
13692
|
-
boundary[3] = newHeight;
|
|
13693
|
-
|
|
13694
|
-
if (!newResolutionScale) {
|
|
13695
|
-
this.fire("boundary", boundary);
|
|
13696
|
-
}
|
|
13697
|
-
|
|
13698
|
-
lastCanvasWidth = newWidth;
|
|
13699
|
-
lastCanvasHeight = newHeight;
|
|
13700
|
-
}
|
|
13628
|
+
// Publish canvas size and position changes on each scene tick
|
|
13629
|
+
this._tick = this.scene.on("tick", () => {
|
|
13630
|
+
// Only publish if the canvas bounds changed
|
|
13631
|
+
if (!dirtyBoundary) {
|
|
13632
|
+
return;
|
|
13633
|
+
}
|
|
13701
13634
|
|
|
13702
|
-
|
|
13703
|
-
lastResolutionScale = this._resolutionScale;
|
|
13704
|
-
}
|
|
13635
|
+
dirtyBoundary = false;
|
|
13705
13636
|
|
|
13706
|
-
|
|
13707
|
-
|
|
13708
|
-
|
|
13709
|
-
}
|
|
13637
|
+
// Set the real size of the canvas (the drawable w*h)
|
|
13638
|
+
self.canvas.width = Math.round(self.canvas.clientWidth * self._resolutionScale);
|
|
13639
|
+
self.canvas.height = Math.round(self.canvas.clientHeight * self._resolutionScale);
|
|
13710
13640
|
|
|
13711
|
-
|
|
13712
|
-
|
|
13713
|
-
|
|
13714
|
-
|
|
13641
|
+
// Publish the boundary change
|
|
13642
|
+
self.boundary[0] = self.canvas.offsetLeft;
|
|
13643
|
+
self.boundary[1] = self.canvas.offsetTop;
|
|
13644
|
+
self.boundary[2] = self.canvas.clientWidth;
|
|
13645
|
+
self.boundary[3] = self.canvas.clientHeight;
|
|
13715
13646
|
|
|
13716
|
-
|
|
13717
|
-
}
|
|
13647
|
+
self.fire("boundary", self.boundary);
|
|
13718
13648
|
});
|
|
13719
13649
|
|
|
13720
13650
|
this._spinner = new Spinner(this.scene, {
|
|
@@ -17674,6 +17604,8 @@ class Perspective extends Component {
|
|
|
17674
17604
|
|
|
17675
17605
|
this.glRedraw();
|
|
17676
17606
|
|
|
17607
|
+
this.camera._updateScheduled = true;
|
|
17608
|
+
|
|
17677
17609
|
this.fire("matrix", this._state.matrix);
|
|
17678
17610
|
}
|
|
17679
17611
|
|