laymur 0.2.1 → 0.2.2

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Scene, OrthographicCamera, MathUtils, ShaderMaterial, Color, PlaneGeometry, Mesh, UniformsUtils, WebGLRenderTarget, UnsignedByteType, LinearFilter, RGBAFormat, PerspectiveCamera, CanvasTexture } from 'three';
1
+ import { Color, Scene, OrthographicCamera, MathUtils, ShaderMaterial, PlaneGeometry, Mesh, UniformsUtils, WebGLRenderTarget, UnsignedByteType, LinearFilter, RGBAFormat, PerspectiveCamera, CanvasTexture } from 'three';
2
2
 
3
3
  /**
4
4
  * Mathematical expression builder for constraint equations in the UI layout system.
@@ -1815,6 +1815,7 @@ function resolvePriority(priority) {
1815
1815
  return priority ?? UIPriority.P0;
1816
1816
  }
1817
1817
 
1818
+ const tempColor = new Color();
1818
1819
  class UISceneWrapper {
1819
1820
  constructor(w, h) {
1820
1821
  this._private_scene = new Scene();
@@ -1882,6 +1883,18 @@ class UISceneWrapper {
1882
1883
  return Array.from(this._private_elements.keys()).sort((a, b) => this.getZIndex(a) - this.getZIndex(b));
1883
1884
  }
1884
1885
  render(renderer, deltaTime) {
1886
+ const originalRenderTarget = renderer.getRenderTarget();
1887
+ const originalClearColor = renderer.getClearColor(tempColor);
1888
+ const originalClearAlpha = renderer.getClearAlpha();
1889
+ const originalAutoClear = renderer.autoClear;
1890
+ const originalAutoClearColor = renderer.autoClearColor;
1891
+ const originalAutoClearDepth = renderer.autoClearDepth;
1892
+ const originalAutoClearStencil = renderer.autoClearStencil;
1893
+ renderer.autoClear = false;
1894
+ renderer.autoClearColor = false;
1895
+ renderer.autoClearDepth = false;
1896
+ renderer.autoClearStencil = false;
1897
+ renderer.setClearColor(0x000000, 1);
1885
1898
  for (const [element, object] of this._private_elements) {
1886
1899
  const micro = element.micro;
1887
1900
  const cos = Math.cos(micro.rotation);
@@ -1899,7 +1912,15 @@ class UISceneWrapper {
1899
1912
  object.rotation.z = micro.rotation;
1900
1913
  element["onBeforeRenderInternal"](renderer, deltaTime);
1901
1914
  }
1915
+ renderer.clear(false, true, true);
1902
1916
  renderer.render(this._private_scene, this._private_camera);
1917
+ renderer.setRenderTarget(originalRenderTarget);
1918
+ renderer.setClearColor(originalClearColor);
1919
+ renderer.setClearAlpha(originalClearAlpha);
1920
+ renderer.autoClear = originalAutoClear;
1921
+ renderer.autoClearColor = originalAutoClearColor;
1922
+ renderer.autoClearDepth = originalAutoClearDepth;
1923
+ renderer.autoClearStencil = originalAutoClearStencil;
1903
1924
  }
1904
1925
  }
1905
1926
 
@@ -2056,8 +2077,10 @@ class UISolverWrapper {
2056
2077
  relation,
2057
2078
  enabled,
2058
2079
  });
2059
- this._private_solver.addConstraint(constraint);
2060
- this._private_recalculationRequired = true;
2080
+ if (enabled) {
2081
+ this._private_solver.addConstraint(constraint);
2082
+ this._private_recalculationRequired = true;
2083
+ }
2061
2084
  return index;
2062
2085
  }
2063
2086
  removeConstraint(index) {
@@ -5330,7 +5353,6 @@ class UIFullscreenLayer extends UILayer {
5330
5353
  */
5331
5354
  render(renderer, deltaTime) {
5332
5355
  assertValidNumber(deltaTime, "UIFullscreenLayer.deltaTime");
5333
- renderer.clear(false, true, true);
5334
5356
  super.renderInternal(renderer, deltaTime);
5335
5357
  }
5336
5358
  /**