modern-canvas 0.6.13 → 0.7.0
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/README.md +6 -4
- package/dist/index.cjs +1660 -1688
- package/dist/index.d.cts +79 -103
- package/dist/index.d.mts +79 -103
- package/dist/index.d.ts +79 -103
- package/dist/index.js +41 -41
- package/dist/index.mjs +1663 -1691
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1905,6 +1905,14 @@ class Rect2 {
|
|
|
1905
1905
|
toArray() {
|
|
1906
1906
|
return [this.x, this.y, this.width, this.height];
|
|
1907
1907
|
}
|
|
1908
|
+
toJSON() {
|
|
1909
|
+
return {
|
|
1910
|
+
x: this.x,
|
|
1911
|
+
y: this.y,
|
|
1912
|
+
width: this.width,
|
|
1913
|
+
height: this.height
|
|
1914
|
+
};
|
|
1915
|
+
}
|
|
1908
1916
|
}
|
|
1909
1917
|
|
|
1910
1918
|
class Transform2D extends Matrix3 {
|
|
@@ -2080,7 +2088,7 @@ class Vector3 extends Vector {
|
|
|
2080
2088
|
}
|
|
2081
2089
|
|
|
2082
2090
|
var __defProp$Q = Object.defineProperty;
|
|
2083
|
-
var __decorateClass$
|
|
2091
|
+
var __decorateClass$Z = (decorators, target, key, kind) => {
|
|
2084
2092
|
var result = void 0 ;
|
|
2085
2093
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2086
2094
|
if (decorator = decorators[i])
|
|
@@ -2128,10 +2136,10 @@ class MainLoop extends CoreObject {
|
|
|
2128
2136
|
this.stop();
|
|
2129
2137
|
}
|
|
2130
2138
|
}
|
|
2131
|
-
__decorateClass$
|
|
2132
|
-
modernIdoc.property({ fallback:
|
|
2139
|
+
__decorateClass$Z([
|
|
2140
|
+
modernIdoc.property({ fallback: 60 })
|
|
2133
2141
|
], MainLoop.prototype, "fps");
|
|
2134
|
-
__decorateClass$
|
|
2142
|
+
__decorateClass$Z([
|
|
2135
2143
|
modernIdoc.property({ fallback: 1 })
|
|
2136
2144
|
], MainLoop.prototype, "speed");
|
|
2137
2145
|
|
|
@@ -3457,6 +3465,33 @@ function getVarTypeSize(type) {
|
|
|
3457
3465
|
}
|
|
3458
3466
|
}
|
|
3459
3467
|
|
|
3468
|
+
function applyMatrixToPoint(m, x, y) {
|
|
3469
|
+
const [a, d, g, b, e, h, c, f, i] = m;
|
|
3470
|
+
const xp = a * x + b * y + c;
|
|
3471
|
+
const yp = d * x + e * y + f;
|
|
3472
|
+
const wp = g * x + h * y + i;
|
|
3473
|
+
return { x: xp / wp, y: yp / wp };
|
|
3474
|
+
}
|
|
3475
|
+
function transformRectToAABB(m, rect) {
|
|
3476
|
+
const { x, y, width, height } = rect;
|
|
3477
|
+
const p1 = applyMatrixToPoint(m, x, y);
|
|
3478
|
+
const p2 = applyMatrixToPoint(m, x + width, y);
|
|
3479
|
+
const p3 = applyMatrixToPoint(m, x + width, y + height);
|
|
3480
|
+
const p4 = applyMatrixToPoint(m, x, y + height);
|
|
3481
|
+
const pts = [p1, p2, p3, p4];
|
|
3482
|
+
const xs = pts.map((p) => p.x);
|
|
3483
|
+
const ys = pts.map((p) => p.y);
|
|
3484
|
+
const minX = Math.min(...xs);
|
|
3485
|
+
const maxX = Math.max(...xs);
|
|
3486
|
+
const minY = Math.min(...ys);
|
|
3487
|
+
const maxY = Math.max(...ys);
|
|
3488
|
+
return {
|
|
3489
|
+
x: minX,
|
|
3490
|
+
y: minY,
|
|
3491
|
+
width: maxX - minX,
|
|
3492
|
+
height: maxY - minY
|
|
3493
|
+
};
|
|
3494
|
+
}
|
|
3460
3495
|
class WebGLScissorModule extends WebGLModule {
|
|
3461
3496
|
install(renderer) {
|
|
3462
3497
|
super.install(renderer);
|
|
@@ -3482,19 +3517,21 @@ class WebGLScissorModule extends WebGLModule {
|
|
|
3482
3517
|
}
|
|
3483
3518
|
use() {
|
|
3484
3519
|
const renderer = this._renderer;
|
|
3485
|
-
const { pixelRatio, mask, viewport, screen, gl } = renderer;
|
|
3486
|
-
const
|
|
3487
|
-
|
|
3520
|
+
const { pixelRatio, mask, viewport, screen, gl, program } = renderer;
|
|
3521
|
+
const { worldTransformMatrix } = program.uniforms;
|
|
3522
|
+
const rect = transformRectToAABB(worldTransformMatrix, mask.last.mask);
|
|
3523
|
+
const { x, y, width, height } = rect;
|
|
3524
|
+
let scissorY;
|
|
3488
3525
|
if (viewport.boundViewport) {
|
|
3489
|
-
|
|
3526
|
+
scissorY = viewport.boundViewport.height - (height + y) * pixelRatio;
|
|
3490
3527
|
} else {
|
|
3491
|
-
|
|
3528
|
+
scissorY = (screen.height - (height + y)) * pixelRatio;
|
|
3492
3529
|
}
|
|
3493
3530
|
gl.scissor(
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3531
|
+
x * pixelRatio,
|
|
3532
|
+
scissorY,
|
|
3533
|
+
width * pixelRatio,
|
|
3534
|
+
height * pixelRatio
|
|
3498
3535
|
);
|
|
3499
3536
|
}
|
|
3500
3537
|
}
|
|
@@ -4171,15 +4208,13 @@ class WebGLRenderer extends Renderer {
|
|
|
4171
4208
|
this.view?.removeEventListener("webglcontextrestored", this._onContextRestored, false);
|
|
4172
4209
|
this.extensions.loseContext?.loseContext();
|
|
4173
4210
|
}
|
|
4174
|
-
toPixels() {
|
|
4175
|
-
const width = this.gl.drawingBufferWidth;
|
|
4176
|
-
const height = this.gl.drawingBufferHeight;
|
|
4211
|
+
toPixels(x = 0, y = 0, width = this.gl.drawingBufferWidth, height = this.gl.drawingBufferHeight) {
|
|
4177
4212
|
const length = width * height * 4;
|
|
4178
4213
|
const row = width * 4;
|
|
4179
4214
|
const end = (height - 1) * row;
|
|
4180
4215
|
const flipedPixels = new Uint8Array(length);
|
|
4181
4216
|
const pixels = new Uint8ClampedArray(length);
|
|
4182
|
-
this.gl.readPixels(
|
|
4217
|
+
this.gl.readPixels(x, y, width, height, this.gl.RGBA, this.gl.UNSIGNED_BYTE, flipedPixels);
|
|
4183
4218
|
for (let i = 0; i < length; i += row) {
|
|
4184
4219
|
pixels.set(flipedPixels.subarray(i, i + row), end - i);
|
|
4185
4220
|
}
|
|
@@ -4211,152 +4246,6 @@ class FontLoader extends Loader {
|
|
|
4211
4246
|
}
|
|
4212
4247
|
}
|
|
4213
4248
|
|
|
4214
|
-
const defaultFilters = {
|
|
4215
|
-
"brightness": 1,
|
|
4216
|
-
"contrast": 1,
|
|
4217
|
-
"grayscale": 0,
|
|
4218
|
-
"hue-rotate": 0,
|
|
4219
|
-
"invert": 0,
|
|
4220
|
-
"opacity": 1,
|
|
4221
|
-
"saturate": 1,
|
|
4222
|
-
"sepia": 0
|
|
4223
|
-
};
|
|
4224
|
-
function parseCSSFilter(filter) {
|
|
4225
|
-
const m = new ColorMatrix();
|
|
4226
|
-
if (filter === "none") {
|
|
4227
|
-
return m;
|
|
4228
|
-
}
|
|
4229
|
-
const filters = parseCssFunctions(filter).reduce((filter2, { name, args }) => {
|
|
4230
|
-
filter2[name] = args[0].normalizedIntValue;
|
|
4231
|
-
return filter2;
|
|
4232
|
-
}, {});
|
|
4233
|
-
Object.keys(defaultFilters).forEach((name) => {
|
|
4234
|
-
filters[name] = filters[name] ?? defaultFilters[name];
|
|
4235
|
-
});
|
|
4236
|
-
for (const name in filters) {
|
|
4237
|
-
const value = filters[name];
|
|
4238
|
-
switch (name) {
|
|
4239
|
-
case "hue-rotate":
|
|
4240
|
-
m.hueRotate(value * PI_2);
|
|
4241
|
-
break;
|
|
4242
|
-
case "saturate":
|
|
4243
|
-
m.saturate(value);
|
|
4244
|
-
break;
|
|
4245
|
-
case "brightness":
|
|
4246
|
-
m.brightness(value);
|
|
4247
|
-
break;
|
|
4248
|
-
case "contrast":
|
|
4249
|
-
m.contrast(value);
|
|
4250
|
-
break;
|
|
4251
|
-
case "invert":
|
|
4252
|
-
m.invert(value);
|
|
4253
|
-
break;
|
|
4254
|
-
case "sepia":
|
|
4255
|
-
m.sepia(value);
|
|
4256
|
-
break;
|
|
4257
|
-
case "opacity":
|
|
4258
|
-
m.opacity(value);
|
|
4259
|
-
break;
|
|
4260
|
-
case "grayscale":
|
|
4261
|
-
m.grayscale(value);
|
|
4262
|
-
break;
|
|
4263
|
-
}
|
|
4264
|
-
}
|
|
4265
|
-
return m;
|
|
4266
|
-
}
|
|
4267
|
-
|
|
4268
|
-
function parseCSSTransform(transform, width, height, output = new Transform2D()) {
|
|
4269
|
-
transform = !transform || transform === "none" ? "" : transform;
|
|
4270
|
-
parseCssFunctions(transform, { width, height }).reverse().forEach(({ name, args }) => {
|
|
4271
|
-
const values = args.map((arg) => arg.normalizedIntValue);
|
|
4272
|
-
switch (name) {
|
|
4273
|
-
case "translate":
|
|
4274
|
-
output.translate(values[0] * width, (values[1] ?? values[0]) * height);
|
|
4275
|
-
break;
|
|
4276
|
-
case "translateX":
|
|
4277
|
-
output.translateX(values[0] * width);
|
|
4278
|
-
break;
|
|
4279
|
-
case "translateY":
|
|
4280
|
-
output.translateY(values[0] * height);
|
|
4281
|
-
break;
|
|
4282
|
-
case "translateZ":
|
|
4283
|
-
output.translateZ(values[0]);
|
|
4284
|
-
break;
|
|
4285
|
-
case "translate3d":
|
|
4286
|
-
output.translate3d(
|
|
4287
|
-
values[0] * width,
|
|
4288
|
-
(values[1] ?? values[0]) * height,
|
|
4289
|
-
values[2] ?? values[1] ?? values[0]
|
|
4290
|
-
);
|
|
4291
|
-
break;
|
|
4292
|
-
case "scale":
|
|
4293
|
-
output.scale(values[0], values[1] ?? values[0]);
|
|
4294
|
-
break;
|
|
4295
|
-
case "scaleX":
|
|
4296
|
-
output.scaleX(values[0]);
|
|
4297
|
-
break;
|
|
4298
|
-
case "scaleY":
|
|
4299
|
-
output.scaleY(values[0]);
|
|
4300
|
-
break;
|
|
4301
|
-
case "scale3d":
|
|
4302
|
-
output.scale3d(values[0], values[1] ?? values[0], values[2] ?? values[1] ?? values[0]);
|
|
4303
|
-
break;
|
|
4304
|
-
case "rotate":
|
|
4305
|
-
output.rotate(values[0] * PI_2);
|
|
4306
|
-
break;
|
|
4307
|
-
case "rotateX":
|
|
4308
|
-
output.rotateX(values[0] * PI_2);
|
|
4309
|
-
break;
|
|
4310
|
-
case "rotateY":
|
|
4311
|
-
output.rotateY(values[0] * PI_2);
|
|
4312
|
-
break;
|
|
4313
|
-
case "rotateZ":
|
|
4314
|
-
output.rotateZ(values[0] * PI_2);
|
|
4315
|
-
break;
|
|
4316
|
-
case "rotate3d":
|
|
4317
|
-
output.rotate3d(
|
|
4318
|
-
values[0] * PI_2,
|
|
4319
|
-
(values[1] ?? values[0]) * PI_2,
|
|
4320
|
-
(values[2] ?? values[1] ?? values[0]) * PI_2,
|
|
4321
|
-
(values[3] ?? values[2] ?? values[1] ?? values[0]) * PI_2
|
|
4322
|
-
);
|
|
4323
|
-
break;
|
|
4324
|
-
case "skew":
|
|
4325
|
-
output.skew(values[0], values[0] ?? values[1]);
|
|
4326
|
-
break;
|
|
4327
|
-
case "skewX":
|
|
4328
|
-
output.skewX(values[0]);
|
|
4329
|
-
break;
|
|
4330
|
-
case "skewY":
|
|
4331
|
-
output.skewY(values[0]);
|
|
4332
|
-
break;
|
|
4333
|
-
case "matrix":
|
|
4334
|
-
output.set(values);
|
|
4335
|
-
break;
|
|
4336
|
-
}
|
|
4337
|
-
});
|
|
4338
|
-
return output;
|
|
4339
|
-
}
|
|
4340
|
-
|
|
4341
|
-
function parseCSSTransformOrigin(transformOrigin) {
|
|
4342
|
-
const [originX, originY = originX] = transformOrigin.split(" ");
|
|
4343
|
-
return [originX, originY].map((val) => {
|
|
4344
|
-
val = val.trim();
|
|
4345
|
-
switch (val) {
|
|
4346
|
-
case "left":
|
|
4347
|
-
case "top":
|
|
4348
|
-
return 0;
|
|
4349
|
-
case "center":
|
|
4350
|
-
return 0.5;
|
|
4351
|
-
case "right":
|
|
4352
|
-
case "bottom":
|
|
4353
|
-
return 1;
|
|
4354
|
-
default:
|
|
4355
|
-
return Number(val);
|
|
4356
|
-
}
|
|
4357
|
-
});
|
|
4358
|
-
}
|
|
4359
|
-
|
|
4360
4249
|
class Geometry extends Resource {
|
|
4361
4250
|
vertexAttributes;
|
|
4362
4251
|
indexBuffer;
|
|
@@ -4443,7 +4332,7 @@ class Geometry extends Resource {
|
|
|
4443
4332
|
}
|
|
4444
4333
|
|
|
4445
4334
|
var __defProp$P = Object.defineProperty;
|
|
4446
|
-
var __decorateClass$
|
|
4335
|
+
var __decorateClass$Y = (decorators, target, key, kind) => {
|
|
4447
4336
|
var result = void 0 ;
|
|
4448
4337
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4449
4338
|
if (decorator = decorators[i])
|
|
@@ -4492,15 +4381,15 @@ class IndexBuffer extends Resource {
|
|
|
4492
4381
|
return result;
|
|
4493
4382
|
}
|
|
4494
4383
|
}
|
|
4495
|
-
__decorateClass$
|
|
4384
|
+
__decorateClass$Y([
|
|
4496
4385
|
modernIdoc.property({ protected: true, default: null })
|
|
4497
4386
|
], IndexBuffer.prototype, "data");
|
|
4498
|
-
__decorateClass$
|
|
4387
|
+
__decorateClass$Y([
|
|
4499
4388
|
modernIdoc.property({ protected: true, fallback: false })
|
|
4500
4389
|
], IndexBuffer.prototype, "dynamic");
|
|
4501
4390
|
|
|
4502
4391
|
var __defProp$O = Object.defineProperty;
|
|
4503
|
-
var __decorateClass$
|
|
4392
|
+
var __decorateClass$X = (decorators, target, key, kind) => {
|
|
4504
4393
|
var result = void 0 ;
|
|
4505
4394
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4506
4395
|
if (decorator = decorators[i])
|
|
@@ -4549,15 +4438,15 @@ class VertexBuffer extends Resource {
|
|
|
4549
4438
|
return result;
|
|
4550
4439
|
}
|
|
4551
4440
|
}
|
|
4552
|
-
__decorateClass$
|
|
4441
|
+
__decorateClass$X([
|
|
4553
4442
|
modernIdoc.property({ protected: true, default: null })
|
|
4554
4443
|
], VertexBuffer.prototype, "data");
|
|
4555
|
-
__decorateClass$
|
|
4444
|
+
__decorateClass$X([
|
|
4556
4445
|
modernIdoc.property({ protected: true, fallback: false })
|
|
4557
4446
|
], VertexBuffer.prototype, "dynamic");
|
|
4558
4447
|
|
|
4559
4448
|
var __defProp$N = Object.defineProperty;
|
|
4560
|
-
var __decorateClass$
|
|
4449
|
+
var __decorateClass$W = (decorators, target, key, kind) => {
|
|
4561
4450
|
var result = void 0 ;
|
|
4562
4451
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4563
4452
|
if (decorator = decorators[i])
|
|
@@ -4596,25 +4485,25 @@ class VertexAttribute extends Resource {
|
|
|
4596
4485
|
return result;
|
|
4597
4486
|
}
|
|
4598
4487
|
}
|
|
4599
|
-
__decorateClass$
|
|
4488
|
+
__decorateClass$W([
|
|
4600
4489
|
modernIdoc.property({ protected: true })
|
|
4601
4490
|
], VertexAttribute.prototype, "buffer");
|
|
4602
|
-
__decorateClass$
|
|
4491
|
+
__decorateClass$W([
|
|
4603
4492
|
modernIdoc.property({ fallback: 0 })
|
|
4604
4493
|
], VertexAttribute.prototype, "size");
|
|
4605
|
-
__decorateClass$
|
|
4494
|
+
__decorateClass$W([
|
|
4606
4495
|
modernIdoc.property({ fallback: false })
|
|
4607
4496
|
], VertexAttribute.prototype, "normalized");
|
|
4608
|
-
__decorateClass$
|
|
4497
|
+
__decorateClass$W([
|
|
4609
4498
|
modernIdoc.property({ fallback: "float" })
|
|
4610
4499
|
], VertexAttribute.prototype, "type");
|
|
4611
|
-
__decorateClass$
|
|
4500
|
+
__decorateClass$W([
|
|
4612
4501
|
modernIdoc.property()
|
|
4613
4502
|
], VertexAttribute.prototype, "stride");
|
|
4614
|
-
__decorateClass$
|
|
4503
|
+
__decorateClass$W([
|
|
4615
4504
|
modernIdoc.property()
|
|
4616
4505
|
], VertexAttribute.prototype, "offset");
|
|
4617
|
-
__decorateClass$
|
|
4506
|
+
__decorateClass$W([
|
|
4618
4507
|
modernIdoc.property()
|
|
4619
4508
|
], VertexAttribute.prototype, "divisor");
|
|
4620
4509
|
|
|
@@ -4859,7 +4748,7 @@ class UvGeometry extends Geometry {
|
|
|
4859
4748
|
}
|
|
4860
4749
|
|
|
4861
4750
|
var __defProp$M = Object.defineProperty;
|
|
4862
|
-
var __decorateClass$
|
|
4751
|
+
var __decorateClass$V = (decorators, target, key, kind) => {
|
|
4863
4752
|
var result = void 0 ;
|
|
4864
4753
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4865
4754
|
if (decorator = decorators[i])
|
|
@@ -4990,22 +4879,22 @@ class Texture2D extends Resource {
|
|
|
4990
4879
|
}
|
|
4991
4880
|
}
|
|
4992
4881
|
}
|
|
4993
|
-
__decorateClass$
|
|
4882
|
+
__decorateClass$V([
|
|
4994
4883
|
modernIdoc.property({ protected: true })
|
|
4995
4884
|
], Texture2D.prototype, "source");
|
|
4996
|
-
__decorateClass$
|
|
4885
|
+
__decorateClass$V([
|
|
4997
4886
|
modernIdoc.property({ fallback: 0 })
|
|
4998
4887
|
], Texture2D.prototype, "width");
|
|
4999
|
-
__decorateClass$
|
|
4888
|
+
__decorateClass$V([
|
|
5000
4889
|
modernIdoc.property({ fallback: 0 })
|
|
5001
4890
|
], Texture2D.prototype, "height");
|
|
5002
|
-
__decorateClass$
|
|
4891
|
+
__decorateClass$V([
|
|
5003
4892
|
modernIdoc.property({ fallback: "linear" })
|
|
5004
4893
|
], Texture2D.prototype, "filterMode");
|
|
5005
|
-
__decorateClass$
|
|
4894
|
+
__decorateClass$V([
|
|
5006
4895
|
modernIdoc.property({ fallback: "clamp_to_edge" })
|
|
5007
4896
|
], Texture2D.prototype, "wrapMode");
|
|
5008
|
-
__decorateClass$
|
|
4897
|
+
__decorateClass$V([
|
|
5009
4898
|
modernIdoc.property({ fallback: 1 })
|
|
5010
4899
|
], Texture2D.prototype, "pixelRatio");
|
|
5011
4900
|
|
|
@@ -5036,7 +4925,7 @@ class AnimatedTexture extends Resource {
|
|
|
5036
4925
|
}
|
|
5037
4926
|
|
|
5038
4927
|
var __defProp$L = Object.defineProperty;
|
|
5039
|
-
var __decorateClass$
|
|
4928
|
+
var __decorateClass$U = (decorators, target, key, kind) => {
|
|
5040
4929
|
var result = void 0 ;
|
|
5041
4930
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5042
4931
|
if (decorator = decorators[i])
|
|
@@ -5060,7 +4949,7 @@ class CanvasTexture extends Texture2D {
|
|
|
5060
4949
|
super._updateProperty(key, value, oldValue, declaration);
|
|
5061
4950
|
}
|
|
5062
4951
|
}
|
|
5063
|
-
__decorateClass$
|
|
4952
|
+
__decorateClass$U([
|
|
5064
4953
|
modernIdoc.property({ fallback: 2 })
|
|
5065
4954
|
], CanvasTexture.prototype, "pixelRatio");
|
|
5066
4955
|
|
|
@@ -5281,7 +5170,7 @@ class PixelsTexture extends Texture2D {
|
|
|
5281
5170
|
}
|
|
5282
5171
|
|
|
5283
5172
|
var __defProp$K = Object.defineProperty;
|
|
5284
|
-
var __decorateClass$
|
|
5173
|
+
var __decorateClass$T = (decorators, target, key, kind) => {
|
|
5285
5174
|
var result = void 0 ;
|
|
5286
5175
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5287
5176
|
if (decorator = decorators[i])
|
|
@@ -5530,10 +5419,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
|
|
|
5530
5419
|
}
|
|
5531
5420
|
}
|
|
5532
5421
|
};
|
|
5533
|
-
__decorateClass$
|
|
5422
|
+
__decorateClass$T([
|
|
5534
5423
|
modernIdoc.property({ protected: true, fallback: true })
|
|
5535
5424
|
], _VideoTexture.prototype, "autoUpdate");
|
|
5536
|
-
__decorateClass$
|
|
5425
|
+
__decorateClass$T([
|
|
5537
5426
|
modernIdoc.property({ protected: true, fallback: 0 })
|
|
5538
5427
|
], _VideoTexture.prototype, "fps");
|
|
5539
5428
|
let VideoTexture = _VideoTexture;
|
|
@@ -5542,35 +5431,206 @@ class ViewportTexture extends PixelsTexture {
|
|
|
5542
5431
|
//
|
|
5543
5432
|
}
|
|
5544
5433
|
|
|
5545
|
-
class
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5434
|
+
class CanvasContext extends modernPath2d.Path2D {
|
|
5435
|
+
fillStyle;
|
|
5436
|
+
strokeStyle;
|
|
5437
|
+
lineCap;
|
|
5438
|
+
lineJoin;
|
|
5439
|
+
lineWidth;
|
|
5440
|
+
miterLimit;
|
|
5441
|
+
// custom
|
|
5442
|
+
uvTransform;
|
|
5443
|
+
vertTransform;
|
|
5444
|
+
_defaultStyle = Texture2D.EMPTY;
|
|
5445
|
+
_draws = [];
|
|
5446
|
+
_toTexture(source) {
|
|
5447
|
+
if (source instanceof Texture2D) {
|
|
5448
|
+
return source;
|
|
5449
|
+
} else {
|
|
5450
|
+
return ColorTexture.get(source);
|
|
5451
|
+
}
|
|
5558
5452
|
}
|
|
5559
|
-
|
|
5560
|
-
this.
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
break;
|
|
5453
|
+
stroke(options) {
|
|
5454
|
+
if (!this.curves.length) {
|
|
5455
|
+
return;
|
|
5456
|
+
}
|
|
5457
|
+
let strokeStyle = this.strokeStyle;
|
|
5458
|
+
if (!strokeStyle && this.style.stroke) {
|
|
5459
|
+
switch (typeof this.style.stroke) {
|
|
5460
|
+
case "string":
|
|
5461
|
+
strokeStyle = this.style.stroke;
|
|
5462
|
+
break;
|
|
5463
|
+
case "object":
|
|
5464
|
+
if (modernIdoc.isColorFillObject(this.style.stroke)) {
|
|
5465
|
+
strokeStyle = this.style.stroke.color;
|
|
5466
|
+
}
|
|
5467
|
+
break;
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
this._draws.push({
|
|
5471
|
+
...options,
|
|
5472
|
+
type: "stroke",
|
|
5473
|
+
path: new modernPath2d.Path2D(this),
|
|
5474
|
+
texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
|
|
5475
|
+
uvTransform: this.uvTransform,
|
|
5476
|
+
vertTransform: this.vertTransform,
|
|
5477
|
+
style: {
|
|
5478
|
+
alignment: 0.5,
|
|
5479
|
+
cap: this.lineCap ?? "butt",
|
|
5480
|
+
join: this.lineJoin ?? "miter",
|
|
5481
|
+
width: this.lineWidth ?? 1,
|
|
5482
|
+
miterLimit: this.miterLimit ?? 10
|
|
5483
|
+
}
|
|
5484
|
+
});
|
|
5485
|
+
super.reset();
|
|
5486
|
+
}
|
|
5487
|
+
fillRect(x, y, width, height) {
|
|
5488
|
+
this.rect(x, y, width, height).fill();
|
|
5489
|
+
}
|
|
5490
|
+
strokeRect(x, y, width, height) {
|
|
5491
|
+
this.rect(x, y, width, height).stroke();
|
|
5492
|
+
}
|
|
5493
|
+
fill(options) {
|
|
5494
|
+
if (!this.curves.length) {
|
|
5495
|
+
return;
|
|
5496
|
+
}
|
|
5497
|
+
let fillStyle = this.fillStyle;
|
|
5498
|
+
if (!fillStyle && this.style.fill) {
|
|
5499
|
+
switch (typeof this.style.fill) {
|
|
5500
|
+
case "string":
|
|
5501
|
+
fillStyle = this.style.fill;
|
|
5502
|
+
break;
|
|
5503
|
+
case "object":
|
|
5504
|
+
if (modernIdoc.isColorFillObject(this.style.fill)) {
|
|
5505
|
+
fillStyle = this.style.fill.color;
|
|
5506
|
+
}
|
|
5507
|
+
break;
|
|
5508
|
+
}
|
|
5509
|
+
}
|
|
5510
|
+
this._draws.push({
|
|
5511
|
+
...options,
|
|
5512
|
+
type: "fill",
|
|
5513
|
+
path: new modernPath2d.Path2D(this),
|
|
5514
|
+
texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
|
|
5515
|
+
uvTransform: this.uvTransform,
|
|
5516
|
+
vertTransform: this.vertTransform
|
|
5517
|
+
});
|
|
5518
|
+
super.reset();
|
|
5519
|
+
}
|
|
5520
|
+
copy(source) {
|
|
5521
|
+
super.copy(source);
|
|
5522
|
+
this.strokeStyle = source.strokeStyle;
|
|
5523
|
+
this.fillStyle = source.fillStyle;
|
|
5524
|
+
this.uvTransform = source.uvTransform;
|
|
5525
|
+
this.vertTransform = source.vertTransform;
|
|
5526
|
+
this.lineCap = source.lineCap;
|
|
5527
|
+
this.lineJoin = source.lineJoin;
|
|
5528
|
+
this.lineWidth = source.lineWidth;
|
|
5529
|
+
this.miterLimit = source.miterLimit;
|
|
5530
|
+
this._draws = source._draws.slice();
|
|
5531
|
+
return this;
|
|
5532
|
+
}
|
|
5533
|
+
reset() {
|
|
5534
|
+
super.reset();
|
|
5535
|
+
this.strokeStyle = void 0;
|
|
5536
|
+
this.fillStyle = void 0;
|
|
5537
|
+
this.uvTransform = void 0;
|
|
5538
|
+
this.vertTransform = void 0;
|
|
5539
|
+
this.lineCap = void 0;
|
|
5540
|
+
this.lineJoin = void 0;
|
|
5541
|
+
this.lineWidth = void 0;
|
|
5542
|
+
this.miterLimit = void 0;
|
|
5543
|
+
this._draws.length = 0;
|
|
5544
|
+
return this;
|
|
5545
|
+
}
|
|
5546
|
+
buildUvs(start, vertices, uvs, texture, uvTransform) {
|
|
5547
|
+
if (texture) {
|
|
5548
|
+
const _uvTransform = uvTransform ? typeof uvTransform === "function" ? uvTransform : (x, y) => uvTransform.applyToPoint(x, y) : uvTransform;
|
|
5549
|
+
const w = texture.width;
|
|
5550
|
+
const h = texture.height;
|
|
5551
|
+
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
5552
|
+
const x = vertices[i];
|
|
5553
|
+
const y = vertices[i + 1];
|
|
5554
|
+
let uvX;
|
|
5555
|
+
let uvY;
|
|
5556
|
+
if (_uvTransform) {
|
|
5557
|
+
[uvX, uvY] = _uvTransform(x, y);
|
|
5558
|
+
} else {
|
|
5559
|
+
[uvX, uvY] = [x / w, y / h];
|
|
5560
|
+
}
|
|
5561
|
+
uvs.push(uvX, uvY);
|
|
5562
|
+
}
|
|
5563
|
+
} else {
|
|
5564
|
+
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
5565
|
+
uvs.push(0, 0);
|
|
5566
|
+
}
|
|
5567
|
+
}
|
|
5568
|
+
}
|
|
5569
|
+
toBatchables() {
|
|
5570
|
+
const batchables = [];
|
|
5571
|
+
for (let len = this._draws.length, i = 0; i < len; i++) {
|
|
5572
|
+
const current = this._draws[i];
|
|
5573
|
+
const vertices = [];
|
|
5574
|
+
const indices = [];
|
|
5575
|
+
const uvs = [];
|
|
5576
|
+
if (current.type === "fill") {
|
|
5577
|
+
current.path.fillTriangulate({
|
|
5578
|
+
vertices,
|
|
5579
|
+
indices
|
|
5580
|
+
});
|
|
5581
|
+
} else {
|
|
5582
|
+
current.path.strokeTriangulate({
|
|
5583
|
+
vertices,
|
|
5584
|
+
indices,
|
|
5585
|
+
lineStyle: current.style,
|
|
5586
|
+
flipAlignment: false,
|
|
5587
|
+
closed: true
|
|
5588
|
+
});
|
|
5589
|
+
}
|
|
5590
|
+
this.buildUvs(0, vertices, uvs, current.texture, current.uvTransform);
|
|
5591
|
+
batchables.push({
|
|
5592
|
+
vertices,
|
|
5593
|
+
indices,
|
|
5594
|
+
uvs,
|
|
5595
|
+
texture: current.texture,
|
|
5596
|
+
type: current.type,
|
|
5597
|
+
disableWrapMode: current.disableWrapMode,
|
|
5598
|
+
vertTransform: current.vertTransform
|
|
5599
|
+
});
|
|
5600
|
+
}
|
|
5601
|
+
return batchables;
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
|
|
5605
|
+
class Children extends Array {
|
|
5606
|
+
front = [];
|
|
5607
|
+
back = [];
|
|
5608
|
+
get internal() {
|
|
5609
|
+
return [
|
|
5610
|
+
...this.front,
|
|
5611
|
+
...this,
|
|
5612
|
+
...this.back
|
|
5613
|
+
];
|
|
5614
|
+
}
|
|
5615
|
+
constructor(...items) {
|
|
5616
|
+
super();
|
|
5617
|
+
this.set(items);
|
|
5618
|
+
}
|
|
5619
|
+
set(items) {
|
|
5620
|
+
this.front.length = 0;
|
|
5621
|
+
this.length = 0;
|
|
5622
|
+
this.back.length = 0;
|
|
5623
|
+
items.forEach((item) => {
|
|
5624
|
+
switch (item.internalMode) {
|
|
5625
|
+
case "front":
|
|
5626
|
+
this.front.push(item);
|
|
5627
|
+
break;
|
|
5628
|
+
case "default":
|
|
5629
|
+
this.push(item);
|
|
5630
|
+
break;
|
|
5631
|
+
case "back":
|
|
5632
|
+
this.back.push(item);
|
|
5633
|
+
break;
|
|
5574
5634
|
}
|
|
5575
5635
|
});
|
|
5576
5636
|
return this;
|
|
@@ -5593,9 +5653,9 @@ class Children extends Array {
|
|
|
5593
5653
|
}
|
|
5594
5654
|
|
|
5595
5655
|
var __defProp$J = Object.defineProperty;
|
|
5596
|
-
var __getOwnPropDesc$
|
|
5597
|
-
var __decorateClass$
|
|
5598
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
5656
|
+
var __getOwnPropDesc$J = Object.getOwnPropertyDescriptor;
|
|
5657
|
+
var __decorateClass$S = (decorators, target, key, kind) => {
|
|
5658
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$J(target, key) : target;
|
|
5599
5659
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5600
5660
|
if (decorator = decorators[i])
|
|
5601
5661
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
@@ -5660,7 +5720,7 @@ exports.Node = class Node extends CoreObject {
|
|
|
5660
5720
|
return this._tree;
|
|
5661
5721
|
}
|
|
5662
5722
|
getViewport() {
|
|
5663
|
-
return this.
|
|
5723
|
+
return this.parent?.getViewport() ?? this.getWindow();
|
|
5664
5724
|
}
|
|
5665
5725
|
getWindow() {
|
|
5666
5726
|
return this._tree?.root;
|
|
@@ -6083,38 +6143,38 @@ exports.Node = class Node extends CoreObject {
|
|
|
6083
6143
|
return node;
|
|
6084
6144
|
}
|
|
6085
6145
|
};
|
|
6086
|
-
__decorateClass$
|
|
6146
|
+
__decorateClass$S([
|
|
6087
6147
|
modernIdoc.property({ fallback: modernIdoc.idGenerator() })
|
|
6088
6148
|
], exports.Node.prototype, "id", 2);
|
|
6089
|
-
__decorateClass$
|
|
6149
|
+
__decorateClass$S([
|
|
6090
6150
|
modernIdoc.property({ fallback: modernIdoc.idGenerator() })
|
|
6091
6151
|
], exports.Node.prototype, "name", 2);
|
|
6092
|
-
__decorateClass$
|
|
6152
|
+
__decorateClass$S([
|
|
6093
6153
|
modernIdoc.property({ fallback: "inherit" })
|
|
6094
6154
|
], exports.Node.prototype, "processMode", 2);
|
|
6095
|
-
__decorateClass$
|
|
6155
|
+
__decorateClass$S([
|
|
6096
6156
|
modernIdoc.property({ fallback: "default" })
|
|
6097
6157
|
], exports.Node.prototype, "processSortMode", 2);
|
|
6098
|
-
__decorateClass$
|
|
6158
|
+
__decorateClass$S([
|
|
6099
6159
|
modernIdoc.property({ fallback: "inherit" })
|
|
6100
6160
|
], exports.Node.prototype, "renderMode", 2);
|
|
6101
|
-
__decorateClass$
|
|
6161
|
+
__decorateClass$S([
|
|
6102
6162
|
modernIdoc.property({ fallback: "default" })
|
|
6103
6163
|
], exports.Node.prototype, "internalMode", 2);
|
|
6104
|
-
__decorateClass$
|
|
6164
|
+
__decorateClass$S([
|
|
6105
6165
|
modernIdoc.property({ default: () => ({}) })
|
|
6106
6166
|
], exports.Node.prototype, "meta", 2);
|
|
6107
|
-
__decorateClass$
|
|
6167
|
+
__decorateClass$S([
|
|
6108
6168
|
modernIdoc.property({ protected: true })
|
|
6109
6169
|
], exports.Node.prototype, "mask", 2);
|
|
6110
|
-
exports.Node = __decorateClass$
|
|
6170
|
+
exports.Node = __decorateClass$S([
|
|
6111
6171
|
customNode("Node")
|
|
6112
6172
|
], exports.Node);
|
|
6113
6173
|
|
|
6114
6174
|
var __defProp$I = Object.defineProperty;
|
|
6115
|
-
var __getOwnPropDesc$
|
|
6116
|
-
var __decorateClass$
|
|
6117
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6175
|
+
var __getOwnPropDesc$I = Object.getOwnPropertyDescriptor;
|
|
6176
|
+
var __decorateClass$R = (decorators, target, key, kind) => {
|
|
6177
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$I(target, key) : target;
|
|
6118
6178
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6119
6179
|
if (decorator = decorators[i])
|
|
6120
6180
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
@@ -6178,53 +6238,232 @@ exports.TimelineNode = class TimelineNode extends exports.Node {
|
|
|
6178
6238
|
this._updateCurrentTime();
|
|
6179
6239
|
}
|
|
6180
6240
|
};
|
|
6181
|
-
__decorateClass$
|
|
6241
|
+
__decorateClass$R([
|
|
6182
6242
|
modernIdoc.property({ fallback: 0 })
|
|
6183
6243
|
], exports.TimelineNode.prototype, "delay", 2);
|
|
6184
|
-
__decorateClass$
|
|
6244
|
+
__decorateClass$R([
|
|
6185
6245
|
modernIdoc.property({ fallback: 0 })
|
|
6186
6246
|
], exports.TimelineNode.prototype, "duration", 2);
|
|
6187
|
-
__decorateClass$
|
|
6247
|
+
__decorateClass$R([
|
|
6188
6248
|
modernIdoc.property({ fallback: false })
|
|
6189
6249
|
], exports.TimelineNode.prototype, "paused", 2);
|
|
6190
|
-
__decorateClass$
|
|
6250
|
+
__decorateClass$R([
|
|
6191
6251
|
modernIdoc.property({ protected: true, fallback: false })
|
|
6192
6252
|
], exports.TimelineNode.prototype, "insideTimeRange", 2);
|
|
6193
|
-
exports.TimelineNode = __decorateClass$
|
|
6253
|
+
exports.TimelineNode = __decorateClass$R([
|
|
6194
6254
|
customNode("TimelineNode")
|
|
6195
6255
|
], exports.TimelineNode);
|
|
6196
6256
|
|
|
6197
6257
|
var __defProp$H = Object.defineProperty;
|
|
6198
|
-
var __getOwnPropDesc$
|
|
6199
|
-
var __decorateClass$
|
|
6200
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6258
|
+
var __getOwnPropDesc$H = Object.getOwnPropertyDescriptor;
|
|
6259
|
+
var __decorateClass$Q = (decorators, target, key, kind) => {
|
|
6260
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$H(target, key) : target;
|
|
6201
6261
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6202
6262
|
if (decorator = decorators[i])
|
|
6203
6263
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6204
6264
|
if (kind && result) __defProp$H(target, key, result);
|
|
6205
6265
|
return result;
|
|
6206
6266
|
};
|
|
6207
|
-
exports.
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
this.
|
|
6267
|
+
exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
|
|
6268
|
+
_parentGlobalVisible;
|
|
6269
|
+
_globalVisible;
|
|
6270
|
+
get globalVisible() {
|
|
6271
|
+
return this._globalVisible ?? true;
|
|
6212
6272
|
}
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
{ texture: new ViewportTexture(), needsUpload: false }
|
|
6218
|
-
];
|
|
6219
|
-
get valid() {
|
|
6220
|
-
return Boolean(this.width && this.height);
|
|
6273
|
+
_parentGlobalOpacity;
|
|
6274
|
+
_globalOpacity;
|
|
6275
|
+
get globalOpacity() {
|
|
6276
|
+
return this._globalOpacity ?? 1;
|
|
6221
6277
|
}
|
|
6222
|
-
|
|
6223
|
-
|
|
6278
|
+
_modulate = new Color(4294967295);
|
|
6279
|
+
// Batch render
|
|
6280
|
+
context = new CanvasContext();
|
|
6281
|
+
_resetContext = true;
|
|
6282
|
+
_redrawing = true;
|
|
6283
|
+
_relayouting = false;
|
|
6284
|
+
_repainting = false;
|
|
6285
|
+
_originalBatchables = [];
|
|
6286
|
+
_layoutedBatchables = [];
|
|
6287
|
+
_batchables = [];
|
|
6288
|
+
constructor(properties, nodes = []) {
|
|
6289
|
+
super();
|
|
6290
|
+
this.setProperties(properties).append(nodes);
|
|
6291
|
+
}
|
|
6292
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
6293
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
6294
|
+
switch (key) {
|
|
6295
|
+
case "modulate":
|
|
6296
|
+
this._modulate.value = value;
|
|
6297
|
+
this.requestRepaint();
|
|
6298
|
+
break;
|
|
6299
|
+
case "blendMode":
|
|
6300
|
+
this.requestRepaint();
|
|
6301
|
+
break;
|
|
6302
|
+
case "opacity":
|
|
6303
|
+
this._updateGlobalOpacity();
|
|
6304
|
+
break;
|
|
6305
|
+
case "visible":
|
|
6306
|
+
case "insideTimeRange":
|
|
6307
|
+
this._updateGlobalVisible();
|
|
6308
|
+
break;
|
|
6309
|
+
}
|
|
6310
|
+
}
|
|
6311
|
+
show() {
|
|
6312
|
+
this.visible = true;
|
|
6313
|
+
}
|
|
6314
|
+
hide() {
|
|
6315
|
+
this.visible = false;
|
|
6316
|
+
}
|
|
6317
|
+
isVisibleInTree() {
|
|
6318
|
+
return this.globalOpacity > 0 && this.globalVisible;
|
|
6319
|
+
}
|
|
6320
|
+
canRender() {
|
|
6321
|
+
return super.canRender() && this.isVisibleInTree();
|
|
6322
|
+
}
|
|
6323
|
+
requestRedraw() {
|
|
6324
|
+
this._redrawing = true;
|
|
6325
|
+
}
|
|
6326
|
+
requestRelayout() {
|
|
6327
|
+
this._relayouting = true;
|
|
6328
|
+
}
|
|
6329
|
+
requestRepaint() {
|
|
6330
|
+
this._repainting = true;
|
|
6331
|
+
}
|
|
6332
|
+
_updateGlobalVisible() {
|
|
6333
|
+
this._parentGlobalVisible = this.getParent()?.globalVisible;
|
|
6334
|
+
this._globalVisible = (this._parentGlobalVisible ?? true) && this.visible && this.insideTimeRange;
|
|
6335
|
+
}
|
|
6336
|
+
_updateGlobalOpacity() {
|
|
6337
|
+
this._parentGlobalOpacity = this.getParent()?.opacity;
|
|
6338
|
+
const globalOpacity = clamp(0, this.opacity, 1) * (this._parentGlobalOpacity ?? 1);
|
|
6339
|
+
if (this._globalOpacity !== globalOpacity) {
|
|
6340
|
+
this._globalOpacity = globalOpacity;
|
|
6341
|
+
this.requestRepaint();
|
|
6342
|
+
}
|
|
6343
|
+
}
|
|
6344
|
+
_draw() {
|
|
6345
|
+
this.emit("draw");
|
|
6346
|
+
}
|
|
6347
|
+
_redraw() {
|
|
6348
|
+
this.log(this.name, "drawing");
|
|
6349
|
+
this._draw();
|
|
6350
|
+
return this.context.toBatchables();
|
|
6351
|
+
}
|
|
6352
|
+
_relayout(batchables) {
|
|
6353
|
+
this.log(this.name, "layouting");
|
|
6354
|
+
return batchables;
|
|
6355
|
+
}
|
|
6356
|
+
_repaint(batchables) {
|
|
6357
|
+
this.log(this.name, "painting");
|
|
6358
|
+
return batchables.map((batchable) => {
|
|
6359
|
+
return {
|
|
6360
|
+
...batchable,
|
|
6361
|
+
modulate: this._modulate.toArgb(this.globalOpacity, true),
|
|
6362
|
+
blendMode: this.blendMode
|
|
6363
|
+
};
|
|
6364
|
+
});
|
|
6365
|
+
}
|
|
6366
|
+
_process(delta) {
|
|
6367
|
+
super._process(delta);
|
|
6368
|
+
const parent = this.getParent();
|
|
6369
|
+
if (this._parentGlobalVisible !== parent?.globalVisible) {
|
|
6370
|
+
this._updateGlobalVisible();
|
|
6371
|
+
}
|
|
6372
|
+
if (this._parentGlobalOpacity !== parent?.globalOpacity) {
|
|
6373
|
+
this._updateGlobalOpacity();
|
|
6374
|
+
}
|
|
6375
|
+
}
|
|
6376
|
+
_updateBatchables() {
|
|
6377
|
+
const redrawing = this._redrawing;
|
|
6378
|
+
let relayouting = this._relayouting;
|
|
6379
|
+
let repainting = this._repainting;
|
|
6380
|
+
let batchables;
|
|
6381
|
+
if (redrawing) {
|
|
6382
|
+
this._originalBatchables = this._redraw();
|
|
6383
|
+
relayouting = true;
|
|
6384
|
+
}
|
|
6385
|
+
if (relayouting) {
|
|
6386
|
+
this._layoutedBatchables = this._relayout(this._originalBatchables);
|
|
6387
|
+
repainting = true;
|
|
6388
|
+
}
|
|
6389
|
+
if (repainting) {
|
|
6390
|
+
batchables = this._repaint(this._layoutedBatchables);
|
|
6391
|
+
}
|
|
6392
|
+
if (redrawing) {
|
|
6393
|
+
if (this._resetContext) {
|
|
6394
|
+
this.context.reset();
|
|
6395
|
+
}
|
|
6396
|
+
}
|
|
6397
|
+
if (batchables) {
|
|
6398
|
+
this._batchables = batchables;
|
|
6399
|
+
this._redrawing = false;
|
|
6400
|
+
this._relayouting = false;
|
|
6401
|
+
this._repainting = false;
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6404
|
+
_render(renderer) {
|
|
6405
|
+
this._updateBatchables();
|
|
6406
|
+
this._batchables.forEach((batchable) => {
|
|
6407
|
+
batchable.texture?.upload(renderer);
|
|
6408
|
+
renderer.batch2D.render({
|
|
6409
|
+
...batchable,
|
|
6410
|
+
texture: batchable.texture?._glTexture(renderer)
|
|
6411
|
+
});
|
|
6412
|
+
});
|
|
6413
|
+
super._render(renderer);
|
|
6414
|
+
}
|
|
6415
|
+
};
|
|
6416
|
+
__decorateClass$Q([
|
|
6417
|
+
modernIdoc.property()
|
|
6418
|
+
], exports.CanvasItem.prototype, "modulate", 2);
|
|
6419
|
+
__decorateClass$Q([
|
|
6420
|
+
modernIdoc.property()
|
|
6421
|
+
], exports.CanvasItem.prototype, "blendMode", 2);
|
|
6422
|
+
__decorateClass$Q([
|
|
6423
|
+
modernIdoc.property({ protected: true, fallback: true })
|
|
6424
|
+
], exports.CanvasItem.prototype, "visible", 2);
|
|
6425
|
+
__decorateClass$Q([
|
|
6426
|
+
modernIdoc.property({ protected: true, fallback: 1 })
|
|
6427
|
+
], exports.CanvasItem.prototype, "opacity", 2);
|
|
6428
|
+
exports.CanvasItem = __decorateClass$Q([
|
|
6429
|
+
customNode("CanvasItem")
|
|
6430
|
+
], exports.CanvasItem);
|
|
6431
|
+
|
|
6432
|
+
var __defProp$G = Object.defineProperty;
|
|
6433
|
+
var __getOwnPropDesc$G = Object.getOwnPropertyDescriptor;
|
|
6434
|
+
var __decorateClass$P = (decorators, target, key, kind) => {
|
|
6435
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$G(target, key) : target;
|
|
6436
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6437
|
+
if (decorator = decorators[i])
|
|
6438
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6439
|
+
if (kind && result) __defProp$G(target, key, result);
|
|
6440
|
+
return result;
|
|
6441
|
+
};
|
|
6442
|
+
exports.Viewport = class Viewport extends exports.Node {
|
|
6443
|
+
constructor(flipY = false) {
|
|
6444
|
+
super();
|
|
6445
|
+
this.flipY = flipY;
|
|
6446
|
+
this.projection.flipY(flipY);
|
|
6447
|
+
}
|
|
6448
|
+
projection = new Projection2D();
|
|
6449
|
+
canvasTransform = new Transform2D();
|
|
6450
|
+
_framebufferIndex = 0;
|
|
6451
|
+
_framebuffers = [
|
|
6452
|
+
{ texture: new ViewportTexture(), needsUpload: false },
|
|
6453
|
+
{ texture: new ViewportTexture(), needsUpload: false }
|
|
6454
|
+
];
|
|
6455
|
+
get valid() {
|
|
6456
|
+
return Boolean(this.width && this.height);
|
|
6457
|
+
}
|
|
6458
|
+
get framebuffer() {
|
|
6459
|
+
return this._framebuffers[this._framebufferIndex];
|
|
6224
6460
|
}
|
|
6225
6461
|
get texture() {
|
|
6226
6462
|
return this.framebuffer.texture;
|
|
6227
6463
|
}
|
|
6464
|
+
getViewport() {
|
|
6465
|
+
return this;
|
|
6466
|
+
}
|
|
6228
6467
|
/** @internal */
|
|
6229
6468
|
_glFramebufferOptions(renderer) {
|
|
6230
6469
|
const { width, height } = this;
|
|
@@ -6256,13 +6495,13 @@ exports.Viewport = class Viewport extends exports.Node {
|
|
|
6256
6495
|
case "x":
|
|
6257
6496
|
case "y":
|
|
6258
6497
|
this.requestUpload();
|
|
6259
|
-
this.
|
|
6498
|
+
this.projection.translate(this.x, this.y);
|
|
6260
6499
|
this.emit("updateRect");
|
|
6261
6500
|
break;
|
|
6262
6501
|
case "width":
|
|
6263
6502
|
case "height":
|
|
6264
6503
|
this.requestUpload();
|
|
6265
|
-
this.
|
|
6504
|
+
this.projection.resize(this.width, this.height);
|
|
6266
6505
|
this.emit("updateRect");
|
|
6267
6506
|
break;
|
|
6268
6507
|
}
|
|
@@ -6321,6 +6560,8 @@ exports.Viewport = class Viewport extends exports.Node {
|
|
|
6321
6560
|
}
|
|
6322
6561
|
render(renderer, next) {
|
|
6323
6562
|
const oldViewport = this._tree?.getCurrentViewport();
|
|
6563
|
+
renderer.program.uniforms.projectionMatrix = this.projection.toArray(true);
|
|
6564
|
+
renderer.program.uniforms.worldTransformMatrix = this.canvasTransform.toArray(true);
|
|
6324
6565
|
this.activate(renderer);
|
|
6325
6566
|
renderer.clear();
|
|
6326
6567
|
super.render(renderer, next);
|
|
@@ -6335,9 +6576,6 @@ exports.Viewport = class Viewport extends exports.Node {
|
|
|
6335
6576
|
getRect() {
|
|
6336
6577
|
return new Rect2(this.x, this.y, this.width, this.height);
|
|
6337
6578
|
}
|
|
6338
|
-
toProjectionArray(transpose = false) {
|
|
6339
|
-
return this._projection.toArray(transpose);
|
|
6340
|
-
}
|
|
6341
6579
|
};
|
|
6342
6580
|
__decorateClass$P([
|
|
6343
6581
|
modernIdoc.property({ fallback: 0 })
|
|
@@ -6355,14 +6593,14 @@ exports.Viewport = __decorateClass$P([
|
|
|
6355
6593
|
customNode("Viewport")
|
|
6356
6594
|
], exports.Viewport);
|
|
6357
6595
|
|
|
6358
|
-
var __defProp$
|
|
6596
|
+
var __defProp$F = Object.defineProperty;
|
|
6359
6597
|
var __getOwnPropDesc$F = Object.getOwnPropertyDescriptor;
|
|
6360
6598
|
var __decorateClass$O = (decorators, target, key, kind) => {
|
|
6361
6599
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$F(target, key) : target;
|
|
6362
6600
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6363
6601
|
if (decorator = decorators[i])
|
|
6364
6602
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6365
|
-
if (kind && result) __defProp$
|
|
6603
|
+
if (kind && result) __defProp$F(target, key, result);
|
|
6366
6604
|
return result;
|
|
6367
6605
|
};
|
|
6368
6606
|
exports.Effect = class Effect extends exports.TimelineNode {
|
|
@@ -6620,295 +6858,228 @@ exports.Effect = __decorateClass$O([
|
|
|
6620
6858
|
customNode("Effect")
|
|
6621
6859
|
], exports.Effect);
|
|
6622
6860
|
|
|
6623
|
-
|
|
6861
|
+
class RenderStack {
|
|
6862
|
+
currentCall;
|
|
6863
|
+
calls = [];
|
|
6864
|
+
createCall(renderable) {
|
|
6865
|
+
return {
|
|
6866
|
+
renderable,
|
|
6867
|
+
parentCall: this.currentCall,
|
|
6868
|
+
fn: renderable.render.bind(renderable),
|
|
6869
|
+
calls: []
|
|
6870
|
+
};
|
|
6871
|
+
}
|
|
6872
|
+
push(renderable) {
|
|
6873
|
+
const call = this.createCall(renderable);
|
|
6874
|
+
(this.currentCall?.calls ?? this.calls).push(call);
|
|
6875
|
+
return call;
|
|
6876
|
+
}
|
|
6877
|
+
render(renderer) {
|
|
6878
|
+
this.calls.forEach(function render(call) {
|
|
6879
|
+
call.fn(renderer, () => {
|
|
6880
|
+
call.calls.forEach(render);
|
|
6881
|
+
});
|
|
6882
|
+
});
|
|
6883
|
+
this.calls = [];
|
|
6884
|
+
}
|
|
6885
|
+
}
|
|
6886
|
+
|
|
6887
|
+
var __defProp$E = Object.defineProperty;
|
|
6624
6888
|
var __getOwnPropDesc$E = Object.getOwnPropertyDescriptor;
|
|
6625
|
-
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6626
6889
|
var __decorateClass$N = (decorators, target, key, kind) => {
|
|
6627
6890
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$E(target, key) : target;
|
|
6628
6891
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6629
6892
|
if (decorator = decorators[i])
|
|
6630
6893
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6631
|
-
if (kind && result) __defProp$
|
|
6894
|
+
if (kind && result) __defProp$E(target, key, result);
|
|
6632
6895
|
return result;
|
|
6633
6896
|
};
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6897
|
+
exports.Timeline = class Timeline extends exports.Node {
|
|
6898
|
+
static from(range, loop = false) {
|
|
6899
|
+
const [startTime, endTime] = range ? Array.isArray(range) ? range : [0, range] : [];
|
|
6900
|
+
return new exports.Timeline({
|
|
6901
|
+
startTime,
|
|
6902
|
+
endTime,
|
|
6903
|
+
loop
|
|
6904
|
+
});
|
|
6905
|
+
}
|
|
6906
|
+
constructor(properties) {
|
|
6637
6907
|
super();
|
|
6638
|
-
this.setProperties(properties)
|
|
6908
|
+
this.setProperties(properties);
|
|
6639
6909
|
}
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
alpha: this.alpha,
|
|
6651
|
-
gamma: Math.max(this.gamma ?? 1, 1e-4)
|
|
6652
|
-
});
|
|
6653
|
-
});
|
|
6910
|
+
_updateProperty(key, value, oldValue) {
|
|
6911
|
+
super._updateProperty(key, value, oldValue);
|
|
6912
|
+
switch (key) {
|
|
6913
|
+
case "startTime":
|
|
6914
|
+
this.startTime = Math.min(value, this.endTime);
|
|
6915
|
+
break;
|
|
6916
|
+
case "endTime":
|
|
6917
|
+
this.endTime = value || Number.MAX_SAFE_INTEGER;
|
|
6918
|
+
break;
|
|
6919
|
+
}
|
|
6654
6920
|
}
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
uniform float gamma;
|
|
6668
|
-
uniform float contrast;
|
|
6669
|
-
uniform float saturation;
|
|
6670
|
-
uniform float brightness;
|
|
6671
|
-
uniform float red;
|
|
6672
|
-
uniform float green;
|
|
6673
|
-
uniform float blue;
|
|
6674
|
-
uniform float alpha;
|
|
6675
|
-
|
|
6676
|
-
void main(void) {
|
|
6677
|
-
vec4 c = texture2D(sampler, vUv);
|
|
6678
|
-
if (c.a > 0.0) {
|
|
6679
|
-
c.rgb /= c.a;
|
|
6680
|
-
vec3 rgb = pow(c.rgb, vec3(1. / gamma));
|
|
6681
|
-
rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);
|
|
6682
|
-
rgb.r *= red;
|
|
6683
|
-
rgb.g *= green;
|
|
6684
|
-
rgb.b *= blue;
|
|
6685
|
-
c.rgb = rgb * brightness;
|
|
6686
|
-
c.rgb *= c.a;
|
|
6921
|
+
addTime(delta) {
|
|
6922
|
+
const start = this.startTime;
|
|
6923
|
+
const end = this.endTime;
|
|
6924
|
+
let current = this.currentTime;
|
|
6925
|
+
current = current + delta;
|
|
6926
|
+
if (this.loop && current > end) {
|
|
6927
|
+
current = start + current % end;
|
|
6928
|
+
}
|
|
6929
|
+
current = clamp(start, current, end);
|
|
6930
|
+
this.currentTime = current;
|
|
6931
|
+
this.emit("updateCurrentTime", current, delta);
|
|
6932
|
+
return this;
|
|
6687
6933
|
}
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
], exports.ColorAdjustEffect.prototype, "saturation", 2);
|
|
6694
|
-
__decorateClass$N([
|
|
6695
|
-
modernIdoc.property()
|
|
6696
|
-
], exports.ColorAdjustEffect.prototype, "contrast", 2);
|
|
6697
|
-
__decorateClass$N([
|
|
6698
|
-
modernIdoc.property()
|
|
6699
|
-
], exports.ColorAdjustEffect.prototype, "brightness", 2);
|
|
6700
|
-
__decorateClass$N([
|
|
6701
|
-
modernIdoc.property()
|
|
6702
|
-
], exports.ColorAdjustEffect.prototype, "red", 2);
|
|
6934
|
+
_process(delta) {
|
|
6935
|
+
super._process(delta);
|
|
6936
|
+
this.addTime(delta);
|
|
6937
|
+
}
|
|
6938
|
+
};
|
|
6703
6939
|
__decorateClass$N([
|
|
6704
|
-
modernIdoc.property()
|
|
6705
|
-
], exports.
|
|
6940
|
+
modernIdoc.property({ fallback: 0 })
|
|
6941
|
+
], exports.Timeline.prototype, "startTime", 2);
|
|
6706
6942
|
__decorateClass$N([
|
|
6707
|
-
modernIdoc.property()
|
|
6708
|
-
], exports.
|
|
6943
|
+
modernIdoc.property({ fallback: 0 })
|
|
6944
|
+
], exports.Timeline.prototype, "currentTime", 2);
|
|
6709
6945
|
__decorateClass$N([
|
|
6710
|
-
modernIdoc.property()
|
|
6711
|
-
], exports.
|
|
6946
|
+
modernIdoc.property({ fallback: Number.MAX_SAFE_INTEGER })
|
|
6947
|
+
], exports.Timeline.prototype, "endTime", 2);
|
|
6712
6948
|
__decorateClass$N([
|
|
6713
|
-
modernIdoc.property()
|
|
6714
|
-
], exports.
|
|
6715
|
-
exports.
|
|
6716
|
-
customNode("
|
|
6717
|
-
], exports.
|
|
6949
|
+
modernIdoc.property({ fallback: false })
|
|
6950
|
+
], exports.Timeline.prototype, "loop", 2);
|
|
6951
|
+
exports.Timeline = __decorateClass$N([
|
|
6952
|
+
customNode("Timeline")
|
|
6953
|
+
], exports.Timeline);
|
|
6718
6954
|
|
|
6719
|
-
var __defProp$E = Object.defineProperty;
|
|
6720
6955
|
var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
|
|
6721
|
-
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6722
6956
|
var __decorateClass$M = (decorators, target, key, kind) => {
|
|
6723
6957
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$D(target, key) : target;
|
|
6724
6958
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6725
6959
|
if (decorator = decorators[i])
|
|
6726
|
-
result = (
|
|
6727
|
-
if (kind && result) __defProp$E(target, key, result);
|
|
6960
|
+
result = (decorator(result)) || result;
|
|
6728
6961
|
return result;
|
|
6729
6962
|
};
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6963
|
+
exports.Window = class Window extends exports.Viewport {
|
|
6964
|
+
//
|
|
6965
|
+
};
|
|
6966
|
+
exports.Window = __decorateClass$M([
|
|
6967
|
+
customNode("Window")
|
|
6968
|
+
], exports.Window);
|
|
6969
|
+
|
|
6970
|
+
var __defProp$D = Object.defineProperty;
|
|
6971
|
+
var __decorateClass$L = (decorators, target, key, kind) => {
|
|
6972
|
+
var result = void 0 ;
|
|
6973
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6974
|
+
if (decorator = decorators[i])
|
|
6975
|
+
result = (decorator(target, key, result) ) || result;
|
|
6976
|
+
if (result) __defProp$D(target, key, result);
|
|
6977
|
+
return result;
|
|
6978
|
+
};
|
|
6979
|
+
class SceneTree extends MainLoop {
|
|
6980
|
+
input = new Input();
|
|
6981
|
+
renderStack = new RenderStack();
|
|
6982
|
+
root = new exports.Window(true).setTree(this);
|
|
6983
|
+
timeline;
|
|
6984
|
+
_backgroundColor = new Color();
|
|
6985
|
+
_currentViewport;
|
|
6986
|
+
getCurrentViewport() {
|
|
6987
|
+
return this._currentViewport;
|
|
6988
|
+
}
|
|
6989
|
+
setCurrentViewport(viewport) {
|
|
6990
|
+
this._currentViewport = viewport;
|
|
6991
|
+
}
|
|
6992
|
+
constructor(timeline = new exports.Timeline()) {
|
|
6734
6993
|
super();
|
|
6735
|
-
this.
|
|
6994
|
+
this.timeline = timeline.setTree(this);
|
|
6736
6995
|
}
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
}
|
|
6771
|
-
});
|
|
6772
|
-
source.redraw(renderer, () => {
|
|
6773
|
-
QuadUvGeometry.draw(renderer, exports.ColorFilterEffect.material, {
|
|
6774
|
-
sampler: 0,
|
|
6775
|
-
m: matrix.toArray()
|
|
6776
|
-
});
|
|
6996
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
6997
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
6998
|
+
switch (key) {
|
|
6999
|
+
case "backgroundColor":
|
|
7000
|
+
this._backgroundColor.value = value;
|
|
7001
|
+
break;
|
|
7002
|
+
}
|
|
7003
|
+
}
|
|
7004
|
+
log(...args) {
|
|
7005
|
+
if (this.debug) {
|
|
7006
|
+
console.log(`[modern-canvas][${performance.now().toFixed(4)}ms]`, ...args);
|
|
7007
|
+
}
|
|
7008
|
+
}
|
|
7009
|
+
_process(delta = 0) {
|
|
7010
|
+
this.timeline.emit("process", delta);
|
|
7011
|
+
this.emit("processing");
|
|
7012
|
+
this.root.emit("process", delta);
|
|
7013
|
+
this.emit("processed");
|
|
7014
|
+
}
|
|
7015
|
+
_render(renderer) {
|
|
7016
|
+
this.emit("rendering");
|
|
7017
|
+
this.renderStack.render(renderer);
|
|
7018
|
+
this._renderScreen(renderer);
|
|
7019
|
+
this.emit("rendered");
|
|
7020
|
+
}
|
|
7021
|
+
_renderScreen(renderer) {
|
|
7022
|
+
renderer.state.reset();
|
|
7023
|
+
renderer.framebuffer.bind(null);
|
|
7024
|
+
renderer.viewport.bind({
|
|
7025
|
+
x: 0,
|
|
7026
|
+
y: 0,
|
|
7027
|
+
width: this.root.width * renderer.pixelRatio,
|
|
7028
|
+
height: this.root.height * renderer.pixelRatio
|
|
6777
7029
|
});
|
|
7030
|
+
if (this.backgroundColor) {
|
|
7031
|
+
renderer.gl.clearColor(...this._backgroundColor.toArray());
|
|
7032
|
+
}
|
|
7033
|
+
renderer.clear();
|
|
7034
|
+
if (this.backgroundColor) {
|
|
7035
|
+
renderer.gl.clearColor(0, 0, 0, 0);
|
|
7036
|
+
}
|
|
7037
|
+
const texture = this.root.texture;
|
|
7038
|
+
texture.activate(renderer, 0);
|
|
7039
|
+
QuadUvGeometry.draw(renderer);
|
|
7040
|
+
renderer.texture.unbind(texture);
|
|
6778
7041
|
}
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
attribute vec2 uv;
|
|
6784
|
-
varying vec2 vUv;
|
|
6785
|
-
void main() {
|
|
6786
|
-
gl_Position = vec4(position, 0.0, 1.0);
|
|
6787
|
-
vUv = uv;
|
|
6788
|
-
}`,
|
|
6789
|
-
frag: `precision highp float;
|
|
6790
|
-
varying vec2 vUv;
|
|
6791
|
-
uniform sampler2D sampler;
|
|
6792
|
-
uniform float m[20];
|
|
6793
|
-
|
|
6794
|
-
void main(void) {
|
|
6795
|
-
vec4 c = texture2D(sampler, vUv);
|
|
6796
|
-
if (c.a > 0.0) {
|
|
6797
|
-
c.rgb /= c.a;
|
|
7042
|
+
free() {
|
|
7043
|
+
super.free();
|
|
7044
|
+
this.root.children.internal.forEach((node) => this.root.removeChild(node));
|
|
7045
|
+
this.input.removeEventListeners();
|
|
6798
7046
|
}
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
);
|
|
6805
|
-
}`
|
|
6806
|
-
}));
|
|
6807
|
-
__decorateClass$M([
|
|
7047
|
+
}
|
|
7048
|
+
__decorateClass$L([
|
|
7049
|
+
modernIdoc.property({ fallback: false })
|
|
7050
|
+
], SceneTree.prototype, "processPaused");
|
|
7051
|
+
__decorateClass$L([
|
|
6808
7052
|
modernIdoc.property()
|
|
6809
|
-
],
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
],
|
|
7053
|
+
], SceneTree.prototype, "backgroundColor");
|
|
7054
|
+
__decorateClass$L([
|
|
7055
|
+
modernIdoc.property({ protected: true, fallback: false })
|
|
7056
|
+
], SceneTree.prototype, "debug");
|
|
6813
7057
|
|
|
6814
|
-
var __defProp$D = Object.defineProperty;
|
|
6815
7058
|
var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
|
|
6816
|
-
var
|
|
6817
|
-
var __decorateClass$L = (decorators, target, key, kind) => {
|
|
7059
|
+
var __decorateClass$K = (decorators, target, key, kind) => {
|
|
6818
7060
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$C(target, key) : target;
|
|
6819
7061
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6820
7062
|
if (decorator = decorators[i])
|
|
6821
|
-
result = (
|
|
6822
|
-
if (kind && result) __defProp$D(target, key, result);
|
|
7063
|
+
result = (decorator(result)) || result;
|
|
6823
7064
|
return result;
|
|
6824
7065
|
};
|
|
6825
|
-
|
|
6826
|
-
const MAX_COLORS$1 = 50;
|
|
6827
|
-
exports.ColorOverlayEffect = class ColorOverlayEffect extends exports.Effect {
|
|
6828
|
-
_color = new Color();
|
|
7066
|
+
exports.Transition = class Transition extends exports.Effect {
|
|
6829
7067
|
constructor(properties, children = []) {
|
|
6830
7068
|
super();
|
|
6831
7069
|
this.setProperties(properties).append(children);
|
|
6832
7070
|
}
|
|
6833
|
-
apply(renderer, source) {
|
|
6834
|
-
source.redraw(renderer, () => {
|
|
6835
|
-
const colors = this.colors.map((val) => {
|
|
6836
|
-
this._color.value = val;
|
|
6837
|
-
const rgba = this._color.toArray();
|
|
6838
|
-
rgba[3] = this.alpha;
|
|
6839
|
-
return rgba;
|
|
6840
|
-
});
|
|
6841
|
-
while (colors.length < MAX_COLORS$1) {
|
|
6842
|
-
colors.push([0, 0, 0, 0]);
|
|
6843
|
-
}
|
|
6844
|
-
QuadUvGeometry.draw(renderer, exports.ColorOverlayEffect.material, {
|
|
6845
|
-
sampler: 0,
|
|
6846
|
-
colors: colors.slice(0, MAX_COLORS$1).flatMap((item) => item)
|
|
6847
|
-
});
|
|
6848
|
-
});
|
|
6849
|
-
}
|
|
6850
7071
|
};
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
vUv = uv;
|
|
6859
|
-
}`,
|
|
6860
|
-
frag: `precision mediump float;
|
|
6861
|
-
uniform sampler2D sampler;
|
|
6862
|
-
uniform vec4 colors[${MAX_COLORS$1}];
|
|
6863
|
-
varying vec2 vUv;
|
|
6864
|
-
|
|
6865
|
-
float calcWidth() {
|
|
6866
|
-
return distance(vec2(0, 0), vec2(1, 0));
|
|
6867
|
-
}
|
|
6868
|
-
|
|
6869
|
-
int calcCount() {
|
|
6870
|
-
int count = 0;
|
|
6871
|
-
for (int i = 0; i < ${MAX_COLORS$1}; i++) {
|
|
6872
|
-
if (colors[i] != vec4(0,0,0,0)){
|
|
6873
|
-
count++;
|
|
6874
|
-
}
|
|
6875
|
-
}
|
|
6876
|
-
return count;
|
|
6877
|
-
}
|
|
6878
|
-
|
|
6879
|
-
vec4 calcColor(float x) {
|
|
6880
|
-
float perUnit = calcWidth() / float(calcCount());
|
|
6881
|
-
int index = int(x / perUnit);
|
|
6882
|
-
|
|
6883
|
-
for(int i=0; i<${MAX_COLORS$1}; i++){
|
|
6884
|
-
if(i==index){
|
|
6885
|
-
return colors[i];
|
|
6886
|
-
}
|
|
6887
|
-
}
|
|
6888
|
-
|
|
6889
|
-
return vec4(0, 0, 0, 0);
|
|
6890
|
-
}
|
|
6891
|
-
|
|
6892
|
-
void main(void) {
|
|
6893
|
-
vec4 color = texture2D(sampler, vUv);
|
|
6894
|
-
vec4 mask = calcColor(vUv.x);
|
|
6895
|
-
gl_FragColor = vec4(mix(color.rgb, mask.rgb, color.a * mask.a), color.a);
|
|
6896
|
-
}`
|
|
6897
|
-
}));
|
|
6898
|
-
__decorateClass$L([
|
|
6899
|
-
modernIdoc.property()
|
|
6900
|
-
], exports.ColorOverlayEffect.prototype, "colors", 2);
|
|
6901
|
-
__decorateClass$L([
|
|
6902
|
-
modernIdoc.property()
|
|
6903
|
-
], exports.ColorOverlayEffect.prototype, "alpha", 2);
|
|
6904
|
-
exports.ColorOverlayEffect = __decorateClass$L([
|
|
6905
|
-
customNode("ColorOverlayEffect")
|
|
6906
|
-
], exports.ColorOverlayEffect);
|
|
7072
|
+
exports.Transition = __decorateClass$K([
|
|
7073
|
+
customNode("Transition", {
|
|
7074
|
+
effectMode: "transition",
|
|
7075
|
+
processMode: "pausable",
|
|
7076
|
+
duration: 2e3
|
|
7077
|
+
})
|
|
7078
|
+
], exports.Transition);
|
|
6907
7079
|
|
|
6908
7080
|
var __defProp$C = Object.defineProperty;
|
|
6909
7081
|
var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
|
|
6910
|
-
var
|
|
6911
|
-
var __decorateClass$K = (decorators, target, key, kind) => {
|
|
7082
|
+
var __decorateClass$J = (decorators, target, key, kind) => {
|
|
6912
7083
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$B(target, key) : target;
|
|
6913
7084
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6914
7085
|
if (decorator = decorators[i])
|
|
@@ -6916,84 +7087,119 @@ var __decorateClass$K = (decorators, target, key, kind) => {
|
|
|
6916
7087
|
if (kind && result) __defProp$C(target, key, result);
|
|
6917
7088
|
return result;
|
|
6918
7089
|
};
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
7090
|
+
exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
7091
|
+
position = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
7092
|
+
scale = new Vector2(1, 1).on("update", () => this.updateGlobalTransform());
|
|
7093
|
+
skew = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
7094
|
+
transform = new Transform2D();
|
|
7095
|
+
globalPosition = new Vector2();
|
|
7096
|
+
globalScale = new Vector2();
|
|
7097
|
+
globalSkew = new Vector2();
|
|
7098
|
+
globalTransform = new Transform2D();
|
|
7099
|
+
_parentTransformDirtyId;
|
|
7100
|
+
constructor(properties, nodes = []) {
|
|
6923
7101
|
super();
|
|
6924
|
-
this.setProperties(properties).append(
|
|
7102
|
+
this.setProperties(properties).append(nodes);
|
|
6925
7103
|
}
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
});
|
|
6933
|
-
while (colors.length < maxColors) {
|
|
6934
|
-
colors.push([-1, 0, 0]);
|
|
7104
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
7105
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
7106
|
+
switch (key) {
|
|
7107
|
+
case "rotation":
|
|
7108
|
+
this.requestRelayout();
|
|
7109
|
+
break;
|
|
6935
7110
|
}
|
|
6936
|
-
colors.slice(0, maxColors).forEach((originalColor, i) => {
|
|
6937
|
-
originalColors[i * 3] = originalColor[0];
|
|
6938
|
-
originalColors[i * 3 + 1] = originalColor[1];
|
|
6939
|
-
originalColors[i * 3 + 2] = originalColor[2];
|
|
6940
|
-
});
|
|
6941
|
-
source.redraw(renderer, () => {
|
|
6942
|
-
QuadUvGeometry.draw(renderer, exports.ColorRemoveEffect.material, {
|
|
6943
|
-
sampler: 0,
|
|
6944
|
-
epsilon: this.epsilon,
|
|
6945
|
-
originalColors
|
|
6946
|
-
});
|
|
6947
|
-
});
|
|
6948
7111
|
}
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
7112
|
+
getTransformOrigin() {
|
|
7113
|
+
return new Vector2(0, 0);
|
|
7114
|
+
}
|
|
7115
|
+
getTransform(cb) {
|
|
7116
|
+
const origin = this.getTransformOrigin();
|
|
7117
|
+
const transform = new Transform2D();
|
|
7118
|
+
transform.translate(-origin.x, -origin.y).scale(this.scale.x, this.scale.y).skew(this.skew.x, this.skew.y).rotate(this.rotation);
|
|
7119
|
+
cb?.(transform);
|
|
7120
|
+
transform.translate(this.position.x, this.position.y).translate(origin.x, origin.y);
|
|
7121
|
+
return transform;
|
|
7122
|
+
}
|
|
7123
|
+
updateTransform() {
|
|
7124
|
+
this.transform.copy(this.getTransform());
|
|
7125
|
+
}
|
|
7126
|
+
updateGlobalTransform() {
|
|
7127
|
+
this.updateTransform();
|
|
7128
|
+
const parent = this.getParent();
|
|
7129
|
+
if (parent?.globalTransform) {
|
|
7130
|
+
this._parentTransformDirtyId = parent.globalTransform.dirtyId;
|
|
7131
|
+
this.globalScale.set(parent.globalScale.x * this.scale.x, parent.globalScale.y * this.scale.y);
|
|
7132
|
+
this.globalRotation = parent.globalRotation + this.rotation;
|
|
7133
|
+
parent.globalTransform.multiply(this.transform, this.globalTransform);
|
|
7134
|
+
} else {
|
|
7135
|
+
this.globalScale.copy(this.scale);
|
|
7136
|
+
this.globalRotation = this.rotation;
|
|
7137
|
+
this.globalTransform.copy(this.transform);
|
|
6972
7138
|
}
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
7139
|
+
const [
|
|
7140
|
+
a,
|
|
7141
|
+
c,
|
|
7142
|
+
tx,
|
|
7143
|
+
b,
|
|
7144
|
+
d,
|
|
7145
|
+
ty
|
|
7146
|
+
] = this.globalTransform.toArray();
|
|
7147
|
+
this.globalPosition.set(tx, ty);
|
|
7148
|
+
this.globalSkew.x = Math.atan2(c, a) - this.globalRotation;
|
|
7149
|
+
this.globalSkew.y = Math.atan2(b, d) - this.globalRotation;
|
|
7150
|
+
this.requestRelayout();
|
|
7151
|
+
}
|
|
7152
|
+
_transformVertices(vertices, vertTransform) {
|
|
7153
|
+
let a, c, tx, b, d, ty;
|
|
7154
|
+
if (vertTransform) {
|
|
7155
|
+
const globalTransform = this.globalTransform.clone();
|
|
7156
|
+
globalTransform.multiply(
|
|
7157
|
+
typeof vertTransform === "function" ? vertTransform?.() : vertTransform
|
|
7158
|
+
);
|
|
7159
|
+
[a, c, tx, b, d, ty] = globalTransform.toArray();
|
|
7160
|
+
} else {
|
|
7161
|
+
[a, c, tx, b, d, ty] = this.globalTransform.toArray();
|
|
7162
|
+
}
|
|
7163
|
+
const newVertices = vertices.slice();
|
|
7164
|
+
for (let len = vertices.length, i = 0; i < len; i += 2) {
|
|
7165
|
+
const x = vertices[i];
|
|
7166
|
+
const y = vertices[i + 1];
|
|
7167
|
+
newVertices[i] = a * x + c * y + tx;
|
|
7168
|
+
newVertices[i + 1] = b * x + d * y + ty;
|
|
6977
7169
|
}
|
|
7170
|
+
return newVertices;
|
|
6978
7171
|
}
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
7172
|
+
_relayout(batchables) {
|
|
7173
|
+
batchables = super._relayout(batchables);
|
|
7174
|
+
this.updateGlobalTransform();
|
|
7175
|
+
return batchables.map((batchable) => {
|
|
7176
|
+
return {
|
|
7177
|
+
...batchable,
|
|
7178
|
+
vertices: this._transformVertices(batchable.vertices, batchable.vertTransform)
|
|
7179
|
+
};
|
|
7180
|
+
});
|
|
7181
|
+
}
|
|
7182
|
+
_process(delta) {
|
|
7183
|
+
super._process(delta);
|
|
7184
|
+
const parent = this.getParent();
|
|
7185
|
+
if (parent?.globalTransform && this._parentTransformDirtyId !== parent?.globalTransform?.dirtyId) {
|
|
7186
|
+
this.requestRelayout();
|
|
7187
|
+
}
|
|
7188
|
+
}
|
|
7189
|
+
};
|
|
7190
|
+
__decorateClass$J([
|
|
7191
|
+
modernIdoc.property({ protected: true, fallback: 0 })
|
|
7192
|
+
], exports.Node2D.prototype, "rotation", 2);
|
|
7193
|
+
__decorateClass$J([
|
|
7194
|
+
modernIdoc.property({ protected: true, fallback: 0 })
|
|
7195
|
+
], exports.Node2D.prototype, "globalRotation", 2);
|
|
7196
|
+
exports.Node2D = __decorateClass$J([
|
|
7197
|
+
customNode("Node2D")
|
|
7198
|
+
], exports.Node2D);
|
|
6992
7199
|
|
|
6993
7200
|
var __defProp$B = Object.defineProperty;
|
|
6994
7201
|
var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
|
|
6995
|
-
var
|
|
6996
|
-
var __decorateClass$J = (decorators, target, key, kind) => {
|
|
7202
|
+
var __decorateClass$I = (decorators, target, key, kind) => {
|
|
6997
7203
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$A(target, key) : target;
|
|
6998
7204
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6999
7205
|
if (decorator = decorators[i])
|
|
@@ -7001,53 +7207,242 @@ var __decorateClass$J = (decorators, target, key, kind) => {
|
|
|
7001
7207
|
if (kind && result) __defProp$B(target, key, result);
|
|
7002
7208
|
return result;
|
|
7003
7209
|
};
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
_color = new Color();
|
|
7008
|
-
constructor(properties, children = []) {
|
|
7210
|
+
exports.Camera2D = class Camera2D extends exports.Node2D {
|
|
7211
|
+
zoom = new Vector2(1, 1).on("update", () => this.updateCanvasTransform());
|
|
7212
|
+
constructor(properties, nodes = []) {
|
|
7009
7213
|
super();
|
|
7010
|
-
this.setProperties(properties).append(
|
|
7214
|
+
this.setProperties(properties).append(nodes);
|
|
7011
7215
|
}
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
const
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7216
|
+
_input(event, key) {
|
|
7217
|
+
super._input(event, key);
|
|
7218
|
+
if (key === "wheel") {
|
|
7219
|
+
const e = event;
|
|
7220
|
+
if (e.ctrlKey) {
|
|
7221
|
+
const isTouchPad = e.wheelDeltaY ? Math.abs(Math.abs(e.wheelDeltaY) - Math.abs(3 * e.deltaY)) < 3 : e.deltaMode === 0;
|
|
7222
|
+
if (!isTouchPad) {
|
|
7223
|
+
e.preventDefault();
|
|
7224
|
+
const value = this.zoom.x + e.deltaY * -0.015;
|
|
7225
|
+
const zoom = Math.min(this.maxZoom, Math.max(this.minZoom, value));
|
|
7226
|
+
const ratio = 1 - zoom / this.zoom.x;
|
|
7227
|
+
this.zoom.set([
|
|
7228
|
+
zoom,
|
|
7229
|
+
zoom
|
|
7230
|
+
]);
|
|
7231
|
+
this.position.add([
|
|
7232
|
+
(e.screenX - this.position.x) * ratio,
|
|
7233
|
+
(e.screenY - this.position.y) * ratio
|
|
7234
|
+
]);
|
|
7235
|
+
}
|
|
7236
|
+
} else {
|
|
7237
|
+
e.preventDefault();
|
|
7238
|
+
this.position.add([
|
|
7239
|
+
-e.deltaX,
|
|
7240
|
+
-e.deltaY
|
|
7241
|
+
]);
|
|
7242
|
+
}
|
|
7031
7243
|
}
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7244
|
+
}
|
|
7245
|
+
updateTransform() {
|
|
7246
|
+
super.updateTransform();
|
|
7247
|
+
this.updateCanvasTransform();
|
|
7248
|
+
}
|
|
7249
|
+
updateCanvasTransform() {
|
|
7250
|
+
const viewport = this.getViewport();
|
|
7251
|
+
if (!viewport)
|
|
7252
|
+
return;
|
|
7253
|
+
viewport.canvasTransform.identity().scale(this.zoom.x, this.zoom.y).translate(this.position.x, this.position.y);
|
|
7254
|
+
}
|
|
7255
|
+
};
|
|
7256
|
+
__decorateClass$I([
|
|
7257
|
+
modernIdoc.property({ fallback: 6 })
|
|
7258
|
+
], exports.Camera2D.prototype, "maxZoom", 2);
|
|
7259
|
+
__decorateClass$I([
|
|
7260
|
+
modernIdoc.property({ fallback: 0.1 })
|
|
7261
|
+
], exports.Camera2D.prototype, "minZoom", 2);
|
|
7262
|
+
exports.Camera2D = __decorateClass$I([
|
|
7263
|
+
customNode("Camera2D")
|
|
7264
|
+
], exports.Camera2D);
|
|
7265
|
+
|
|
7266
|
+
const defaultFilters = {
|
|
7267
|
+
"brightness": 1,
|
|
7268
|
+
"contrast": 1,
|
|
7269
|
+
"grayscale": 0,
|
|
7270
|
+
"hue-rotate": 0,
|
|
7271
|
+
"invert": 0,
|
|
7272
|
+
"opacity": 1,
|
|
7273
|
+
"saturate": 1,
|
|
7274
|
+
"sepia": 0
|
|
7275
|
+
};
|
|
7276
|
+
function parseCSSFilter(filter) {
|
|
7277
|
+
const m = new ColorMatrix();
|
|
7278
|
+
if (filter === "none") {
|
|
7279
|
+
return m;
|
|
7280
|
+
}
|
|
7281
|
+
const filters = parseCssFunctions(filter).reduce((filter2, { name, args }) => {
|
|
7282
|
+
filter2[name] = args[0].normalizedIntValue;
|
|
7283
|
+
return filter2;
|
|
7284
|
+
}, {});
|
|
7285
|
+
Object.keys(defaultFilters).forEach((name) => {
|
|
7286
|
+
filters[name] = filters[name] ?? defaultFilters[name];
|
|
7287
|
+
});
|
|
7288
|
+
for (const name in filters) {
|
|
7289
|
+
const value = filters[name];
|
|
7290
|
+
switch (name) {
|
|
7291
|
+
case "hue-rotate":
|
|
7292
|
+
m.hueRotate(value * PI_2);
|
|
7293
|
+
break;
|
|
7294
|
+
case "saturate":
|
|
7295
|
+
m.saturate(value);
|
|
7296
|
+
break;
|
|
7297
|
+
case "brightness":
|
|
7298
|
+
m.brightness(value);
|
|
7299
|
+
break;
|
|
7300
|
+
case "contrast":
|
|
7301
|
+
m.contrast(value);
|
|
7302
|
+
break;
|
|
7303
|
+
case "invert":
|
|
7304
|
+
m.invert(value);
|
|
7305
|
+
break;
|
|
7306
|
+
case "sepia":
|
|
7307
|
+
m.sepia(value);
|
|
7308
|
+
break;
|
|
7309
|
+
case "opacity":
|
|
7310
|
+
m.opacity(value);
|
|
7311
|
+
break;
|
|
7312
|
+
case "grayscale":
|
|
7313
|
+
m.grayscale(value);
|
|
7314
|
+
break;
|
|
7315
|
+
}
|
|
7316
|
+
}
|
|
7317
|
+
return m;
|
|
7318
|
+
}
|
|
7319
|
+
|
|
7320
|
+
function parseCSSTransform(transform, width, height, output = new Transform2D()) {
|
|
7321
|
+
transform = !transform || transform === "none" ? "" : transform;
|
|
7322
|
+
parseCssFunctions(transform, { width, height }).reverse().forEach(({ name, args }) => {
|
|
7323
|
+
const values = args.map((arg) => arg.normalizedIntValue);
|
|
7324
|
+
switch (name) {
|
|
7325
|
+
case "translate":
|
|
7326
|
+
output.translate(values[0] * width, (values[1] ?? values[0]) * height);
|
|
7327
|
+
break;
|
|
7328
|
+
case "translateX":
|
|
7329
|
+
output.translateX(values[0] * width);
|
|
7330
|
+
break;
|
|
7331
|
+
case "translateY":
|
|
7332
|
+
output.translateY(values[0] * height);
|
|
7333
|
+
break;
|
|
7334
|
+
case "translateZ":
|
|
7335
|
+
output.translateZ(values[0]);
|
|
7336
|
+
break;
|
|
7337
|
+
case "translate3d":
|
|
7338
|
+
output.translate3d(
|
|
7339
|
+
values[0] * width,
|
|
7340
|
+
(values[1] ?? values[0]) * height,
|
|
7341
|
+
values[2] ?? values[1] ?? values[0]
|
|
7342
|
+
);
|
|
7343
|
+
break;
|
|
7344
|
+
case "scale":
|
|
7345
|
+
output.scale(values[0], values[1] ?? values[0]);
|
|
7346
|
+
break;
|
|
7347
|
+
case "scaleX":
|
|
7348
|
+
output.scaleX(values[0]);
|
|
7349
|
+
break;
|
|
7350
|
+
case "scaleY":
|
|
7351
|
+
output.scaleY(values[0]);
|
|
7352
|
+
break;
|
|
7353
|
+
case "scale3d":
|
|
7354
|
+
output.scale3d(values[0], values[1] ?? values[0], values[2] ?? values[1] ?? values[0]);
|
|
7355
|
+
break;
|
|
7356
|
+
case "rotate":
|
|
7357
|
+
output.rotate(values[0] * PI_2);
|
|
7358
|
+
break;
|
|
7359
|
+
case "rotateX":
|
|
7360
|
+
output.rotateX(values[0] * PI_2);
|
|
7361
|
+
break;
|
|
7362
|
+
case "rotateY":
|
|
7363
|
+
output.rotateY(values[0] * PI_2);
|
|
7364
|
+
break;
|
|
7365
|
+
case "rotateZ":
|
|
7366
|
+
output.rotateZ(values[0] * PI_2);
|
|
7367
|
+
break;
|
|
7368
|
+
case "rotate3d":
|
|
7369
|
+
output.rotate3d(
|
|
7370
|
+
values[0] * PI_2,
|
|
7371
|
+
(values[1] ?? values[0]) * PI_2,
|
|
7372
|
+
(values[2] ?? values[1] ?? values[0]) * PI_2,
|
|
7373
|
+
(values[3] ?? values[2] ?? values[1] ?? values[0]) * PI_2
|
|
7374
|
+
);
|
|
7375
|
+
break;
|
|
7376
|
+
case "skew":
|
|
7377
|
+
output.skew(values[0], values[0] ?? values[1]);
|
|
7378
|
+
break;
|
|
7379
|
+
case "skewX":
|
|
7380
|
+
output.skewX(values[0]);
|
|
7381
|
+
break;
|
|
7382
|
+
case "skewY":
|
|
7383
|
+
output.skewY(values[0]);
|
|
7384
|
+
break;
|
|
7385
|
+
case "matrix":
|
|
7386
|
+
output.set(values);
|
|
7387
|
+
break;
|
|
7388
|
+
}
|
|
7389
|
+
});
|
|
7390
|
+
return output;
|
|
7391
|
+
}
|
|
7392
|
+
|
|
7393
|
+
function parseCSSTransformOrigin(transformOrigin) {
|
|
7394
|
+
const [originX, originY = originX] = transformOrigin.split(" ");
|
|
7395
|
+
return [originX, originY].map((val) => {
|
|
7396
|
+
val = val.trim();
|
|
7397
|
+
switch (val) {
|
|
7398
|
+
case "left":
|
|
7399
|
+
case "top":
|
|
7400
|
+
return 0;
|
|
7401
|
+
case "center":
|
|
7402
|
+
return 0.5;
|
|
7403
|
+
case "right":
|
|
7404
|
+
case "bottom":
|
|
7405
|
+
return 1;
|
|
7406
|
+
default:
|
|
7407
|
+
return Number(val);
|
|
7408
|
+
}
|
|
7409
|
+
});
|
|
7410
|
+
}
|
|
7411
|
+
|
|
7412
|
+
var __defProp$A = Object.defineProperty;
|
|
7413
|
+
var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
|
|
7414
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7415
|
+
var __decorateClass$H = (decorators, target, key, kind) => {
|
|
7416
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target;
|
|
7417
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7418
|
+
if (decorator = decorators[i])
|
|
7419
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7420
|
+
if (kind && result) __defProp$A(target, key, result);
|
|
7421
|
+
return result;
|
|
7422
|
+
};
|
|
7423
|
+
var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, key + "" , value);
|
|
7424
|
+
exports.ColorAdjustEffect = class ColorAdjustEffect extends exports.Effect {
|
|
7425
|
+
constructor(properties, children = []) {
|
|
7426
|
+
super();
|
|
7427
|
+
this.setProperties(properties).append(children);
|
|
7428
|
+
}
|
|
7429
|
+
apply(renderer, source) {
|
|
7040
7430
|
source.redraw(renderer, () => {
|
|
7041
|
-
QuadUvGeometry.draw(renderer, exports.
|
|
7431
|
+
QuadUvGeometry.draw(renderer, exports.ColorAdjustEffect.material, {
|
|
7042
7432
|
sampler: 0,
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7433
|
+
saturation: this.saturation,
|
|
7434
|
+
contrast: this.contrast,
|
|
7435
|
+
brightness: this.brightness,
|
|
7436
|
+
red: this.red,
|
|
7437
|
+
green: this.green,
|
|
7438
|
+
blue: this.blue,
|
|
7439
|
+
alpha: this.alpha,
|
|
7440
|
+
gamma: Math.max(this.gamma ?? 1, 1e-4)
|
|
7046
7441
|
});
|
|
7047
7442
|
});
|
|
7048
7443
|
}
|
|
7049
7444
|
};
|
|
7050
|
-
__publicField$
|
|
7445
|
+
__publicField$i(exports.ColorAdjustEffect, "material", new Material({
|
|
7051
7446
|
vert: `precision mediump float;
|
|
7052
7447
|
attribute vec2 position;
|
|
7053
7448
|
attribute vec2 uv;
|
|
@@ -7058,606 +7453,448 @@ void main() {
|
|
|
7058
7453
|
}`,
|
|
7059
7454
|
frag: `varying vec2 vUv;
|
|
7060
7455
|
uniform sampler2D sampler;
|
|
7061
|
-
uniform float
|
|
7062
|
-
|
|
7063
|
-
uniform
|
|
7064
|
-
uniform
|
|
7456
|
+
uniform float gamma;
|
|
7457
|
+
uniform float contrast;
|
|
7458
|
+
uniform float saturation;
|
|
7459
|
+
uniform float brightness;
|
|
7460
|
+
uniform float red;
|
|
7461
|
+
uniform float green;
|
|
7462
|
+
uniform float blue;
|
|
7463
|
+
uniform float alpha;
|
|
7065
7464
|
|
|
7066
7465
|
void main(void) {
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
vec3 origColor = originalColors[i];
|
|
7078
|
-
if (origColor.r < 0.0) {
|
|
7079
|
-
break;
|
|
7080
|
-
}
|
|
7081
|
-
vec3 colorDiff = origColor - color;
|
|
7082
|
-
if (length(colorDiff) < epsilon) {
|
|
7083
|
-
vec3 targetColor = targetColors[i];
|
|
7084
|
-
gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);
|
|
7085
|
-
return;
|
|
7086
|
-
}
|
|
7466
|
+
vec4 c = texture2D(sampler, vUv);
|
|
7467
|
+
if (c.a > 0.0) {
|
|
7468
|
+
c.rgb /= c.a;
|
|
7469
|
+
vec3 rgb = pow(c.rgb, vec3(1. / gamma));
|
|
7470
|
+
rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);
|
|
7471
|
+
rgb.r *= red;
|
|
7472
|
+
rgb.g *= green;
|
|
7473
|
+
rgb.b *= blue;
|
|
7474
|
+
c.rgb = rgb * brightness;
|
|
7475
|
+
c.rgb *= c.a;
|
|
7087
7476
|
}
|
|
7477
|
+
gl_FragColor = c * alpha;
|
|
7088
7478
|
}`
|
|
7089
7479
|
}));
|
|
7090
|
-
__decorateClass$
|
|
7480
|
+
__decorateClass$H([
|
|
7091
7481
|
modernIdoc.property()
|
|
7092
|
-
], exports.
|
|
7093
|
-
__decorateClass$
|
|
7482
|
+
], exports.ColorAdjustEffect.prototype, "saturation", 2);
|
|
7483
|
+
__decorateClass$H([
|
|
7094
7484
|
modernIdoc.property()
|
|
7095
|
-
], exports.
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
], exports.
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
}
|
|
7118
|
-
}
|
|
7119
|
-
stroke(options) {
|
|
7120
|
-
if (!this.curves.length) {
|
|
7121
|
-
return;
|
|
7122
|
-
}
|
|
7123
|
-
let strokeStyle = this.strokeStyle;
|
|
7124
|
-
if (!strokeStyle && this.style.stroke) {
|
|
7125
|
-
switch (typeof this.style.stroke) {
|
|
7126
|
-
case "string":
|
|
7127
|
-
strokeStyle = this.style.stroke;
|
|
7128
|
-
break;
|
|
7129
|
-
case "object":
|
|
7130
|
-
if (modernIdoc.isColorFillObject(this.style.stroke)) {
|
|
7131
|
-
strokeStyle = this.style.stroke.color;
|
|
7132
|
-
}
|
|
7133
|
-
break;
|
|
7134
|
-
}
|
|
7135
|
-
}
|
|
7136
|
-
this._draws.push({
|
|
7137
|
-
...options,
|
|
7138
|
-
type: "stroke",
|
|
7139
|
-
path: new modernPath2d.Path2D(this),
|
|
7140
|
-
texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
|
|
7141
|
-
uvTransform: this.uvTransform,
|
|
7142
|
-
vertTransform: this.vertTransform,
|
|
7143
|
-
style: {
|
|
7144
|
-
alignment: 0.5,
|
|
7145
|
-
cap: this.lineCap ?? "butt",
|
|
7146
|
-
join: this.lineJoin ?? "miter",
|
|
7147
|
-
width: this.lineWidth ?? 1,
|
|
7148
|
-
miterLimit: this.miterLimit ?? 10
|
|
7149
|
-
}
|
|
7150
|
-
});
|
|
7151
|
-
super.reset();
|
|
7152
|
-
}
|
|
7153
|
-
fillRect(x, y, width, height) {
|
|
7154
|
-
this.rect(x, y, width, height).fill();
|
|
7155
|
-
}
|
|
7156
|
-
strokeRect(x, y, width, height) {
|
|
7157
|
-
this.rect(x, y, width, height).stroke();
|
|
7158
|
-
}
|
|
7159
|
-
fill(options) {
|
|
7160
|
-
if (!this.curves.length) {
|
|
7161
|
-
return;
|
|
7162
|
-
}
|
|
7163
|
-
let fillStyle = this.fillStyle;
|
|
7164
|
-
if (!fillStyle && this.style.fill) {
|
|
7165
|
-
switch (typeof this.style.fill) {
|
|
7166
|
-
case "string":
|
|
7167
|
-
fillStyle = this.style.fill;
|
|
7168
|
-
break;
|
|
7169
|
-
case "object":
|
|
7170
|
-
if (modernIdoc.isColorFillObject(this.style.fill)) {
|
|
7171
|
-
fillStyle = this.style.fill.color;
|
|
7172
|
-
}
|
|
7173
|
-
break;
|
|
7174
|
-
}
|
|
7175
|
-
}
|
|
7176
|
-
this._draws.push({
|
|
7177
|
-
...options,
|
|
7178
|
-
type: "fill",
|
|
7179
|
-
path: new modernPath2d.Path2D(this),
|
|
7180
|
-
texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
|
|
7181
|
-
uvTransform: this.uvTransform,
|
|
7182
|
-
vertTransform: this.vertTransform
|
|
7183
|
-
});
|
|
7184
|
-
super.reset();
|
|
7185
|
-
}
|
|
7186
|
-
copy(source) {
|
|
7187
|
-
super.copy(source);
|
|
7188
|
-
this.strokeStyle = source.strokeStyle;
|
|
7189
|
-
this.fillStyle = source.fillStyle;
|
|
7190
|
-
this.uvTransform = source.uvTransform;
|
|
7191
|
-
this.vertTransform = source.vertTransform;
|
|
7192
|
-
this.lineCap = source.lineCap;
|
|
7193
|
-
this.lineJoin = source.lineJoin;
|
|
7194
|
-
this.lineWidth = source.lineWidth;
|
|
7195
|
-
this.miterLimit = source.miterLimit;
|
|
7196
|
-
this._draws = source._draws.slice();
|
|
7197
|
-
return this;
|
|
7198
|
-
}
|
|
7199
|
-
reset() {
|
|
7200
|
-
super.reset();
|
|
7201
|
-
this.strokeStyle = void 0;
|
|
7202
|
-
this.fillStyle = void 0;
|
|
7203
|
-
this.uvTransform = void 0;
|
|
7204
|
-
this.vertTransform = void 0;
|
|
7205
|
-
this.lineCap = void 0;
|
|
7206
|
-
this.lineJoin = void 0;
|
|
7207
|
-
this.lineWidth = void 0;
|
|
7208
|
-
this.miterLimit = void 0;
|
|
7209
|
-
this._draws.length = 0;
|
|
7210
|
-
return this;
|
|
7211
|
-
}
|
|
7212
|
-
buildUvs(start, vertices, uvs, texture, uvTransform) {
|
|
7213
|
-
if (texture) {
|
|
7214
|
-
const _uvTransform = uvTransform ? typeof uvTransform === "function" ? uvTransform : (x, y) => uvTransform.applyToPoint(x, y) : uvTransform;
|
|
7215
|
-
const w = texture.width;
|
|
7216
|
-
const h = texture.height;
|
|
7217
|
-
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
7218
|
-
const x = vertices[i];
|
|
7219
|
-
const y = vertices[i + 1];
|
|
7220
|
-
let uvX;
|
|
7221
|
-
let uvY;
|
|
7222
|
-
if (_uvTransform) {
|
|
7223
|
-
[uvX, uvY] = _uvTransform(x, y);
|
|
7224
|
-
} else {
|
|
7225
|
-
[uvX, uvY] = [x / w, y / h];
|
|
7226
|
-
}
|
|
7227
|
-
uvs.push(uvX, uvY);
|
|
7228
|
-
}
|
|
7229
|
-
} else {
|
|
7230
|
-
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
7231
|
-
uvs.push(0, 0);
|
|
7232
|
-
}
|
|
7233
|
-
}
|
|
7234
|
-
}
|
|
7235
|
-
toBatchables() {
|
|
7236
|
-
const batchables = [];
|
|
7237
|
-
for (let len = this._draws.length, i = 0; i < len; i++) {
|
|
7238
|
-
const current = this._draws[i];
|
|
7239
|
-
const vertices = [];
|
|
7240
|
-
const indices = [];
|
|
7241
|
-
const uvs = [];
|
|
7242
|
-
if (current.type === "fill") {
|
|
7243
|
-
current.path.fillTriangulate({
|
|
7244
|
-
vertices,
|
|
7245
|
-
indices
|
|
7246
|
-
});
|
|
7247
|
-
} else {
|
|
7248
|
-
current.path.strokeTriangulate({
|
|
7249
|
-
vertices,
|
|
7250
|
-
indices,
|
|
7251
|
-
lineStyle: current.style,
|
|
7252
|
-
flipAlignment: false,
|
|
7253
|
-
closed: true
|
|
7254
|
-
});
|
|
7255
|
-
}
|
|
7256
|
-
this.buildUvs(0, vertices, uvs, current.texture, current.uvTransform);
|
|
7257
|
-
batchables.push({
|
|
7258
|
-
vertices,
|
|
7259
|
-
indices,
|
|
7260
|
-
uvs,
|
|
7261
|
-
texture: current.texture,
|
|
7262
|
-
type: current.type,
|
|
7263
|
-
disableWrapMode: current.disableWrapMode,
|
|
7264
|
-
vertTransform: current.vertTransform
|
|
7265
|
-
});
|
|
7266
|
-
}
|
|
7267
|
-
return batchables;
|
|
7268
|
-
}
|
|
7269
|
-
}
|
|
7485
|
+
], exports.ColorAdjustEffect.prototype, "contrast", 2);
|
|
7486
|
+
__decorateClass$H([
|
|
7487
|
+
modernIdoc.property()
|
|
7488
|
+
], exports.ColorAdjustEffect.prototype, "brightness", 2);
|
|
7489
|
+
__decorateClass$H([
|
|
7490
|
+
modernIdoc.property()
|
|
7491
|
+
], exports.ColorAdjustEffect.prototype, "red", 2);
|
|
7492
|
+
__decorateClass$H([
|
|
7493
|
+
modernIdoc.property()
|
|
7494
|
+
], exports.ColorAdjustEffect.prototype, "green", 2);
|
|
7495
|
+
__decorateClass$H([
|
|
7496
|
+
modernIdoc.property()
|
|
7497
|
+
], exports.ColorAdjustEffect.prototype, "blue", 2);
|
|
7498
|
+
__decorateClass$H([
|
|
7499
|
+
modernIdoc.property()
|
|
7500
|
+
], exports.ColorAdjustEffect.prototype, "alpha", 2);
|
|
7501
|
+
__decorateClass$H([
|
|
7502
|
+
modernIdoc.property()
|
|
7503
|
+
], exports.ColorAdjustEffect.prototype, "gamma", 2);
|
|
7504
|
+
exports.ColorAdjustEffect = __decorateClass$H([
|
|
7505
|
+
customNode("ColorAdjustEffect")
|
|
7506
|
+
], exports.ColorAdjustEffect);
|
|
7270
7507
|
|
|
7271
|
-
var __defProp$
|
|
7272
|
-
var __getOwnPropDesc$
|
|
7273
|
-
var
|
|
7274
|
-
|
|
7508
|
+
var __defProp$z = Object.defineProperty;
|
|
7509
|
+
var __getOwnPropDesc$y = Object.getOwnPropertyDescriptor;
|
|
7510
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7511
|
+
var __decorateClass$G = (decorators, target, key, kind) => {
|
|
7512
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$y(target, key) : target;
|
|
7275
7513
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7276
7514
|
if (decorator = decorators[i])
|
|
7277
7515
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7278
|
-
if (kind && result) __defProp$
|
|
7516
|
+
if (kind && result) __defProp$z(target, key, result);
|
|
7279
7517
|
return result;
|
|
7280
7518
|
};
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
return this._globalVisible ?? true;
|
|
7286
|
-
}
|
|
7287
|
-
_parentGlobalOpacity;
|
|
7288
|
-
_globalOpacity;
|
|
7289
|
-
get globalOpacity() {
|
|
7290
|
-
return this._globalOpacity ?? 1;
|
|
7291
|
-
}
|
|
7292
|
-
_modulate = new Color(4294967295);
|
|
7293
|
-
// Batch render
|
|
7294
|
-
context = new CanvasContext();
|
|
7295
|
-
_resetContext = true;
|
|
7296
|
-
_redrawing = true;
|
|
7297
|
-
_relayouting = false;
|
|
7298
|
-
_repainting = false;
|
|
7299
|
-
_originalBatchables = [];
|
|
7300
|
-
_layoutedBatchables = [];
|
|
7301
|
-
_batchables = [];
|
|
7302
|
-
constructor(properties, nodes = []) {
|
|
7519
|
+
var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, key + "" , value);
|
|
7520
|
+
exports.ColorFilterEffect = class ColorFilterEffect extends exports.Effect {
|
|
7521
|
+
_colorMatrix = new ColorMatrix();
|
|
7522
|
+
constructor(properties, children = []) {
|
|
7303
7523
|
super();
|
|
7304
|
-
this.setProperties(properties).append(
|
|
7305
|
-
}
|
|
7306
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
7307
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
7308
|
-
switch (key) {
|
|
7309
|
-
case "modulate":
|
|
7310
|
-
this._modulate.value = value;
|
|
7311
|
-
this.requestRepaint();
|
|
7312
|
-
break;
|
|
7313
|
-
case "blendMode":
|
|
7314
|
-
this.requestRepaint();
|
|
7315
|
-
break;
|
|
7316
|
-
case "opacity":
|
|
7317
|
-
this._updateGlobalOpacity();
|
|
7318
|
-
break;
|
|
7319
|
-
case "visible":
|
|
7320
|
-
case "insideTimeRange":
|
|
7321
|
-
this._updateGlobalVisible();
|
|
7322
|
-
break;
|
|
7323
|
-
}
|
|
7324
|
-
}
|
|
7325
|
-
show() {
|
|
7326
|
-
this.visible = true;
|
|
7327
|
-
}
|
|
7328
|
-
hide() {
|
|
7329
|
-
this.visible = false;
|
|
7330
|
-
}
|
|
7331
|
-
isVisibleInTree() {
|
|
7332
|
-
return this.globalOpacity > 0 && this.globalVisible;
|
|
7333
|
-
}
|
|
7334
|
-
canRender() {
|
|
7335
|
-
return super.canRender() && this.isVisibleInTree();
|
|
7336
|
-
}
|
|
7337
|
-
requestRedraw() {
|
|
7338
|
-
this._redrawing = true;
|
|
7339
|
-
}
|
|
7340
|
-
requestRelayout() {
|
|
7341
|
-
this._relayouting = true;
|
|
7342
|
-
}
|
|
7343
|
-
requestRepaint() {
|
|
7344
|
-
this._repainting = true;
|
|
7345
|
-
}
|
|
7346
|
-
_updateGlobalVisible() {
|
|
7347
|
-
this._parentGlobalVisible = this.getParent()?.globalVisible;
|
|
7348
|
-
this._globalVisible = (this._parentGlobalVisible ?? true) && this.visible && this.insideTimeRange;
|
|
7349
|
-
}
|
|
7350
|
-
_updateGlobalOpacity() {
|
|
7351
|
-
this._parentGlobalOpacity = this.getParent()?.opacity;
|
|
7352
|
-
const globalOpacity = clamp(0, this.opacity, 1) * (this._parentGlobalOpacity ?? 1);
|
|
7353
|
-
if (this._globalOpacity !== globalOpacity) {
|
|
7354
|
-
this._globalOpacity = globalOpacity;
|
|
7355
|
-
this.requestRepaint();
|
|
7356
|
-
}
|
|
7357
|
-
}
|
|
7358
|
-
_draw() {
|
|
7359
|
-
this.emit("draw");
|
|
7360
|
-
}
|
|
7361
|
-
_redraw() {
|
|
7362
|
-
this.log(this.name, "drawing");
|
|
7363
|
-
this._draw();
|
|
7364
|
-
return this.context.toBatchables();
|
|
7365
|
-
}
|
|
7366
|
-
_relayout(batchables) {
|
|
7367
|
-
this.log(this.name, "layouting");
|
|
7368
|
-
return batchables;
|
|
7369
|
-
}
|
|
7370
|
-
_repaint(batchables) {
|
|
7371
|
-
this.log(this.name, "painting");
|
|
7372
|
-
return batchables.map((batchable) => {
|
|
7373
|
-
return {
|
|
7374
|
-
...batchable,
|
|
7375
|
-
modulate: this._modulate.toArgb(this.globalOpacity, true),
|
|
7376
|
-
blendMode: this.blendMode
|
|
7377
|
-
};
|
|
7378
|
-
});
|
|
7379
|
-
}
|
|
7380
|
-
_process(delta) {
|
|
7381
|
-
super._process(delta);
|
|
7382
|
-
const parent = this.getParent();
|
|
7383
|
-
if (this._parentGlobalVisible !== parent?.globalVisible) {
|
|
7384
|
-
this._updateGlobalVisible();
|
|
7385
|
-
}
|
|
7386
|
-
if (this._parentGlobalOpacity !== parent?.globalOpacity) {
|
|
7387
|
-
this._updateGlobalOpacity();
|
|
7388
|
-
}
|
|
7524
|
+
this.setProperties(properties).append(children);
|
|
7389
7525
|
}
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7526
|
+
apply(renderer, source) {
|
|
7527
|
+
if (!this.filter)
|
|
7528
|
+
return;
|
|
7529
|
+
const funs = parseCssFunctions(this.filter);
|
|
7530
|
+
const matrix = this._colorMatrix.identity();
|
|
7531
|
+
funs.forEach(({ name, args }) => {
|
|
7532
|
+
const values = args.map((arg) => arg.normalizedIntValue);
|
|
7533
|
+
switch (name) {
|
|
7534
|
+
case "hue-rotate":
|
|
7535
|
+
case "hueRotate":
|
|
7536
|
+
matrix.hueRotate(values[0] * PI_2);
|
|
7537
|
+
break;
|
|
7538
|
+
case "saturate":
|
|
7539
|
+
matrix.saturate(values[0]);
|
|
7540
|
+
break;
|
|
7541
|
+
case "brightness":
|
|
7542
|
+
matrix.brightness(values[0]);
|
|
7543
|
+
break;
|
|
7544
|
+
case "contrast":
|
|
7545
|
+
matrix.contrast(values[0]);
|
|
7546
|
+
break;
|
|
7547
|
+
case "invert":
|
|
7548
|
+
matrix.invert(values[0]);
|
|
7549
|
+
break;
|
|
7550
|
+
case "sepia":
|
|
7551
|
+
matrix.sepia(values[0]);
|
|
7552
|
+
break;
|
|
7553
|
+
case "opacity":
|
|
7554
|
+
matrix.opacity(values[0]);
|
|
7555
|
+
break;
|
|
7556
|
+
case "grayscale":
|
|
7557
|
+
matrix.grayscale(values[0]);
|
|
7558
|
+
break;
|
|
7409
7559
|
}
|
|
7410
|
-
}
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
this._repainting = false;
|
|
7416
|
-
}
|
|
7417
|
-
}
|
|
7418
|
-
_render(renderer) {
|
|
7419
|
-
this._updateBatchables();
|
|
7420
|
-
this._batchables.forEach((batchable) => {
|
|
7421
|
-
batchable.texture?.upload(renderer);
|
|
7422
|
-
renderer.batch2D.render({
|
|
7423
|
-
...batchable,
|
|
7424
|
-
texture: batchable.texture?._glTexture(renderer)
|
|
7560
|
+
});
|
|
7561
|
+
source.redraw(renderer, () => {
|
|
7562
|
+
QuadUvGeometry.draw(renderer, exports.ColorFilterEffect.material, {
|
|
7563
|
+
sampler: 0,
|
|
7564
|
+
m: matrix.toArray()
|
|
7425
7565
|
});
|
|
7426
7566
|
});
|
|
7427
|
-
super._render(renderer);
|
|
7428
7567
|
}
|
|
7429
7568
|
};
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
calls = [];
|
|
7449
|
-
createCall(renderable) {
|
|
7450
|
-
return {
|
|
7451
|
-
renderable,
|
|
7452
|
-
parentCall: this.currentCall,
|
|
7453
|
-
fn: renderable.render.bind(renderable),
|
|
7454
|
-
calls: []
|
|
7455
|
-
};
|
|
7456
|
-
}
|
|
7457
|
-
push(renderable) {
|
|
7458
|
-
const call = this.createCall(renderable);
|
|
7459
|
-
(this.currentCall?.calls ?? this.calls).push(call);
|
|
7460
|
-
return call;
|
|
7461
|
-
}
|
|
7462
|
-
render(renderer) {
|
|
7463
|
-
this.calls.forEach(function render(call) {
|
|
7464
|
-
call.fn(renderer, () => {
|
|
7465
|
-
call.calls.forEach(render);
|
|
7466
|
-
});
|
|
7467
|
-
});
|
|
7468
|
-
this.calls = [];
|
|
7569
|
+
__publicField$h(exports.ColorFilterEffect, "material", new Material({
|
|
7570
|
+
vert: `precision mediump float;
|
|
7571
|
+
attribute vec2 position;
|
|
7572
|
+
attribute vec2 uv;
|
|
7573
|
+
varying vec2 vUv;
|
|
7574
|
+
void main() {
|
|
7575
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7576
|
+
vUv = uv;
|
|
7577
|
+
}`,
|
|
7578
|
+
frag: `precision highp float;
|
|
7579
|
+
varying vec2 vUv;
|
|
7580
|
+
uniform sampler2D sampler;
|
|
7581
|
+
uniform float m[20];
|
|
7582
|
+
|
|
7583
|
+
void main(void) {
|
|
7584
|
+
vec4 c = texture2D(sampler, vUv);
|
|
7585
|
+
if (c.a > 0.0) {
|
|
7586
|
+
c.rgb /= c.a;
|
|
7469
7587
|
}
|
|
7470
|
-
|
|
7588
|
+
gl_FragColor = vec4(
|
|
7589
|
+
m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4] / 255.0,
|
|
7590
|
+
m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9] / 255.0,
|
|
7591
|
+
m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14] / 255.0,
|
|
7592
|
+
m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19] / 255.0
|
|
7593
|
+
);
|
|
7594
|
+
}`
|
|
7595
|
+
}));
|
|
7596
|
+
__decorateClass$G([
|
|
7597
|
+
modernIdoc.property()
|
|
7598
|
+
], exports.ColorFilterEffect.prototype, "filter", 2);
|
|
7599
|
+
exports.ColorFilterEffect = __decorateClass$G([
|
|
7600
|
+
customNode("ColorFilterEffect")
|
|
7601
|
+
], exports.ColorFilterEffect);
|
|
7471
7602
|
|
|
7472
|
-
var __defProp$
|
|
7473
|
-
var __getOwnPropDesc$
|
|
7474
|
-
var
|
|
7475
|
-
|
|
7603
|
+
var __defProp$y = Object.defineProperty;
|
|
7604
|
+
var __getOwnPropDesc$x = Object.getOwnPropertyDescriptor;
|
|
7605
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7606
|
+
var __decorateClass$F = (decorators, target, key, kind) => {
|
|
7607
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$x(target, key) : target;
|
|
7476
7608
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7477
7609
|
if (decorator = decorators[i])
|
|
7478
7610
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7479
|
-
if (kind && result) __defProp$
|
|
7611
|
+
if (kind && result) __defProp$y(target, key, result);
|
|
7480
7612
|
return result;
|
|
7481
7613
|
};
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
endTime,
|
|
7488
|
-
loop
|
|
7489
|
-
});
|
|
7490
|
-
}
|
|
7491
|
-
constructor(properties) {
|
|
7614
|
+
var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, key + "" , value);
|
|
7615
|
+
const MAX_COLORS$1 = 50;
|
|
7616
|
+
exports.ColorOverlayEffect = class ColorOverlayEffect extends exports.Effect {
|
|
7617
|
+
_color = new Color();
|
|
7618
|
+
constructor(properties, children = []) {
|
|
7492
7619
|
super();
|
|
7493
|
-
this.setProperties(properties);
|
|
7620
|
+
this.setProperties(properties).append(children);
|
|
7494
7621
|
}
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7622
|
+
apply(renderer, source) {
|
|
7623
|
+
source.redraw(renderer, () => {
|
|
7624
|
+
const colors = this.colors.map((val) => {
|
|
7625
|
+
this._color.value = val;
|
|
7626
|
+
const rgba = this._color.toArray();
|
|
7627
|
+
rgba[3] = this.alpha;
|
|
7628
|
+
return rgba;
|
|
7629
|
+
});
|
|
7630
|
+
while (colors.length < MAX_COLORS$1) {
|
|
7631
|
+
colors.push([0, 0, 0, 0]);
|
|
7632
|
+
}
|
|
7633
|
+
QuadUvGeometry.draw(renderer, exports.ColorOverlayEffect.material, {
|
|
7634
|
+
sampler: 0,
|
|
7635
|
+
colors: colors.slice(0, MAX_COLORS$1).flatMap((item) => item)
|
|
7636
|
+
});
|
|
7637
|
+
});
|
|
7505
7638
|
}
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7639
|
+
};
|
|
7640
|
+
__publicField$g(exports.ColorOverlayEffect, "material", new Material({
|
|
7641
|
+
vert: `precision mediump float;
|
|
7642
|
+
attribute vec2 position;
|
|
7643
|
+
attribute vec2 uv;
|
|
7644
|
+
varying vec2 vUv;
|
|
7645
|
+
void main() {
|
|
7646
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7647
|
+
vUv = uv;
|
|
7648
|
+
}`,
|
|
7649
|
+
frag: `precision mediump float;
|
|
7650
|
+
uniform sampler2D sampler;
|
|
7651
|
+
uniform vec4 colors[${MAX_COLORS$1}];
|
|
7652
|
+
varying vec2 vUv;
|
|
7653
|
+
|
|
7654
|
+
float calcWidth() {
|
|
7655
|
+
return distance(vec2(0, 0), vec2(1, 0));
|
|
7656
|
+
}
|
|
7657
|
+
|
|
7658
|
+
int calcCount() {
|
|
7659
|
+
int count = 0;
|
|
7660
|
+
for (int i = 0; i < ${MAX_COLORS$1}; i++) {
|
|
7661
|
+
if (colors[i] != vec4(0,0,0,0)){
|
|
7662
|
+
count++;
|
|
7663
|
+
}
|
|
7664
|
+
}
|
|
7665
|
+
return count;
|
|
7666
|
+
}
|
|
7667
|
+
|
|
7668
|
+
vec4 calcColor(float x) {
|
|
7669
|
+
float perUnit = calcWidth() / float(calcCount());
|
|
7670
|
+
int index = int(x / perUnit);
|
|
7671
|
+
|
|
7672
|
+
for(int i=0; i<${MAX_COLORS$1}; i++){
|
|
7673
|
+
if(i==index){
|
|
7674
|
+
return colors[i];
|
|
7513
7675
|
}
|
|
7514
|
-
current = clamp(start, current, end);
|
|
7515
|
-
this.currentTime = current;
|
|
7516
|
-
this.emit("updateCurrentTime", current, delta);
|
|
7517
|
-
return this;
|
|
7518
|
-
}
|
|
7519
|
-
_process(delta) {
|
|
7520
|
-
super._process(delta);
|
|
7521
|
-
this.addTime(delta);
|
|
7522
7676
|
}
|
|
7523
|
-
};
|
|
7524
|
-
__decorateClass$H([
|
|
7525
|
-
modernIdoc.property({ fallback: 0 })
|
|
7526
|
-
], exports.Timeline.prototype, "startTime", 2);
|
|
7527
|
-
__decorateClass$H([
|
|
7528
|
-
modernIdoc.property({ fallback: 0 })
|
|
7529
|
-
], exports.Timeline.prototype, "currentTime", 2);
|
|
7530
|
-
__decorateClass$H([
|
|
7531
|
-
modernIdoc.property({ fallback: Number.MAX_SAFE_INTEGER })
|
|
7532
|
-
], exports.Timeline.prototype, "endTime", 2);
|
|
7533
|
-
__decorateClass$H([
|
|
7534
|
-
modernIdoc.property({ fallback: false })
|
|
7535
|
-
], exports.Timeline.prototype, "loop", 2);
|
|
7536
|
-
exports.Timeline = __decorateClass$H([
|
|
7537
|
-
customNode("Timeline")
|
|
7538
|
-
], exports.Timeline);
|
|
7539
7677
|
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7678
|
+
return vec4(0, 0, 0, 0);
|
|
7679
|
+
}
|
|
7680
|
+
|
|
7681
|
+
void main(void) {
|
|
7682
|
+
vec4 color = texture2D(sampler, vUv);
|
|
7683
|
+
vec4 mask = calcColor(vUv.x);
|
|
7684
|
+
gl_FragColor = vec4(mix(color.rgb, mask.rgb, color.a * mask.a), color.a);
|
|
7685
|
+
}`
|
|
7686
|
+
}));
|
|
7687
|
+
__decorateClass$F([
|
|
7688
|
+
modernIdoc.property()
|
|
7689
|
+
], exports.ColorOverlayEffect.prototype, "colors", 2);
|
|
7690
|
+
__decorateClass$F([
|
|
7691
|
+
modernIdoc.property()
|
|
7692
|
+
], exports.ColorOverlayEffect.prototype, "alpha", 2);
|
|
7693
|
+
exports.ColorOverlayEffect = __decorateClass$F([
|
|
7694
|
+
customNode("ColorOverlayEffect")
|
|
7695
|
+
], exports.ColorOverlayEffect);
|
|
7696
|
+
|
|
7697
|
+
var __defProp$x = Object.defineProperty;
|
|
7698
|
+
var __getOwnPropDesc$w = Object.getOwnPropertyDescriptor;
|
|
7699
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7700
|
+
var __decorateClass$E = (decorators, target, key, kind) => {
|
|
7701
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$w(target, key) : target;
|
|
7543
7702
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7544
7703
|
if (decorator = decorators[i])
|
|
7545
|
-
result = (decorator(target, key, result) ) || result;
|
|
7546
|
-
if (result) __defProp$
|
|
7704
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7705
|
+
if (kind && result) __defProp$x(target, key, result);
|
|
7547
7706
|
return result;
|
|
7548
7707
|
};
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
timeline;
|
|
7554
|
-
nodes = /* @__PURE__ */ new Map();
|
|
7555
|
-
_backgroundColor = new Color();
|
|
7556
|
-
_currentViewport;
|
|
7557
|
-
getCurrentViewport() {
|
|
7558
|
-
return this._currentViewport;
|
|
7559
|
-
}
|
|
7560
|
-
setCurrentViewport(viewport) {
|
|
7561
|
-
this._currentViewport = viewport;
|
|
7562
|
-
}
|
|
7563
|
-
constructor(timeline = new exports.Timeline()) {
|
|
7708
|
+
var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, key + "" , value);
|
|
7709
|
+
exports.ColorRemoveEffect = class ColorRemoveEffect extends exports.Effect {
|
|
7710
|
+
_color = new Color();
|
|
7711
|
+
constructor(properties, children = []) {
|
|
7564
7712
|
super();
|
|
7565
|
-
this.
|
|
7566
|
-
}
|
|
7567
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
7568
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
7569
|
-
switch (key) {
|
|
7570
|
-
case "backgroundColor":
|
|
7571
|
-
this._backgroundColor.value = value;
|
|
7572
|
-
break;
|
|
7573
|
-
}
|
|
7713
|
+
this.setProperties(properties).append(children);
|
|
7574
7714
|
}
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7715
|
+
apply(renderer, source) {
|
|
7716
|
+
const maxColors = 50;
|
|
7717
|
+
const originalColors = new Float32Array(maxColors * 3);
|
|
7718
|
+
const colors = this.colors.map((val) => {
|
|
7719
|
+
this._color.value = val;
|
|
7720
|
+
return this._color.toArray().slice(0, 3);
|
|
7721
|
+
});
|
|
7722
|
+
while (colors.length < maxColors) {
|
|
7723
|
+
colors.push([-1, 0, 0]);
|
|
7578
7724
|
}
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
this.root.emit("process", delta);
|
|
7584
|
-
this.emit("processed");
|
|
7585
|
-
}
|
|
7586
|
-
_render(renderer) {
|
|
7587
|
-
this.emit("rendering");
|
|
7588
|
-
renderer.program.uniforms.projectionMatrix = this.root.toProjectionArray(true);
|
|
7589
|
-
this.renderStack.render(renderer);
|
|
7590
|
-
this._renderScreen(renderer);
|
|
7591
|
-
this.emit("rendered");
|
|
7592
|
-
}
|
|
7593
|
-
_renderScreen(renderer) {
|
|
7594
|
-
renderer.state.reset();
|
|
7595
|
-
renderer.framebuffer.bind(null);
|
|
7596
|
-
renderer.viewport.bind({
|
|
7597
|
-
x: 0,
|
|
7598
|
-
y: 0,
|
|
7599
|
-
width: this.root.width * renderer.pixelRatio,
|
|
7600
|
-
height: this.root.height * renderer.pixelRatio
|
|
7725
|
+
colors.slice(0, maxColors).forEach((originalColor, i) => {
|
|
7726
|
+
originalColors[i * 3] = originalColor[0];
|
|
7727
|
+
originalColors[i * 3 + 1] = originalColor[1];
|
|
7728
|
+
originalColors[i * 3 + 2] = originalColor[2];
|
|
7601
7729
|
});
|
|
7602
|
-
|
|
7603
|
-
|
|
7730
|
+
source.redraw(renderer, () => {
|
|
7731
|
+
QuadUvGeometry.draw(renderer, exports.ColorRemoveEffect.material, {
|
|
7732
|
+
sampler: 0,
|
|
7733
|
+
epsilon: this.epsilon,
|
|
7734
|
+
originalColors
|
|
7735
|
+
});
|
|
7736
|
+
});
|
|
7737
|
+
}
|
|
7738
|
+
};
|
|
7739
|
+
__publicField$f(exports.ColorRemoveEffect, "material", new Material({
|
|
7740
|
+
vert: `precision mediump float;
|
|
7741
|
+
attribute vec2 position;
|
|
7742
|
+
attribute vec2 uv;
|
|
7743
|
+
varying vec2 vUv;
|
|
7744
|
+
void main() {
|
|
7745
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7746
|
+
vUv = uv;
|
|
7747
|
+
}`,
|
|
7748
|
+
frag: `varying vec2 vUv;
|
|
7749
|
+
uniform sampler2D sampler;
|
|
7750
|
+
uniform float epsilon;
|
|
7751
|
+
const int MAX_COLORS = 50;
|
|
7752
|
+
uniform vec3 originalColors[MAX_COLORS];
|
|
7753
|
+
|
|
7754
|
+
void main(void) {
|
|
7755
|
+
vec4 color = texture2D(sampler, vUv);
|
|
7756
|
+
|
|
7757
|
+
for (int i = 0; i < MAX_COLORS; i++) {
|
|
7758
|
+
vec3 origColor = originalColors[i];
|
|
7759
|
+
if (origColor.r < 0.0) {
|
|
7760
|
+
break;
|
|
7604
7761
|
}
|
|
7605
|
-
|
|
7606
|
-
if (
|
|
7607
|
-
|
|
7762
|
+
vec3 colorDiff = origColor - color.rgb;
|
|
7763
|
+
if (length(colorDiff) < epsilon) {
|
|
7764
|
+
gl_FragColor = vec4(0, 0, 0, 0);
|
|
7765
|
+
return;
|
|
7608
7766
|
}
|
|
7609
|
-
const texture = this.root.texture;
|
|
7610
|
-
texture.activate(renderer, 0);
|
|
7611
|
-
QuadUvGeometry.draw(renderer);
|
|
7612
|
-
renderer.texture.unbind(texture);
|
|
7613
|
-
}
|
|
7614
|
-
free() {
|
|
7615
|
-
super.free();
|
|
7616
|
-
this.root.children.internal.forEach((node) => this.root.removeChild(node));
|
|
7617
|
-
this.input.removeEventListeners();
|
|
7618
7767
|
}
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
__decorateClass$
|
|
7768
|
+
|
|
7769
|
+
gl_FragColor = color;
|
|
7770
|
+
}`
|
|
7771
|
+
}));
|
|
7772
|
+
__decorateClass$E([
|
|
7624
7773
|
modernIdoc.property()
|
|
7625
|
-
],
|
|
7626
|
-
__decorateClass$
|
|
7627
|
-
modernIdoc.property(
|
|
7628
|
-
],
|
|
7774
|
+
], exports.ColorRemoveEffect.prototype, "colors", 2);
|
|
7775
|
+
__decorateClass$E([
|
|
7776
|
+
modernIdoc.property()
|
|
7777
|
+
], exports.ColorRemoveEffect.prototype, "epsilon", 2);
|
|
7778
|
+
exports.ColorRemoveEffect = __decorateClass$E([
|
|
7779
|
+
customNode("ColorRemoveEffect")
|
|
7780
|
+
], exports.ColorRemoveEffect);
|
|
7629
7781
|
|
|
7630
|
-
var
|
|
7631
|
-
var
|
|
7632
|
-
|
|
7782
|
+
var __defProp$w = Object.defineProperty;
|
|
7783
|
+
var __getOwnPropDesc$v = Object.getOwnPropertyDescriptor;
|
|
7784
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7785
|
+
var __decorateClass$D = (decorators, target, key, kind) => {
|
|
7786
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$v(target, key) : target;
|
|
7633
7787
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7634
7788
|
if (decorator = decorators[i])
|
|
7635
|
-
result = (decorator(result)) || result;
|
|
7789
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7790
|
+
if (kind && result) __defProp$w(target, key, result);
|
|
7636
7791
|
return result;
|
|
7637
7792
|
};
|
|
7638
|
-
|
|
7793
|
+
var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, key + "" , value);
|
|
7794
|
+
const MAX_COLORS = 50;
|
|
7795
|
+
exports.ColorReplaceEffect = class ColorReplaceEffect extends exports.Effect {
|
|
7796
|
+
_color = new Color();
|
|
7639
7797
|
constructor(properties, children = []) {
|
|
7640
7798
|
super();
|
|
7641
7799
|
this.setProperties(properties).append(children);
|
|
7642
7800
|
}
|
|
7801
|
+
apply(renderer, source) {
|
|
7802
|
+
const colors = this.colors.map((val) => {
|
|
7803
|
+
this._color.value = val[0];
|
|
7804
|
+
const color0 = this._color.toArray().slice(0, 3);
|
|
7805
|
+
this._color.value = val[1];
|
|
7806
|
+
const color1 = this._color.toArray().slice(0, 3);
|
|
7807
|
+
return [
|
|
7808
|
+
color0,
|
|
7809
|
+
color1
|
|
7810
|
+
];
|
|
7811
|
+
});
|
|
7812
|
+
const epsilon = this.epsilon;
|
|
7813
|
+
const originalColors = new Float32Array(MAX_COLORS * 3);
|
|
7814
|
+
const targetColors = new Float32Array(MAX_COLORS * 3);
|
|
7815
|
+
while (colors.length < MAX_COLORS) {
|
|
7816
|
+
colors.push([
|
|
7817
|
+
[-1, 0, 0],
|
|
7818
|
+
[0, 0, 0, 1]
|
|
7819
|
+
]);
|
|
7820
|
+
}
|
|
7821
|
+
colors.slice(0, MAX_COLORS).forEach(([originalColor, targetColor], i) => {
|
|
7822
|
+
originalColors[i * 3] = originalColor[0];
|
|
7823
|
+
originalColors[i * 3 + 1] = originalColor[1];
|
|
7824
|
+
originalColors[i * 3 + 2] = originalColor[2];
|
|
7825
|
+
targetColors[i * 3] = targetColor[0];
|
|
7826
|
+
targetColors[i * 3 + 1] = targetColor[1];
|
|
7827
|
+
targetColors[i * 3 + 2] = targetColor[2];
|
|
7828
|
+
});
|
|
7829
|
+
source.redraw(renderer, () => {
|
|
7830
|
+
QuadUvGeometry.draw(renderer, exports.ColorReplaceEffect.material, {
|
|
7831
|
+
sampler: 0,
|
|
7832
|
+
epsilon,
|
|
7833
|
+
originalColors,
|
|
7834
|
+
targetColors
|
|
7835
|
+
});
|
|
7836
|
+
});
|
|
7837
|
+
}
|
|
7643
7838
|
};
|
|
7644
|
-
exports.
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7839
|
+
__publicField$e(exports.ColorReplaceEffect, "material", new Material({
|
|
7840
|
+
vert: `precision mediump float;
|
|
7841
|
+
attribute vec2 position;
|
|
7842
|
+
attribute vec2 uv;
|
|
7843
|
+
varying vec2 vUv;
|
|
7844
|
+
void main() {
|
|
7845
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7846
|
+
vUv = uv;
|
|
7847
|
+
}`,
|
|
7848
|
+
frag: `varying vec2 vUv;
|
|
7849
|
+
uniform sampler2D sampler;
|
|
7850
|
+
uniform float epsilon;
|
|
7851
|
+
const int MAX_COLORS = ${MAX_COLORS};
|
|
7852
|
+
uniform vec3 originalColors[MAX_COLORS];
|
|
7853
|
+
uniform vec3 targetColors[MAX_COLORS];
|
|
7651
7854
|
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7855
|
+
void main(void) {
|
|
7856
|
+
gl_FragColor = texture2D(sampler, vUv);
|
|
7857
|
+
|
|
7858
|
+
float alpha = gl_FragColor.a;
|
|
7859
|
+
if (alpha < 0.0001) {
|
|
7860
|
+
return;
|
|
7861
|
+
}
|
|
7862
|
+
|
|
7863
|
+
vec3 color = gl_FragColor.rgb / alpha;
|
|
7864
|
+
|
|
7865
|
+
for(int i = 0; i < MAX_COLORS; i++) {
|
|
7866
|
+
vec3 origColor = originalColors[i];
|
|
7867
|
+
if (origColor.r < 0.0) {
|
|
7868
|
+
break;
|
|
7869
|
+
}
|
|
7870
|
+
vec3 colorDiff = origColor - color;
|
|
7871
|
+
if (length(colorDiff) < epsilon) {
|
|
7872
|
+
vec3 targetColor = targetColors[i];
|
|
7873
|
+
gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);
|
|
7874
|
+
return;
|
|
7875
|
+
}
|
|
7876
|
+
}
|
|
7877
|
+
}`
|
|
7878
|
+
}));
|
|
7879
|
+
__decorateClass$D([
|
|
7880
|
+
modernIdoc.property()
|
|
7881
|
+
], exports.ColorReplaceEffect.prototype, "colors", 2);
|
|
7882
|
+
__decorateClass$D([
|
|
7883
|
+
modernIdoc.property()
|
|
7884
|
+
], exports.ColorReplaceEffect.prototype, "epsilon", 2);
|
|
7885
|
+
exports.ColorReplaceEffect = __decorateClass$D([
|
|
7886
|
+
customNode("ColorReplaceEffect")
|
|
7887
|
+
], exports.ColorReplaceEffect);
|
|
7888
|
+
|
|
7889
|
+
var __defProp$v = Object.defineProperty;
|
|
7890
|
+
var __getOwnPropDesc$u = Object.getOwnPropertyDescriptor;
|
|
7891
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7892
|
+
var __decorateClass$C = (decorators, target, key, kind) => {
|
|
7893
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$u(target, key) : target;
|
|
7657
7894
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7658
7895
|
if (decorator = decorators[i])
|
|
7659
7896
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7660
|
-
if (kind && result) __defProp$
|
|
7897
|
+
if (kind && result) __defProp$v(target, key, result);
|
|
7661
7898
|
return result;
|
|
7662
7899
|
};
|
|
7663
7900
|
var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -7763,25 +8000,25 @@ void main(void) {
|
|
|
7763
8000
|
}`,
|
|
7764
8001
|
frag: frag$2
|
|
7765
8002
|
}));
|
|
7766
|
-
__decorateClass$
|
|
8003
|
+
__decorateClass$C([
|
|
7767
8004
|
modernIdoc.property({ default: 4 })
|
|
7768
8005
|
], exports.GaussianBlurEffect.prototype, "strength", 2);
|
|
7769
|
-
__decorateClass$
|
|
8006
|
+
__decorateClass$C([
|
|
7770
8007
|
modernIdoc.property({ default: 3 })
|
|
7771
8008
|
], exports.GaussianBlurEffect.prototype, "quality", 2);
|
|
7772
|
-
exports.GaussianBlurEffect = __decorateClass$
|
|
8009
|
+
exports.GaussianBlurEffect = __decorateClass$C([
|
|
7773
8010
|
customNode("GaussianBlurEffect")
|
|
7774
8011
|
], exports.GaussianBlurEffect);
|
|
7775
8012
|
|
|
7776
|
-
var __defProp$
|
|
7777
|
-
var __getOwnPropDesc$
|
|
7778
|
-
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$
|
|
7779
|
-
var __decorateClass$
|
|
7780
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8013
|
+
var __defProp$u = Object.defineProperty;
|
|
8014
|
+
var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
|
|
8015
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8016
|
+
var __decorateClass$B = (decorators, target, key, kind) => {
|
|
8017
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
|
|
7781
8018
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7782
8019
|
if (decorator = decorators[i])
|
|
7783
8020
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7784
|
-
if (kind && result) __defProp$
|
|
8021
|
+
if (kind && result) __defProp$u(target, key, result);
|
|
7785
8022
|
return result;
|
|
7786
8023
|
};
|
|
7787
8024
|
var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, key + "" , value);
|
|
@@ -7845,34 +8082,34 @@ void main(void) {
|
|
|
7845
8082
|
gl_FragColor = sample;
|
|
7846
8083
|
}`
|
|
7847
8084
|
}));
|
|
7848
|
-
__decorateClass$
|
|
8085
|
+
__decorateClass$B([
|
|
7849
8086
|
modernIdoc.property()
|
|
7850
8087
|
], exports.DropShadowEffect.prototype, "color", 2);
|
|
7851
|
-
__decorateClass$
|
|
8088
|
+
__decorateClass$B([
|
|
7852
8089
|
modernIdoc.property()
|
|
7853
8090
|
], exports.DropShadowEffect.prototype, "blur", 2);
|
|
7854
|
-
__decorateClass$
|
|
8091
|
+
__decorateClass$B([
|
|
7855
8092
|
modernIdoc.property()
|
|
7856
8093
|
], exports.DropShadowEffect.prototype, "offsetX", 2);
|
|
7857
|
-
__decorateClass$
|
|
8094
|
+
__decorateClass$B([
|
|
7858
8095
|
modernIdoc.property()
|
|
7859
8096
|
], exports.DropShadowEffect.prototype, "offsetY", 2);
|
|
7860
|
-
__decorateClass$
|
|
8097
|
+
__decorateClass$B([
|
|
7861
8098
|
modernIdoc.property()
|
|
7862
8099
|
], exports.DropShadowEffect.prototype, "shadowOnly", 2);
|
|
7863
|
-
exports.DropShadowEffect = __decorateClass$
|
|
8100
|
+
exports.DropShadowEffect = __decorateClass$B([
|
|
7864
8101
|
customNode("DropShadowEffect")
|
|
7865
8102
|
], exports.DropShadowEffect);
|
|
7866
8103
|
|
|
7867
|
-
var __defProp$
|
|
7868
|
-
var __getOwnPropDesc$
|
|
7869
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$
|
|
7870
|
-
var __decorateClass$
|
|
7871
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8104
|
+
var __defProp$t = Object.defineProperty;
|
|
8105
|
+
var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
|
|
8106
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8107
|
+
var __decorateClass$A = (decorators, target, key, kind) => {
|
|
8108
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
|
|
7872
8109
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7873
8110
|
if (decorator = decorators[i])
|
|
7874
8111
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7875
|
-
if (kind && result) __defProp$
|
|
8112
|
+
if (kind && result) __defProp$t(target, key, result);
|
|
7876
8113
|
return result;
|
|
7877
8114
|
};
|
|
7878
8115
|
var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, key + "" , value);
|
|
@@ -7917,22 +8154,22 @@ void main(void) {
|
|
|
7917
8154
|
gl_FragColor = vec4(color.rgb * alpha, alpha);
|
|
7918
8155
|
}`
|
|
7919
8156
|
}));
|
|
7920
|
-
__decorateClass$
|
|
8157
|
+
__decorateClass$A([
|
|
7921
8158
|
modernIdoc.property()
|
|
7922
8159
|
], exports.EmbossEffect.prototype, "strength", 2);
|
|
7923
|
-
exports.EmbossEffect = __decorateClass$
|
|
8160
|
+
exports.EmbossEffect = __decorateClass$A([
|
|
7924
8161
|
customNode("EmbossEffect")
|
|
7925
8162
|
], exports.EmbossEffect);
|
|
7926
8163
|
|
|
7927
|
-
var __defProp$
|
|
7928
|
-
var __getOwnPropDesc$
|
|
7929
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$
|
|
7930
|
-
var __decorateClass$
|
|
7931
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8164
|
+
var __defProp$s = Object.defineProperty;
|
|
8165
|
+
var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
|
|
8166
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8167
|
+
var __decorateClass$z = (decorators, target, key, kind) => {
|
|
8168
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
|
|
7932
8169
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7933
8170
|
if (decorator = decorators[i])
|
|
7934
8171
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7935
|
-
if (kind && result) __defProp$
|
|
8172
|
+
if (kind && result) __defProp$s(target, key, result);
|
|
7936
8173
|
return result;
|
|
7937
8174
|
};
|
|
7938
8175
|
var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, key + "" , value);
|
|
@@ -8106,46 +8343,46 @@ void main(void) {
|
|
|
8106
8343
|
gl_FragColor.a = texture2D(sampler, coord).a;
|
|
8107
8344
|
}`
|
|
8108
8345
|
}));
|
|
8109
|
-
__decorateClass$
|
|
8346
|
+
__decorateClass$z([
|
|
8110
8347
|
modernIdoc.property()
|
|
8111
8348
|
], exports.GlitchEffect.prototype, "slices", 2);
|
|
8112
|
-
__decorateClass$
|
|
8349
|
+
__decorateClass$z([
|
|
8113
8350
|
modernIdoc.property()
|
|
8114
8351
|
], exports.GlitchEffect.prototype, "sampleSize", 2);
|
|
8115
|
-
__decorateClass$
|
|
8352
|
+
__decorateClass$z([
|
|
8116
8353
|
modernIdoc.property()
|
|
8117
8354
|
], exports.GlitchEffect.prototype, "offset", 2);
|
|
8118
|
-
__decorateClass$
|
|
8355
|
+
__decorateClass$z([
|
|
8119
8356
|
modernIdoc.property()
|
|
8120
8357
|
], exports.GlitchEffect.prototype, "direction", 2);
|
|
8121
|
-
__decorateClass$
|
|
8358
|
+
__decorateClass$z([
|
|
8122
8359
|
modernIdoc.property()
|
|
8123
8360
|
], exports.GlitchEffect.prototype, "fillMode", 2);
|
|
8124
|
-
__decorateClass$
|
|
8361
|
+
__decorateClass$z([
|
|
8125
8362
|
modernIdoc.property()
|
|
8126
8363
|
], exports.GlitchEffect.prototype, "seed", 2);
|
|
8127
|
-
__decorateClass$
|
|
8364
|
+
__decorateClass$z([
|
|
8128
8365
|
modernIdoc.property()
|
|
8129
8366
|
], exports.GlitchEffect.prototype, "red", 2);
|
|
8130
|
-
__decorateClass$
|
|
8367
|
+
__decorateClass$z([
|
|
8131
8368
|
modernIdoc.property()
|
|
8132
8369
|
], exports.GlitchEffect.prototype, "green", 2);
|
|
8133
|
-
__decorateClass$
|
|
8370
|
+
__decorateClass$z([
|
|
8134
8371
|
modernIdoc.property()
|
|
8135
8372
|
], exports.GlitchEffect.prototype, "blue", 2);
|
|
8136
|
-
exports.GlitchEffect = __decorateClass$
|
|
8373
|
+
exports.GlitchEffect = __decorateClass$z([
|
|
8137
8374
|
customNode("GlitchEffect")
|
|
8138
8375
|
], exports.GlitchEffect);
|
|
8139
8376
|
|
|
8140
|
-
var __defProp$
|
|
8141
|
-
var __getOwnPropDesc$
|
|
8142
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$
|
|
8143
|
-
var __decorateClass$
|
|
8144
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8377
|
+
var __defProp$r = Object.defineProperty;
|
|
8378
|
+
var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
|
|
8379
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8380
|
+
var __decorateClass$y = (decorators, target, key, kind) => {
|
|
8381
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
|
|
8145
8382
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8146
8383
|
if (decorator = decorators[i])
|
|
8147
8384
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8148
|
-
if (kind && result) __defProp$
|
|
8385
|
+
if (kind && result) __defProp$r(target, key, result);
|
|
8149
8386
|
return result;
|
|
8150
8387
|
};
|
|
8151
8388
|
var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
|
|
@@ -8323,39 +8560,39 @@ void main(void) {
|
|
|
8323
8560
|
gl_FragColor = vec4(color.rgb + mist.rgb, color.a);
|
|
8324
8561
|
}`
|
|
8325
8562
|
}));
|
|
8326
|
-
__decorateClass$
|
|
8563
|
+
__decorateClass$y([
|
|
8327
8564
|
modernIdoc.property()
|
|
8328
8565
|
], exports.GodrayEffect.prototype, "time", 2);
|
|
8329
|
-
__decorateClass$
|
|
8566
|
+
__decorateClass$y([
|
|
8330
8567
|
modernIdoc.property()
|
|
8331
8568
|
], exports.GodrayEffect.prototype, "angle", 2);
|
|
8332
|
-
__decorateClass$
|
|
8569
|
+
__decorateClass$y([
|
|
8333
8570
|
modernIdoc.property()
|
|
8334
8571
|
], exports.GodrayEffect.prototype, "gain", 2);
|
|
8335
|
-
__decorateClass$
|
|
8572
|
+
__decorateClass$y([
|
|
8336
8573
|
modernIdoc.property()
|
|
8337
8574
|
], exports.GodrayEffect.prototype, "lacunarity", 2);
|
|
8338
|
-
__decorateClass$
|
|
8575
|
+
__decorateClass$y([
|
|
8339
8576
|
modernIdoc.property()
|
|
8340
8577
|
], exports.GodrayEffect.prototype, "parallel", 2);
|
|
8341
|
-
__decorateClass$
|
|
8578
|
+
__decorateClass$y([
|
|
8342
8579
|
modernIdoc.property()
|
|
8343
8580
|
], exports.GodrayEffect.prototype, "center", 2);
|
|
8344
|
-
__decorateClass$
|
|
8581
|
+
__decorateClass$y([
|
|
8345
8582
|
modernIdoc.property()
|
|
8346
8583
|
], exports.GodrayEffect.prototype, "alpha", 2);
|
|
8347
|
-
exports.GodrayEffect = __decorateClass$
|
|
8584
|
+
exports.GodrayEffect = __decorateClass$y([
|
|
8348
8585
|
customNode("GodrayEffect")
|
|
8349
8586
|
], exports.GodrayEffect);
|
|
8350
8587
|
|
|
8351
|
-
var __defProp$
|
|
8352
|
-
var __getOwnPropDesc$
|
|
8353
|
-
var __decorateClass$
|
|
8354
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8588
|
+
var __defProp$q = Object.defineProperty;
|
|
8589
|
+
var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
|
|
8590
|
+
var __decorateClass$x = (decorators, target, key, kind) => {
|
|
8591
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
|
|
8355
8592
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8356
8593
|
if (decorator = decorators[i])
|
|
8357
8594
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8358
|
-
if (kind && result) __defProp$
|
|
8595
|
+
if (kind && result) __defProp$q(target, key, result);
|
|
8359
8596
|
return result;
|
|
8360
8597
|
};
|
|
8361
8598
|
const frag$1 = `varying vec2 vUv;
|
|
@@ -8445,28 +8682,28 @@ void main() {
|
|
|
8445
8682
|
});
|
|
8446
8683
|
}
|
|
8447
8684
|
};
|
|
8448
|
-
__decorateClass$
|
|
8685
|
+
__decorateClass$x([
|
|
8449
8686
|
modernIdoc.property()
|
|
8450
8687
|
], exports.KawaseBlurEffect.prototype, "strength", 2);
|
|
8451
|
-
__decorateClass$
|
|
8688
|
+
__decorateClass$x([
|
|
8452
8689
|
modernIdoc.property()
|
|
8453
8690
|
], exports.KawaseBlurEffect.prototype, "quality", 2);
|
|
8454
|
-
__decorateClass$
|
|
8691
|
+
__decorateClass$x([
|
|
8455
8692
|
modernIdoc.property()
|
|
8456
8693
|
], exports.KawaseBlurEffect.prototype, "pixelSize", 2);
|
|
8457
|
-
exports.KawaseBlurEffect = __decorateClass$
|
|
8694
|
+
exports.KawaseBlurEffect = __decorateClass$x([
|
|
8458
8695
|
customNode("KawaseBlurEffect")
|
|
8459
8696
|
], exports.KawaseBlurEffect);
|
|
8460
8697
|
|
|
8461
|
-
var __defProp$
|
|
8462
|
-
var __getOwnPropDesc$
|
|
8463
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$
|
|
8464
|
-
var __decorateClass$
|
|
8465
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8698
|
+
var __defProp$p = Object.defineProperty;
|
|
8699
|
+
var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
|
|
8700
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8701
|
+
var __decorateClass$w = (decorators, target, key, kind) => {
|
|
8702
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
|
|
8466
8703
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8467
8704
|
if (decorator = decorators[i])
|
|
8468
8705
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8469
|
-
if (kind && result) __defProp$
|
|
8706
|
+
if (kind && result) __defProp$p(target, key, result);
|
|
8470
8707
|
return result;
|
|
8471
8708
|
};
|
|
8472
8709
|
var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
|
|
@@ -8554,25 +8791,25 @@ void main(void) {
|
|
|
8554
8791
|
}
|
|
8555
8792
|
}`
|
|
8556
8793
|
}));
|
|
8557
|
-
__decorateClass$
|
|
8794
|
+
__decorateClass$w([
|
|
8558
8795
|
modernIdoc.property({ protected: true })
|
|
8559
8796
|
], exports.MaskEffect.prototype, "texture", 2);
|
|
8560
|
-
__decorateClass$
|
|
8797
|
+
__decorateClass$w([
|
|
8561
8798
|
modernIdoc.property({ default: "" })
|
|
8562
8799
|
], exports.MaskEffect.prototype, "src", 2);
|
|
8563
|
-
exports.MaskEffect = __decorateClass$
|
|
8800
|
+
exports.MaskEffect = __decorateClass$w([
|
|
8564
8801
|
customNode("MaskEffect")
|
|
8565
8802
|
], exports.MaskEffect);
|
|
8566
8803
|
|
|
8567
|
-
var __defProp$
|
|
8568
|
-
var __getOwnPropDesc$
|
|
8569
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$
|
|
8570
|
-
var __decorateClass$
|
|
8571
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8804
|
+
var __defProp$o = Object.defineProperty;
|
|
8805
|
+
var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
|
|
8806
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8807
|
+
var __decorateClass$v = (decorators, target, key, kind) => {
|
|
8808
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
|
|
8572
8809
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8573
8810
|
if (decorator = decorators[i])
|
|
8574
8811
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8575
|
-
if (kind && result) __defProp$
|
|
8812
|
+
if (kind && result) __defProp$o(target, key, result);
|
|
8576
8813
|
return result;
|
|
8577
8814
|
};
|
|
8578
8815
|
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -8659,40 +8896,40 @@ void main() {
|
|
|
8659
8896
|
};
|
|
8660
8897
|
__publicField$7(exports.OutlineEffect, "MIN_SAMPLES", 1);
|
|
8661
8898
|
__publicField$7(exports.OutlineEffect, "MAX_SAMPLES", 100);
|
|
8662
|
-
__decorateClass$
|
|
8899
|
+
__decorateClass$v([
|
|
8663
8900
|
modernIdoc.property()
|
|
8664
8901
|
], exports.OutlineEffect.prototype, "color", 2);
|
|
8665
|
-
__decorateClass$
|
|
8902
|
+
__decorateClass$v([
|
|
8666
8903
|
modernIdoc.property()
|
|
8667
8904
|
], exports.OutlineEffect.prototype, "width", 2);
|
|
8668
|
-
__decorateClass$
|
|
8905
|
+
__decorateClass$v([
|
|
8669
8906
|
modernIdoc.property()
|
|
8670
8907
|
], exports.OutlineEffect.prototype, "style", 2);
|
|
8671
|
-
__decorateClass$
|
|
8908
|
+
__decorateClass$v([
|
|
8672
8909
|
modernIdoc.property()
|
|
8673
8910
|
], exports.OutlineEffect.prototype, "image", 2);
|
|
8674
|
-
__decorateClass$
|
|
8911
|
+
__decorateClass$v([
|
|
8675
8912
|
modernIdoc.property()
|
|
8676
8913
|
], exports.OutlineEffect.prototype, "opacity", 2);
|
|
8677
|
-
__decorateClass$
|
|
8914
|
+
__decorateClass$v([
|
|
8678
8915
|
modernIdoc.property()
|
|
8679
8916
|
], exports.OutlineEffect.prototype, "quality", 2);
|
|
8680
|
-
__decorateClass$
|
|
8917
|
+
__decorateClass$v([
|
|
8681
8918
|
modernIdoc.property()
|
|
8682
8919
|
], exports.OutlineEffect.prototype, "knockout", 2);
|
|
8683
|
-
exports.OutlineEffect = __decorateClass$
|
|
8920
|
+
exports.OutlineEffect = __decorateClass$v([
|
|
8684
8921
|
customNode("OutlineEffect")
|
|
8685
8922
|
], exports.OutlineEffect);
|
|
8686
8923
|
|
|
8687
|
-
var __defProp$
|
|
8688
|
-
var __getOwnPropDesc$
|
|
8689
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$
|
|
8690
|
-
var __decorateClass$
|
|
8691
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8924
|
+
var __defProp$n = Object.defineProperty;
|
|
8925
|
+
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
8926
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8927
|
+
var __decorateClass$u = (decorators, target, key, kind) => {
|
|
8928
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
8692
8929
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8693
8930
|
if (decorator = decorators[i])
|
|
8694
8931
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8695
|
-
if (kind && result) __defProp$
|
|
8932
|
+
if (kind && result) __defProp$n(target, key, result);
|
|
8696
8933
|
return result;
|
|
8697
8934
|
};
|
|
8698
8935
|
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
|
|
@@ -8748,22 +8985,22 @@ void main(void) {
|
|
|
8748
8985
|
gl_FragColor = texture2D(sampler, coord);
|
|
8749
8986
|
}`
|
|
8750
8987
|
}));
|
|
8751
|
-
__decorateClass$
|
|
8988
|
+
__decorateClass$u([
|
|
8752
8989
|
modernIdoc.property()
|
|
8753
8990
|
], exports.PixelateEffect.prototype, "strength", 2);
|
|
8754
|
-
exports.PixelateEffect = __decorateClass$
|
|
8991
|
+
exports.PixelateEffect = __decorateClass$u([
|
|
8755
8992
|
customNode("PixelateEffect")
|
|
8756
8993
|
], exports.PixelateEffect);
|
|
8757
8994
|
|
|
8758
|
-
var __defProp$
|
|
8759
|
-
var __getOwnPropDesc$
|
|
8760
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$
|
|
8761
|
-
var __decorateClass$
|
|
8762
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8995
|
+
var __defProp$m = Object.defineProperty;
|
|
8996
|
+
var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
|
|
8997
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8998
|
+
var __decorateClass$t = (decorators, target, key, kind) => {
|
|
8999
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
|
|
8763
9000
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8764
9001
|
if (decorator = decorators[i])
|
|
8765
9002
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8766
|
-
if (kind && result) __defProp$
|
|
9003
|
+
if (kind && result) __defProp$m(target, key, result);
|
|
8767
9004
|
return result;
|
|
8768
9005
|
};
|
|
8769
9006
|
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
|
|
@@ -8876,29 +9113,29 @@ void main() {
|
|
|
8876
9113
|
gl_FragColor = color;
|
|
8877
9114
|
}`
|
|
8878
9115
|
}));
|
|
8879
|
-
__decorateClass$
|
|
9116
|
+
__decorateClass$t([
|
|
8880
9117
|
modernIdoc.property()
|
|
8881
9118
|
], exports.ZoomBlurEffect.prototype, "center", 2);
|
|
8882
|
-
__decorateClass$
|
|
9119
|
+
__decorateClass$t([
|
|
8883
9120
|
modernIdoc.property()
|
|
8884
9121
|
], exports.ZoomBlurEffect.prototype, "innerRadius", 2);
|
|
8885
|
-
__decorateClass$
|
|
9122
|
+
__decorateClass$t([
|
|
8886
9123
|
modernIdoc.property()
|
|
8887
9124
|
], exports.ZoomBlurEffect.prototype, "radius", 2);
|
|
8888
|
-
__decorateClass$
|
|
9125
|
+
__decorateClass$t([
|
|
8889
9126
|
modernIdoc.property()
|
|
8890
9127
|
], exports.ZoomBlurEffect.prototype, "strength", 2);
|
|
8891
|
-
exports.ZoomBlurEffect = __decorateClass$
|
|
9128
|
+
exports.ZoomBlurEffect = __decorateClass$t([
|
|
8892
9129
|
customNode("ZoomBlurEffect")
|
|
8893
9130
|
], exports.ZoomBlurEffect);
|
|
8894
9131
|
|
|
8895
|
-
var __defProp$
|
|
8896
|
-
var __decorateClass$
|
|
9132
|
+
var __defProp$l = Object.defineProperty;
|
|
9133
|
+
var __decorateClass$s = (decorators, target, key, kind) => {
|
|
8897
9134
|
var result = void 0 ;
|
|
8898
9135
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8899
9136
|
if (decorator = decorators[i])
|
|
8900
9137
|
result = (decorator(target, key, result) ) || result;
|
|
8901
|
-
if (result) __defProp$
|
|
9138
|
+
if (result) __defProp$l(target, key, result);
|
|
8902
9139
|
return result;
|
|
8903
9140
|
};
|
|
8904
9141
|
class BaseElement2DFill extends CoreObject {
|
|
@@ -9006,47 +9243,47 @@ class BaseElement2DFill extends CoreObject {
|
|
|
9006
9243
|
});
|
|
9007
9244
|
}
|
|
9008
9245
|
}
|
|
9009
|
-
__decorateClass$
|
|
9246
|
+
__decorateClass$s([
|
|
9010
9247
|
modernIdoc.property({ fallback: true })
|
|
9011
9248
|
], BaseElement2DFill.prototype, "enabled");
|
|
9012
|
-
__decorateClass$
|
|
9249
|
+
__decorateClass$s([
|
|
9013
9250
|
modernIdoc.property()
|
|
9014
9251
|
], BaseElement2DFill.prototype, "color");
|
|
9015
|
-
__decorateClass$
|
|
9252
|
+
__decorateClass$s([
|
|
9016
9253
|
modernIdoc.property()
|
|
9017
9254
|
], BaseElement2DFill.prototype, "image");
|
|
9018
|
-
__decorateClass$
|
|
9255
|
+
__decorateClass$s([
|
|
9019
9256
|
modernIdoc.property()
|
|
9020
9257
|
], BaseElement2DFill.prototype, "linearGradient");
|
|
9021
|
-
__decorateClass$
|
|
9258
|
+
__decorateClass$s([
|
|
9022
9259
|
modernIdoc.property()
|
|
9023
9260
|
], BaseElement2DFill.prototype, "radialGradient");
|
|
9024
|
-
__decorateClass$
|
|
9261
|
+
__decorateClass$s([
|
|
9025
9262
|
modernIdoc.property()
|
|
9026
9263
|
], BaseElement2DFill.prototype, "cropRect");
|
|
9027
|
-
__decorateClass$
|
|
9264
|
+
__decorateClass$s([
|
|
9028
9265
|
modernIdoc.property()
|
|
9029
9266
|
], BaseElement2DFill.prototype, "stretchRect");
|
|
9030
|
-
__decorateClass$
|
|
9267
|
+
__decorateClass$s([
|
|
9031
9268
|
modernIdoc.property()
|
|
9032
9269
|
], BaseElement2DFill.prototype, "dpi");
|
|
9033
|
-
__decorateClass$
|
|
9270
|
+
__decorateClass$s([
|
|
9034
9271
|
modernIdoc.property()
|
|
9035
9272
|
], BaseElement2DFill.prototype, "rotateWithShape");
|
|
9036
|
-
__decorateClass$
|
|
9273
|
+
__decorateClass$s([
|
|
9037
9274
|
modernIdoc.property()
|
|
9038
9275
|
], BaseElement2DFill.prototype, "tile");
|
|
9039
|
-
__decorateClass$
|
|
9276
|
+
__decorateClass$s([
|
|
9040
9277
|
modernIdoc.property()
|
|
9041
9278
|
], BaseElement2DFill.prototype, "opacity");
|
|
9042
9279
|
|
|
9043
|
-
var __defProp$
|
|
9044
|
-
var __decorateClass$
|
|
9280
|
+
var __defProp$k = Object.defineProperty;
|
|
9281
|
+
var __decorateClass$r = (decorators, target, key, kind) => {
|
|
9045
9282
|
var result = void 0 ;
|
|
9046
9283
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9047
9284
|
if (decorator = decorators[i])
|
|
9048
9285
|
result = (decorator(target, key, result) ) || result;
|
|
9049
|
-
if (result) __defProp$
|
|
9286
|
+
if (result) __defProp$k(target, key, result);
|
|
9050
9287
|
return result;
|
|
9051
9288
|
};
|
|
9052
9289
|
class BaseElement2DBackground extends BaseElement2DFill {
|
|
@@ -9056,17 +9293,17 @@ class BaseElement2DBackground extends BaseElement2DFill {
|
|
|
9056
9293
|
);
|
|
9057
9294
|
}
|
|
9058
9295
|
}
|
|
9059
|
-
__decorateClass$
|
|
9296
|
+
__decorateClass$r([
|
|
9060
9297
|
modernIdoc.property()
|
|
9061
9298
|
], BaseElement2DBackground.prototype, "fillWithShape");
|
|
9062
9299
|
|
|
9063
|
-
var __defProp$
|
|
9064
|
-
var __decorateClass$
|
|
9300
|
+
var __defProp$j = Object.defineProperty;
|
|
9301
|
+
var __decorateClass$q = (decorators, target, key, kind) => {
|
|
9065
9302
|
var result = void 0 ;
|
|
9066
9303
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9067
9304
|
if (decorator = decorators[i])
|
|
9068
9305
|
result = (decorator(target, key, result) ) || result;
|
|
9069
|
-
if (result) __defProp$
|
|
9306
|
+
if (result) __defProp$j(target, key, result);
|
|
9070
9307
|
return result;
|
|
9071
9308
|
};
|
|
9072
9309
|
class BaseElement2DForeground extends BaseElement2DFill {
|
|
@@ -9076,17 +9313,17 @@ class BaseElement2DForeground extends BaseElement2DFill {
|
|
|
9076
9313
|
);
|
|
9077
9314
|
}
|
|
9078
9315
|
}
|
|
9079
|
-
__decorateClass$
|
|
9316
|
+
__decorateClass$q([
|
|
9080
9317
|
modernIdoc.property()
|
|
9081
9318
|
], BaseElement2DForeground.prototype, "fillWithShape");
|
|
9082
9319
|
|
|
9083
|
-
var __defProp$
|
|
9084
|
-
var __decorateClass$
|
|
9320
|
+
var __defProp$i = Object.defineProperty;
|
|
9321
|
+
var __decorateClass$p = (decorators, target, key, kind) => {
|
|
9085
9322
|
var result = void 0 ;
|
|
9086
9323
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9087
9324
|
if (decorator = decorators[i])
|
|
9088
9325
|
result = (decorator(target, key, result) ) || result;
|
|
9089
|
-
if (result) __defProp$
|
|
9326
|
+
if (result) __defProp$i(target, key, result);
|
|
9090
9327
|
return result;
|
|
9091
9328
|
};
|
|
9092
9329
|
class BaseElement2DOutline extends BaseElement2DFill {
|
|
@@ -9119,23 +9356,23 @@ class BaseElement2DOutline extends BaseElement2DFill {
|
|
|
9119
9356
|
ctx.stroke({ disableWrapMode });
|
|
9120
9357
|
}
|
|
9121
9358
|
}
|
|
9122
|
-
__decorateClass$
|
|
9359
|
+
__decorateClass$p([
|
|
9123
9360
|
modernIdoc.property({ fallback: "#00000000" })
|
|
9124
9361
|
], BaseElement2DOutline.prototype, "color");
|
|
9125
|
-
__decorateClass$
|
|
9362
|
+
__decorateClass$p([
|
|
9126
9363
|
modernIdoc.property({ fallback: 0 })
|
|
9127
9364
|
], BaseElement2DOutline.prototype, "width");
|
|
9128
|
-
__decorateClass$
|
|
9365
|
+
__decorateClass$p([
|
|
9129
9366
|
modernIdoc.property({ fallback: "solid" })
|
|
9130
9367
|
], BaseElement2DOutline.prototype, "style");
|
|
9131
9368
|
|
|
9132
|
-
var __defProp$
|
|
9133
|
-
var __decorateClass$
|
|
9369
|
+
var __defProp$h = Object.defineProperty;
|
|
9370
|
+
var __decorateClass$o = (decorators, target, key, kind) => {
|
|
9134
9371
|
var result = void 0 ;
|
|
9135
9372
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9136
9373
|
if (decorator = decorators[i])
|
|
9137
9374
|
result = (decorator(target, key, result) ) || result;
|
|
9138
|
-
if (result) __defProp$
|
|
9375
|
+
if (result) __defProp$h(target, key, result);
|
|
9139
9376
|
return result;
|
|
9140
9377
|
};
|
|
9141
9378
|
class BaseElement2DShadow extends CoreObject {
|
|
@@ -9175,29 +9412,29 @@ class BaseElement2DShadow extends CoreObject {
|
|
|
9175
9412
|
}
|
|
9176
9413
|
}
|
|
9177
9414
|
}
|
|
9178
|
-
__decorateClass$
|
|
9415
|
+
__decorateClass$o([
|
|
9179
9416
|
modernIdoc.property({ fallback: true })
|
|
9180
9417
|
], BaseElement2DShadow.prototype, "enabled");
|
|
9181
|
-
__decorateClass$
|
|
9418
|
+
__decorateClass$o([
|
|
9182
9419
|
modernIdoc.property({ fallback: "#000000FF" })
|
|
9183
9420
|
], BaseElement2DShadow.prototype, "color");
|
|
9184
|
-
__decorateClass$
|
|
9421
|
+
__decorateClass$o([
|
|
9185
9422
|
modernIdoc.property({ fallback: 0 })
|
|
9186
9423
|
], BaseElement2DShadow.prototype, "blur");
|
|
9187
|
-
__decorateClass$
|
|
9424
|
+
__decorateClass$o([
|
|
9188
9425
|
modernIdoc.property({ fallback: 0 })
|
|
9189
9426
|
], BaseElement2DShadow.prototype, "offsetY");
|
|
9190
|
-
__decorateClass$
|
|
9427
|
+
__decorateClass$o([
|
|
9191
9428
|
modernIdoc.property({ fallback: 0 })
|
|
9192
9429
|
], BaseElement2DShadow.prototype, "offsetX");
|
|
9193
9430
|
|
|
9194
|
-
var __defProp$
|
|
9195
|
-
var __decorateClass$
|
|
9431
|
+
var __defProp$g = Object.defineProperty;
|
|
9432
|
+
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
9196
9433
|
var result = void 0 ;
|
|
9197
9434
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9198
9435
|
if (decorator = decorators[i])
|
|
9199
9436
|
result = (decorator(target, key, result) ) || result;
|
|
9200
|
-
if (result) __defProp$
|
|
9437
|
+
if (result) __defProp$g(target, key, result);
|
|
9201
9438
|
return result;
|
|
9202
9439
|
};
|
|
9203
9440
|
class BaseElement2DShape extends CoreObject {
|
|
@@ -9272,19 +9509,19 @@ class BaseElement2DShape extends CoreObject {
|
|
|
9272
9509
|
}
|
|
9273
9510
|
}
|
|
9274
9511
|
}
|
|
9275
|
-
__decorateClass$
|
|
9512
|
+
__decorateClass$n([
|
|
9276
9513
|
modernIdoc.property({ fallback: true })
|
|
9277
9514
|
], BaseElement2DShape.prototype, "enabled");
|
|
9278
|
-
__decorateClass$
|
|
9515
|
+
__decorateClass$n([
|
|
9279
9516
|
modernIdoc.property()
|
|
9280
9517
|
], BaseElement2DShape.prototype, "preset");
|
|
9281
|
-
__decorateClass$
|
|
9518
|
+
__decorateClass$n([
|
|
9282
9519
|
modernIdoc.property()
|
|
9283
9520
|
], BaseElement2DShape.prototype, "svg");
|
|
9284
|
-
__decorateClass$
|
|
9521
|
+
__decorateClass$n([
|
|
9285
9522
|
modernIdoc.property()
|
|
9286
9523
|
], BaseElement2DShape.prototype, "viewBox");
|
|
9287
|
-
__decorateClass$
|
|
9524
|
+
__decorateClass$n([
|
|
9288
9525
|
modernIdoc.property()
|
|
9289
9526
|
], BaseElement2DShape.prototype, "paths");
|
|
9290
9527
|
|
|
@@ -9300,13 +9537,13 @@ for (const key in defaultStyles$1) {
|
|
|
9300
9537
|
modernIdoc.defineProperty(BaseElement2DStyle, key, { fallback });
|
|
9301
9538
|
}
|
|
9302
9539
|
|
|
9303
|
-
var __defProp$
|
|
9304
|
-
var __decorateClass$
|
|
9540
|
+
var __defProp$f = Object.defineProperty;
|
|
9541
|
+
var __decorateClass$m = (decorators, target, key, kind) => {
|
|
9305
9542
|
var result = void 0 ;
|
|
9306
9543
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9307
9544
|
if (decorator = decorators[i])
|
|
9308
9545
|
result = (decorator(target, key, result) ) || result;
|
|
9309
|
-
if (result) __defProp$
|
|
9546
|
+
if (result) __defProp$f(target, key, result);
|
|
9310
9547
|
return result;
|
|
9311
9548
|
};
|
|
9312
9549
|
class BaseElement2DText extends CoreObject {
|
|
@@ -9354,180 +9591,60 @@ class BaseElement2DText extends CoreObject {
|
|
|
9354
9591
|
textAlign: "center",
|
|
9355
9592
|
...this.parent.style.toJSON()
|
|
9356
9593
|
};
|
|
9357
|
-
this.base.requestUpdate();
|
|
9358
|
-
}
|
|
9359
|
-
measure() {
|
|
9360
|
-
this._updateText();
|
|
9361
|
-
return this.base.measure();
|
|
9362
|
-
}
|
|
9363
|
-
updateMeasure() {
|
|
9364
|
-
this.measureResult = this.measure();
|
|
9365
|
-
return this;
|
|
9366
|
-
}
|
|
9367
|
-
canDraw() {
|
|
9368
|
-
return Boolean(
|
|
9369
|
-
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
9370
|
-
);
|
|
9371
|
-
}
|
|
9372
|
-
draw() {
|
|
9373
|
-
const ctx = this.parent.context;
|
|
9374
|
-
this.base.update();
|
|
9375
|
-
this.base.pathSets.forEach((pathSet) => {
|
|
9376
|
-
pathSet.paths.forEach((path) => {
|
|
9377
|
-
ctx.addPath(path);
|
|
9378
|
-
ctx.style = { ...path.style };
|
|
9379
|
-
ctx.fillStyle = void 0;
|
|
9380
|
-
ctx.strokeStyle = void 0;
|
|
9381
|
-
ctx.fill();
|
|
9382
|
-
});
|
|
9383
|
-
});
|
|
9384
|
-
}
|
|
9385
|
-
}
|
|
9386
|
-
__decorateClass$o([
|
|
9387
|
-
modernIdoc.property({ fallback: true })
|
|
9388
|
-
], BaseElement2DText.prototype, "enabled");
|
|
9389
|
-
__decorateClass$o([
|
|
9390
|
-
modernIdoc.property({ alias: "base.content", fallback: () => [] })
|
|
9391
|
-
], BaseElement2DText.prototype, "content");
|
|
9392
|
-
__decorateClass$o([
|
|
9393
|
-
modernIdoc.property({ alias: "base.effects" })
|
|
9394
|
-
], BaseElement2DText.prototype, "effects");
|
|
9395
|
-
__decorateClass$o([
|
|
9396
|
-
modernIdoc.property({ alias: "base.fill" })
|
|
9397
|
-
], BaseElement2DText.prototype, "fill");
|
|
9398
|
-
__decorateClass$o([
|
|
9399
|
-
modernIdoc.property({ alias: "base.outline" })
|
|
9400
|
-
], BaseElement2DText.prototype, "outline");
|
|
9401
|
-
__decorateClass$o([
|
|
9402
|
-
modernIdoc.property({ protected: true, alias: "base.measureDom" })
|
|
9403
|
-
], BaseElement2DText.prototype, "measureDom");
|
|
9404
|
-
__decorateClass$o([
|
|
9405
|
-
modernIdoc.property({ protected: true, alias: "base.fonts" })
|
|
9406
|
-
], BaseElement2DText.prototype, "fonts");
|
|
9407
|
-
|
|
9408
|
-
var __defProp$g = Object.defineProperty;
|
|
9409
|
-
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
9410
|
-
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
9411
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
9412
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9413
|
-
if (decorator = decorators[i])
|
|
9414
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9415
|
-
if (kind && result) __defProp$g(target, key, result);
|
|
9416
|
-
return result;
|
|
9417
|
-
};
|
|
9418
|
-
exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
9419
|
-
position = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
9420
|
-
scale = new Vector2(1, 1).on("update", () => this.updateGlobalTransform());
|
|
9421
|
-
skew = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
9422
|
-
transform = new Transform2D();
|
|
9423
|
-
globalPosition = new Vector2();
|
|
9424
|
-
globalScale = new Vector2();
|
|
9425
|
-
globalSkew = new Vector2();
|
|
9426
|
-
globalTransform = new Transform2D();
|
|
9427
|
-
_parentTransformDirtyId;
|
|
9428
|
-
constructor(properties, nodes = []) {
|
|
9429
|
-
super();
|
|
9430
|
-
this.setProperties(properties).append(nodes);
|
|
9431
|
-
}
|
|
9432
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
9433
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
9434
|
-
switch (key) {
|
|
9435
|
-
case "rotation":
|
|
9436
|
-
this.requestRelayout();
|
|
9437
|
-
break;
|
|
9438
|
-
}
|
|
9439
|
-
}
|
|
9440
|
-
getTransformOrigin() {
|
|
9441
|
-
return new Vector2(0, 0);
|
|
9442
|
-
}
|
|
9443
|
-
getTransform(cb) {
|
|
9444
|
-
const origin = this.getTransformOrigin();
|
|
9445
|
-
const transform = new Transform2D();
|
|
9446
|
-
transform.translate(-origin.x, -origin.y).scale(this.scale.x, this.scale.y).skew(this.skew.x, this.skew.y).rotate(this.rotation);
|
|
9447
|
-
cb?.(transform);
|
|
9448
|
-
transform.translate(this.position.x, this.position.y).translate(origin.x, origin.y);
|
|
9449
|
-
return transform;
|
|
9594
|
+
this.base.requestUpdate();
|
|
9450
9595
|
}
|
|
9451
|
-
|
|
9452
|
-
this.
|
|
9596
|
+
measure() {
|
|
9597
|
+
this._updateText();
|
|
9598
|
+
return this.base.measure();
|
|
9453
9599
|
}
|
|
9454
|
-
|
|
9455
|
-
this.
|
|
9456
|
-
|
|
9457
|
-
if (parent?.globalTransform) {
|
|
9458
|
-
this._parentTransformDirtyId = parent.globalTransform.dirtyId;
|
|
9459
|
-
this.globalScale.set(parent.globalScale.x * this.scale.x, parent.globalScale.y * this.scale.y);
|
|
9460
|
-
this.globalRotation = parent.globalRotation + this.rotation;
|
|
9461
|
-
parent.globalTransform.multiply(this.transform, this.globalTransform);
|
|
9462
|
-
} else {
|
|
9463
|
-
this.globalScale.copy(this.scale);
|
|
9464
|
-
this.globalRotation = this.rotation;
|
|
9465
|
-
this.globalTransform.copy(this.transform);
|
|
9466
|
-
}
|
|
9467
|
-
const [
|
|
9468
|
-
a,
|
|
9469
|
-
c,
|
|
9470
|
-
tx,
|
|
9471
|
-
b,
|
|
9472
|
-
d,
|
|
9473
|
-
ty
|
|
9474
|
-
] = this.globalTransform.toArray();
|
|
9475
|
-
this.globalPosition.set(tx, ty);
|
|
9476
|
-
this.globalSkew.x = Math.atan2(c, a) - this.globalRotation;
|
|
9477
|
-
this.globalSkew.y = Math.atan2(b, d) - this.globalRotation;
|
|
9478
|
-
this.requestRelayout();
|
|
9600
|
+
updateMeasure() {
|
|
9601
|
+
this.measureResult = this.measure();
|
|
9602
|
+
return this;
|
|
9479
9603
|
}
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
globalTransform.multiply(
|
|
9485
|
-
typeof vertTransform === "function" ? vertTransform?.() : vertTransform
|
|
9486
|
-
);
|
|
9487
|
-
[a, c, tx, b, d, ty] = globalTransform.toArray();
|
|
9488
|
-
} else {
|
|
9489
|
-
[a, c, tx, b, d, ty] = this.globalTransform.toArray();
|
|
9490
|
-
}
|
|
9491
|
-
const newVertices = vertices.slice();
|
|
9492
|
-
for (let len = vertices.length, i = 0; i < len; i += 2) {
|
|
9493
|
-
const x = vertices[i];
|
|
9494
|
-
const y = vertices[i + 1];
|
|
9495
|
-
newVertices[i] = a * x + c * y + tx;
|
|
9496
|
-
newVertices[i + 1] = b * x + d * y + ty;
|
|
9497
|
-
}
|
|
9498
|
-
return newVertices;
|
|
9604
|
+
canDraw() {
|
|
9605
|
+
return Boolean(
|
|
9606
|
+
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
9607
|
+
);
|
|
9499
9608
|
}
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
this.
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9609
|
+
draw() {
|
|
9610
|
+
const ctx = this.parent.context;
|
|
9611
|
+
this.base.update();
|
|
9612
|
+
this.base.pathSets.forEach((pathSet) => {
|
|
9613
|
+
pathSet.paths.forEach((path) => {
|
|
9614
|
+
ctx.addPath(path);
|
|
9615
|
+
ctx.style = { ...path.style };
|
|
9616
|
+
ctx.fillStyle = void 0;
|
|
9617
|
+
ctx.strokeStyle = void 0;
|
|
9618
|
+
ctx.fill();
|
|
9619
|
+
});
|
|
9508
9620
|
});
|
|
9509
9621
|
}
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9622
|
+
}
|
|
9623
|
+
__decorateClass$m([
|
|
9624
|
+
modernIdoc.property({ fallback: true })
|
|
9625
|
+
], BaseElement2DText.prototype, "enabled");
|
|
9626
|
+
__decorateClass$m([
|
|
9627
|
+
modernIdoc.property({ alias: "base.content", fallback: () => [] })
|
|
9628
|
+
], BaseElement2DText.prototype, "content");
|
|
9629
|
+
__decorateClass$m([
|
|
9630
|
+
modernIdoc.property({ alias: "base.effects" })
|
|
9631
|
+
], BaseElement2DText.prototype, "effects");
|
|
9632
|
+
__decorateClass$m([
|
|
9633
|
+
modernIdoc.property({ alias: "base.fill" })
|
|
9634
|
+
], BaseElement2DText.prototype, "fill");
|
|
9635
|
+
__decorateClass$m([
|
|
9636
|
+
modernIdoc.property({ alias: "base.outline" })
|
|
9637
|
+
], BaseElement2DText.prototype, "outline");
|
|
9638
|
+
__decorateClass$m([
|
|
9639
|
+
modernIdoc.property({ protected: true, alias: "base.measureDom" })
|
|
9640
|
+
], BaseElement2DText.prototype, "measureDom");
|
|
9641
|
+
__decorateClass$m([
|
|
9642
|
+
modernIdoc.property({ protected: true, alias: "base.fonts" })
|
|
9643
|
+
], BaseElement2DText.prototype, "fonts");
|
|
9527
9644
|
|
|
9528
|
-
var __getOwnPropDesc$
|
|
9529
|
-
var __decorateClass$
|
|
9530
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
9645
|
+
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
9646
|
+
var __decorateClass$l = (decorators, target, key, kind) => {
|
|
9647
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
|
|
9531
9648
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9532
9649
|
if (decorator = decorators[i])
|
|
9533
9650
|
result = (decorator(result)) || result;
|
|
@@ -9751,15 +9868,46 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
9751
9868
|
maxY - minY
|
|
9752
9869
|
);
|
|
9753
9870
|
}
|
|
9871
|
+
// protected _rectsOverlap(r1: any, r2: any): boolean {
|
|
9872
|
+
// return (
|
|
9873
|
+
// r1.x < r2.x + r2.width
|
|
9874
|
+
// && r1.x + r1.width > r2.x
|
|
9875
|
+
// && r1.y < r2.y + r2.height
|
|
9876
|
+
// && r1.y + r1.height > r2.y
|
|
9877
|
+
// )
|
|
9878
|
+
// }
|
|
9879
|
+
// TODO
|
|
9880
|
+
// override isVisibleInTree(): boolean {
|
|
9881
|
+
// if (this._tree) {
|
|
9882
|
+
// const root = this._tree.root
|
|
9883
|
+
// const camera = root.canvasTransform.inverse()
|
|
9884
|
+
// const { x, y, width, height } = root
|
|
9885
|
+
// const p1 = camera.applyToPoint(x, y)
|
|
9886
|
+
// const p2 = camera.applyToPoint(x + width, y)
|
|
9887
|
+
// const p3 = camera.applyToPoint(x + width, y + height)
|
|
9888
|
+
// const p4 = camera.applyToPoint(x, y + height)
|
|
9889
|
+
// const pts = [p1, p2, p3, p4]
|
|
9890
|
+
// const xs = pts.map(p => p[0])
|
|
9891
|
+
// const ys = pts.map(p => p[1])
|
|
9892
|
+
// const minX = Math.min(...xs)
|
|
9893
|
+
// const maxX = Math.max(...xs)
|
|
9894
|
+
// const minY = Math.min(...ys)
|
|
9895
|
+
// const maxY = Math.max(...ys)
|
|
9896
|
+
// const rect2 = {
|
|
9897
|
+
// x: minX,
|
|
9898
|
+
// y: minY,
|
|
9899
|
+
// width: maxX - minX,
|
|
9900
|
+
// height: maxY - minY,
|
|
9901
|
+
// }
|
|
9902
|
+
// if (!this._rectsOverlap(rect2, this.getRect())) {
|
|
9903
|
+
// return false
|
|
9904
|
+
// }
|
|
9905
|
+
// }
|
|
9906
|
+
// return super.isVisibleInTree()
|
|
9907
|
+
// }
|
|
9754
9908
|
_updateOverflow() {
|
|
9755
9909
|
if (this.style.overflow === "hidden") {
|
|
9756
|
-
|
|
9757
|
-
this.mask = {
|
|
9758
|
-
x: rect.x,
|
|
9759
|
-
y: rect.y,
|
|
9760
|
-
width: rect.width,
|
|
9761
|
-
height: rect.height
|
|
9762
|
-
};
|
|
9910
|
+
this.mask = this.getRect().toJSON();
|
|
9763
9911
|
} else {
|
|
9764
9912
|
this.mask = void 0;
|
|
9765
9913
|
}
|
|
@@ -9862,7 +10010,7 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
9862
10010
|
});
|
|
9863
10011
|
}
|
|
9864
10012
|
};
|
|
9865
|
-
exports.BaseElement2D = __decorateClass$
|
|
10013
|
+
exports.BaseElement2D = __decorateClass$l([
|
|
9866
10014
|
customNode("BaseElement2D")
|
|
9867
10015
|
], exports.BaseElement2D);
|
|
9868
10016
|
|
|
@@ -9882,9 +10030,16 @@ for (const key in defaultStyles) {
|
|
|
9882
10030
|
modernIdoc.defineProperty(Element2DStyle, key, { fallback: defaultStyles[key] });
|
|
9883
10031
|
}
|
|
9884
10032
|
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
10033
|
+
class FlexElement2DStyle extends BaseElement2DStyle {
|
|
10034
|
+
constructor(properties) {
|
|
10035
|
+
super();
|
|
10036
|
+
this.setProperties(properties);
|
|
10037
|
+
}
|
|
10038
|
+
}
|
|
10039
|
+
|
|
10040
|
+
var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
|
|
10041
|
+
var __decorateClass$k = (decorators, target, key, kind) => {
|
|
10042
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
|
|
9888
10043
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9889
10044
|
if (decorator = decorators[i])
|
|
9890
10045
|
result = (decorator(result)) || result;
|
|
@@ -9935,17 +10090,10 @@ exports.Element2D = class Element2D extends exports.BaseElement2D {
|
|
|
9935
10090
|
}
|
|
9936
10091
|
}
|
|
9937
10092
|
};
|
|
9938
|
-
exports.Element2D = __decorateClass$
|
|
10093
|
+
exports.Element2D = __decorateClass$k([
|
|
9939
10094
|
customNode("Element2D")
|
|
9940
10095
|
], exports.Element2D);
|
|
9941
10096
|
|
|
9942
|
-
class FlexElement2DStyle extends BaseElement2DStyle {
|
|
9943
|
-
constructor(properties) {
|
|
9944
|
-
super();
|
|
9945
|
-
this.setProperties(properties);
|
|
9946
|
-
}
|
|
9947
|
-
}
|
|
9948
|
-
|
|
9949
10097
|
const alignMap = {
|
|
9950
10098
|
"auto": load.Align.Auto,
|
|
9951
10099
|
"flex-start": load.Align.FlexStart,
|
|
@@ -10187,9 +10335,9 @@ class FlexLayout {
|
|
|
10187
10335
|
}
|
|
10188
10336
|
}
|
|
10189
10337
|
|
|
10190
|
-
var __getOwnPropDesc$
|
|
10191
|
-
var __decorateClass$
|
|
10192
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
10338
|
+
var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
|
|
10339
|
+
var __decorateClass$j = (decorators, target, key, kind) => {
|
|
10340
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
|
|
10193
10341
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10194
10342
|
if (decorator = decorators[i])
|
|
10195
10343
|
result = (decorator(result)) || result;
|
|
@@ -10266,18 +10414,18 @@ exports.FlexElement2D = class FlexElement2D extends exports.BaseElement2D {
|
|
|
10266
10414
|
}
|
|
10267
10415
|
}
|
|
10268
10416
|
};
|
|
10269
|
-
exports.FlexElement2D = __decorateClass$
|
|
10417
|
+
exports.FlexElement2D = __decorateClass$j([
|
|
10270
10418
|
customNode("FlexElement2D")
|
|
10271
10419
|
], exports.FlexElement2D);
|
|
10272
10420
|
|
|
10273
|
-
var __defProp$
|
|
10274
|
-
var __getOwnPropDesc$
|
|
10275
|
-
var __decorateClass$
|
|
10276
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
10421
|
+
var __defProp$e = Object.defineProperty;
|
|
10422
|
+
var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
|
|
10423
|
+
var __decorateClass$i = (decorators, target, key, kind) => {
|
|
10424
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
|
|
10277
10425
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10278
10426
|
if (decorator = decorators[i])
|
|
10279
10427
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10280
|
-
if (kind && result) __defProp$
|
|
10428
|
+
if (kind && result) __defProp$e(target, key, result);
|
|
10281
10429
|
return result;
|
|
10282
10430
|
};
|
|
10283
10431
|
exports.Image2D = class Image2D extends exports.Element2D {
|
|
@@ -10413,19 +10561,19 @@ exports.Image2D = class Image2D extends exports.Element2D {
|
|
|
10413
10561
|
});
|
|
10414
10562
|
}
|
|
10415
10563
|
};
|
|
10416
|
-
__decorateClass$
|
|
10564
|
+
__decorateClass$i([
|
|
10417
10565
|
modernIdoc.property({ protected: true })
|
|
10418
10566
|
], exports.Image2D.prototype, "texture", 2);
|
|
10419
|
-
__decorateClass$
|
|
10567
|
+
__decorateClass$i([
|
|
10420
10568
|
modernIdoc.property({ fallback: "" })
|
|
10421
10569
|
], exports.Image2D.prototype, "src", 2);
|
|
10422
|
-
__decorateClass$
|
|
10570
|
+
__decorateClass$i([
|
|
10423
10571
|
modernIdoc.property()
|
|
10424
10572
|
], exports.Image2D.prototype, "srcRect", 2);
|
|
10425
|
-
__decorateClass$
|
|
10573
|
+
__decorateClass$i([
|
|
10426
10574
|
modernIdoc.property({ fallback: false })
|
|
10427
10575
|
], exports.Image2D.prototype, "gif", 2);
|
|
10428
|
-
exports.Image2D = __decorateClass$
|
|
10576
|
+
exports.Image2D = __decorateClass$i([
|
|
10429
10577
|
customNode("Image2D")
|
|
10430
10578
|
], exports.Image2D);
|
|
10431
10579
|
|
|
@@ -10449,14 +10597,14 @@ class TextureRect2D extends exports.Element2D {
|
|
|
10449
10597
|
}
|
|
10450
10598
|
}
|
|
10451
10599
|
|
|
10452
|
-
var __defProp$
|
|
10453
|
-
var __getOwnPropDesc$
|
|
10454
|
-
var __decorateClass$
|
|
10455
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
10600
|
+
var __defProp$d = Object.defineProperty;
|
|
10601
|
+
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
10602
|
+
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
10603
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
10456
10604
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10457
10605
|
if (decorator = decorators[i])
|
|
10458
10606
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10459
|
-
if (kind && result) __defProp$
|
|
10607
|
+
if (kind && result) __defProp$d(target, key, result);
|
|
10460
10608
|
return result;
|
|
10461
10609
|
};
|
|
10462
10610
|
exports.Lottie2D = class Lottie2D extends TextureRect2D {
|
|
@@ -10499,189 +10647,13 @@ exports.Lottie2D = class Lottie2D extends TextureRect2D {
|
|
|
10499
10647
|
super._process(delta);
|
|
10500
10648
|
}
|
|
10501
10649
|
};
|
|
10502
|
-
__decorateClass$
|
|
10650
|
+
__decorateClass$h([
|
|
10503
10651
|
modernIdoc.property({ fallback: "" })
|
|
10504
10652
|
], exports.Lottie2D.prototype, "src", 2);
|
|
10505
|
-
exports.Lottie2D = __decorateClass$
|
|
10653
|
+
exports.Lottie2D = __decorateClass$h([
|
|
10506
10654
|
customNode("Lottie2D")
|
|
10507
10655
|
], exports.Lottie2D);
|
|
10508
10656
|
|
|
10509
|
-
var __defProp$d = Object.defineProperty;
|
|
10510
|
-
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
10511
|
-
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
10512
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
10513
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10514
|
-
if (decorator = decorators[i])
|
|
10515
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10516
|
-
if (kind && result) __defProp$d(target, key, result);
|
|
10517
|
-
return result;
|
|
10518
|
-
};
|
|
10519
|
-
const textStyles = new Set(Object.keys(modernText.textDefaultStyle));
|
|
10520
|
-
exports.Text2D = class Text2D extends TextureRect2D {
|
|
10521
|
-
texture = new CanvasTexture();
|
|
10522
|
-
base = new modernText.Text();
|
|
10523
|
-
measureResult;
|
|
10524
|
-
_subTextsCount = 0;
|
|
10525
|
-
constructor(properties, children = []) {
|
|
10526
|
-
super();
|
|
10527
|
-
this.setProperties(properties);
|
|
10528
|
-
this.append(children);
|
|
10529
|
-
if (properties?.plugins) {
|
|
10530
|
-
properties.plugins.forEach((plugin) => {
|
|
10531
|
-
this.base.use(plugin);
|
|
10532
|
-
});
|
|
10533
|
-
}
|
|
10534
|
-
}
|
|
10535
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
10536
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
10537
|
-
switch (key) {
|
|
10538
|
-
case "content":
|
|
10539
|
-
case "effects":
|
|
10540
|
-
case "measureDOM":
|
|
10541
|
-
case "fonts":
|
|
10542
|
-
case "split":
|
|
10543
|
-
this._updateSplit();
|
|
10544
|
-
this.requestRedraw();
|
|
10545
|
-
break;
|
|
10546
|
-
}
|
|
10547
|
-
if (this._subTextsCount && key === "effects") {
|
|
10548
|
-
this._getSubTexts().forEach((child) => {
|
|
10549
|
-
child.setProperties({ [key]: value });
|
|
10550
|
-
});
|
|
10551
|
-
}
|
|
10552
|
-
}
|
|
10553
|
-
_updateBase() {
|
|
10554
|
-
this.base.style = this.style.toJSON();
|
|
10555
|
-
this.emit("updateBase", this.base);
|
|
10556
|
-
this.base.requestUpdate();
|
|
10557
|
-
}
|
|
10558
|
-
_updateStyleProperty(key, value, oldValue) {
|
|
10559
|
-
switch (key) {
|
|
10560
|
-
case "left":
|
|
10561
|
-
case "top":
|
|
10562
|
-
case "width":
|
|
10563
|
-
case "height":
|
|
10564
|
-
this.requestRedraw();
|
|
10565
|
-
break;
|
|
10566
|
-
default:
|
|
10567
|
-
super._updateStyleProperty(key, value, oldValue);
|
|
10568
|
-
break;
|
|
10569
|
-
}
|
|
10570
|
-
switch (key) {
|
|
10571
|
-
case "width":
|
|
10572
|
-
if (this.split) {
|
|
10573
|
-
this._updateSubTexts();
|
|
10574
|
-
}
|
|
10575
|
-
break;
|
|
10576
|
-
}
|
|
10577
|
-
if (typeof key === "string" && textStyles.has(key)) {
|
|
10578
|
-
if (this._subTextsCount && key !== "width" && key !== "height") {
|
|
10579
|
-
this._getSubTexts().forEach((child) => {
|
|
10580
|
-
child.style.setProperties({ [key]: value });
|
|
10581
|
-
});
|
|
10582
|
-
}
|
|
10583
|
-
this.requestRedraw();
|
|
10584
|
-
}
|
|
10585
|
-
}
|
|
10586
|
-
_getSubTexts() {
|
|
10587
|
-
return this.children.front.filter((node) => node instanceof exports.Text2D);
|
|
10588
|
-
}
|
|
10589
|
-
_updateSubTexts() {
|
|
10590
|
-
const subTexts = this._getSubTexts();
|
|
10591
|
-
let i = 0;
|
|
10592
|
-
if (this.split) {
|
|
10593
|
-
this.updateMeasure().measureResult?.paragraphs.forEach((p) => {
|
|
10594
|
-
p.fragments.forEach((f) => {
|
|
10595
|
-
f.characters.forEach((c) => {
|
|
10596
|
-
const child = subTexts[i];
|
|
10597
|
-
if (child) {
|
|
10598
|
-
child.style.left = c.inlineBox.left;
|
|
10599
|
-
child.style.top = c.inlineBox.top;
|
|
10600
|
-
}
|
|
10601
|
-
i++;
|
|
10602
|
-
});
|
|
10603
|
-
});
|
|
10604
|
-
});
|
|
10605
|
-
}
|
|
10606
|
-
}
|
|
10607
|
-
measure() {
|
|
10608
|
-
this._updateBase();
|
|
10609
|
-
return this.base.measure();
|
|
10610
|
-
}
|
|
10611
|
-
updateMeasure() {
|
|
10612
|
-
this.measureResult = this.measure();
|
|
10613
|
-
const { boundingBox } = this.measureResult;
|
|
10614
|
-
const { left, top } = this.style;
|
|
10615
|
-
this.position.x = left + Math.min(0, boundingBox.left);
|
|
10616
|
-
this.position.y = top + Math.min(0, boundingBox.top);
|
|
10617
|
-
this.size.width = boundingBox.width;
|
|
10618
|
-
this.size.height = boundingBox.height;
|
|
10619
|
-
return this;
|
|
10620
|
-
}
|
|
10621
|
-
_updateSplit() {
|
|
10622
|
-
if (this._subTextsCount) {
|
|
10623
|
-
this.children.front.forEach((child) => this.removeChild(child));
|
|
10624
|
-
this._subTextsCount = 0;
|
|
10625
|
-
}
|
|
10626
|
-
if (this.split) {
|
|
10627
|
-
this.measure().paragraphs.forEach((p) => {
|
|
10628
|
-
p.fragments.forEach((f) => {
|
|
10629
|
-
f.characters.forEach((c) => {
|
|
10630
|
-
this.append(
|
|
10631
|
-
new exports.Text2D({
|
|
10632
|
-
internalMode: "front",
|
|
10633
|
-
style: {
|
|
10634
|
-
...c.computedStyle,
|
|
10635
|
-
left: c.inlineBox.x,
|
|
10636
|
-
top: c.inlineBox.y,
|
|
10637
|
-
width: 0,
|
|
10638
|
-
height: 0
|
|
10639
|
-
},
|
|
10640
|
-
content: c.content,
|
|
10641
|
-
effects: this.effects,
|
|
10642
|
-
fonts: this.fonts
|
|
10643
|
-
})
|
|
10644
|
-
);
|
|
10645
|
-
this._subTextsCount++;
|
|
10646
|
-
});
|
|
10647
|
-
});
|
|
10648
|
-
});
|
|
10649
|
-
}
|
|
10650
|
-
}
|
|
10651
|
-
_redraw() {
|
|
10652
|
-
this.updateMeasure();
|
|
10653
|
-
return super._redraw();
|
|
10654
|
-
}
|
|
10655
|
-
_drawContent() {
|
|
10656
|
-
if (!this.split) {
|
|
10657
|
-
this.base.render({
|
|
10658
|
-
pixelRatio: this.texture.pixelRatio,
|
|
10659
|
-
view: this.texture.source
|
|
10660
|
-
});
|
|
10661
|
-
this.texture.requestUpload();
|
|
10662
|
-
super._drawContent();
|
|
10663
|
-
}
|
|
10664
|
-
}
|
|
10665
|
-
};
|
|
10666
|
-
__decorateClass$h([
|
|
10667
|
-
modernIdoc.property({ fallback: false })
|
|
10668
|
-
], exports.Text2D.prototype, "split", 2);
|
|
10669
|
-
__decorateClass$h([
|
|
10670
|
-
modernIdoc.property({ alias: "base.content" })
|
|
10671
|
-
], exports.Text2D.prototype, "content", 2);
|
|
10672
|
-
__decorateClass$h([
|
|
10673
|
-
modernIdoc.property({ alias: "base.effects" })
|
|
10674
|
-
], exports.Text2D.prototype, "effects", 2);
|
|
10675
|
-
__decorateClass$h([
|
|
10676
|
-
modernIdoc.property({ protected: true, alias: "base.measureDOM" })
|
|
10677
|
-
], exports.Text2D.prototype, "measureDOM", 2);
|
|
10678
|
-
__decorateClass$h([
|
|
10679
|
-
modernIdoc.property({ protected: true, alias: "base.fonts" })
|
|
10680
|
-
], exports.Text2D.prototype, "fonts", 2);
|
|
10681
|
-
exports.Text2D = __decorateClass$h([
|
|
10682
|
-
customNode("Text2D")
|
|
10683
|
-
], exports.Text2D);
|
|
10684
|
-
|
|
10685
10657
|
var __defProp$c = Object.defineProperty;
|
|
10686
10658
|
var __decorateClass$g = (decorators, target, key, kind) => {
|
|
10687
10659
|
var result = void 0 ;
|