Skip to content

Commit 259954b

Browse files
committed
fix(several): fix several bugs
1 parent 5d5a5a8 commit 259954b

12 files changed

+156
-116
lines changed

c2d-todo.txt

-11
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,3 @@ Patterns (repeating textures?): texture params.
1313

1414
Set image smoothing based on texture (if gl.NEAREST).
1515

16-
WebGL specific settings ($gl: {type: ...}, $c2d: {type: ...})
17-
18-
FastBlurComponent: two types:
19-
- webgl
20-
- canvas2d
21-
canvas2d uses the 'blur' filter.
22-
23-
Fix:
24-
FlowingGradientShader
25-
26-
FastBlurShader fallback for canvas2d.

dist/lightning-node.js

+25-9
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,10 @@ class TextureSource {
700700
return this._nativeTexture;
701701
}
702702

703+
clearNativeTexture() {
704+
this._nativeTexture = null;
705+
}
706+
703707
/**
704708
* Used for result textures.
705709
*/
@@ -8784,7 +8788,6 @@ class WebGLRenderer extends Renderer {
87848788

87858789
freeTextureSource(textureSource) {
87868790
this.stage.gl.deleteTexture(textureSource.nativeTexture);
8787-
textureSource.nativeTexture = null;
87888791
}
87898792

87908793
addQuad(renderState, quads, index) {
@@ -9464,6 +9467,7 @@ class TextureManager {
94649467

94659468
_nativeFreeTextureSource(textureSource) {
94669469
this.stage.renderer.freeTextureSource(textureSource);
9470+
textureSource.clearNativeTexture();
94679471
}
94689472

94699473
}
@@ -10848,7 +10852,7 @@ class Stage extends EventEmitter {
1084810852
this.c2d = context;
1084910853
}
1085010854
} else {
10851-
if (!Utils.isWeb && (!Stage.isWebglSupported() || this.getOption('canvas2d'))) {
10855+
if (Utils.isWeb && (!Stage.isWebglSupported() || this.getOption('canvas2d'))) {
1085210856
this.c2d = this.platform.createCanvasContext(this.getOption('w'), this.getOption('h'));
1085310857
} else {
1085410858
this.gl = this.platform.createWebGLContext(this.getOption('w'), this.getOption('h'));
@@ -11542,7 +11546,18 @@ class Application extends Component {
1154211546
this.__updateFocus();
1154311547
}
1154411548

11545-
__updateFocus(maxRecursion = 100) {
11549+
__updateFocus() {
11550+
if (this.__updateFocusRec()) {
11551+
// Performance optimization: do not gather settings if no handler is defined.
11552+
if (this._handleFocusSettings !== Application.prototype._handleFocusSettings) {
11553+
if (!Application.booting) {
11554+
this.updateFocusSettings();
11555+
}
11556+
}
11557+
}
11558+
}
11559+
11560+
__updateFocusRec(maxRecursion = 100) {
1154611561
const newFocusPath = this.__getFocusPath();
1154711562
const newFocusedComponent = newFocusPath[newFocusPath.length - 1];
1154811563
const prevFocusedComponent = this._focusPath ? this._focusPath[this._focusPath.length - 1] : undefined;
@@ -11555,6 +11570,7 @@ class Application extends Component {
1155511570
for (let i = 0, n = this._focusPath.length; i < n; i++) {
1155611571
this._focusPath[i].__focus(newFocusedComponent, undefined);
1155711572
}
11573+
return true;
1155811574
} else {
1155911575
let m = Math.min(this._focusPath.length, newFocusPath.length);
1156011576
let index;
@@ -11590,13 +11606,10 @@ class Application extends Component {
1159011606
throw new Error("Max recursion count reached in focus update");
1159111607
}
1159211608
this.__updateFocus(maxRecursion);
11593-
}
11594-
}
1159511609

11596-
// Performance optimization: do not gather settings if no handler is defined.
11597-
if (this._handleFocusSettings !== Application.prototype._handleFocusSettings) {
11598-
if (!Application.booting) {
11599-
this.updateFocusSettings();
11610+
return true;
11611+
} else {
11612+
return false;
1160011613
}
1160111614
}
1160211615
}
@@ -13359,6 +13372,8 @@ class BorderComponent extends Component {
1335913372
view._borderRight.h = rh + view._borderTop.h + view._borderBottom.h;
1336013373
view._borderRight.y = -view._borderTop.h;
1336113374
};
13375+
13376+
this.borderWidth = 1;
1336213377
}
1336313378

1336413379
get content() {
@@ -14518,6 +14533,7 @@ const lightning = {
1451814533
HtmlTexture,
1451914534
StaticTexture,
1452014535
StaticCanvasTexture,
14536+
SourceTexture
1452114537
},
1452214538
misc: {
1452314539
ObjectListProxy,

dist/lightning-web.js

+25-9
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,10 @@ var lng = (function () {
693693
return this._nativeTexture;
694694
}
695695

696+
clearNativeTexture() {
697+
this._nativeTexture = null;
698+
}
699+
696700
/**
697701
* Used for result textures.
698702
*/
@@ -8777,7 +8781,6 @@ var lng = (function () {
87778781

87788782
freeTextureSource(textureSource) {
87798783
this.stage.gl.deleteTexture(textureSource.nativeTexture);
8780-
textureSource.nativeTexture = null;
87818784
}
87828785

87838786
addQuad(renderState, quads, index) {
@@ -9770,6 +9773,7 @@ var lng = (function () {
97709773

97719774
_nativeFreeTextureSource(textureSource) {
97729775
this.stage.renderer.freeTextureSource(textureSource);
9776+
textureSource.clearNativeTexture();
97739777
}
97749778

97759779
}
@@ -11154,7 +11158,7 @@ var lng = (function () {
1115411158
this.c2d = context;
1115511159
}
1115611160
} else {
11157-
if (!Utils.isWeb && (!Stage.isWebglSupported() || this.getOption('canvas2d'))) {
11161+
if (Utils.isWeb && (!Stage.isWebglSupported() || this.getOption('canvas2d'))) {
1115811162
this.c2d = this.platform.createCanvasContext(this.getOption('w'), this.getOption('h'));
1115911163
} else {
1116011164
this.gl = this.platform.createWebGLContext(this.getOption('w'), this.getOption('h'));
@@ -11848,7 +11852,18 @@ var lng = (function () {
1184811852
this.__updateFocus();
1184911853
}
1185011854

11851-
__updateFocus(maxRecursion = 100) {
11855+
__updateFocus() {
11856+
if (this.__updateFocusRec()) {
11857+
// Performance optimization: do not gather settings if no handler is defined.
11858+
if (this._handleFocusSettings !== Application.prototype._handleFocusSettings) {
11859+
if (!Application.booting) {
11860+
this.updateFocusSettings();
11861+
}
11862+
}
11863+
}
11864+
}
11865+
11866+
__updateFocusRec(maxRecursion = 100) {
1185211867
const newFocusPath = this.__getFocusPath();
1185311868
const newFocusedComponent = newFocusPath[newFocusPath.length - 1];
1185411869
const prevFocusedComponent = this._focusPath ? this._focusPath[this._focusPath.length - 1] : undefined;
@@ -11861,6 +11876,7 @@ var lng = (function () {
1186111876
for (let i = 0, n = this._focusPath.length; i < n; i++) {
1186211877
this._focusPath[i].__focus(newFocusedComponent, undefined);
1186311878
}
11879+
return true;
1186411880
} else {
1186511881
let m = Math.min(this._focusPath.length, newFocusPath.length);
1186611882
let index;
@@ -11896,13 +11912,10 @@ var lng = (function () {
1189611912
throw new Error("Max recursion count reached in focus update");
1189711913
}
1189811914
this.__updateFocus(maxRecursion);
11899-
}
11900-
}
1190111915

11902-
// Performance optimization: do not gather settings if no handler is defined.
11903-
if (this._handleFocusSettings !== Application.prototype._handleFocusSettings) {
11904-
if (!Application.booting) {
11905-
this.updateFocusSettings();
11916+
return true;
11917+
} else {
11918+
return false;
1190611919
}
1190711920
}
1190811921
}
@@ -13665,6 +13678,8 @@ var lng = (function () {
1366513678
view._borderRight.h = rh + view._borderTop.h + view._borderBottom.h;
1366613679
view._borderRight.y = -view._borderTop.h;
1366713680
};
13681+
13682+
this.borderWidth = 1;
1366813683
}
1366913684

1367013685
get content() {
@@ -14824,6 +14839,7 @@ var lng = (function () {
1482414839
HtmlTexture,
1482514840
StaticTexture,
1482614841
StaticCanvasTexture,
14842+
SourceTexture
1482714843
},
1482814844
misc: {
1482914845
ObjectListProxy,

0 commit comments

Comments
 (0)