modern-canvas 0.6.12 → 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 +1676 -1693
- package/dist/index.d.cts +84 -106
- package/dist/index.d.mts +84 -106
- package/dist/index.d.ts +84 -106
- package/dist/index.js +50 -44
- package/dist/index.mjs +1679 -1696
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -961,6 +961,8 @@ class CoreObject extends modernIdoc.EventEmitter {
|
|
|
961
961
|
if (value && typeof value === "object") {
|
|
962
962
|
if ("toJSON" in value && typeof value.toJSON === "function") {
|
|
963
963
|
json[key] = value.toJSON();
|
|
964
|
+
} else if (Array.isArray(value)) {
|
|
965
|
+
json[key] = [...value];
|
|
964
966
|
} else {
|
|
965
967
|
json[key] = { ...value };
|
|
966
968
|
}
|
|
@@ -1903,6 +1905,14 @@ class Rect2 {
|
|
|
1903
1905
|
toArray() {
|
|
1904
1906
|
return [this.x, this.y, this.width, this.height];
|
|
1905
1907
|
}
|
|
1908
|
+
toJSON() {
|
|
1909
|
+
return {
|
|
1910
|
+
x: this.x,
|
|
1911
|
+
y: this.y,
|
|
1912
|
+
width: this.width,
|
|
1913
|
+
height: this.height
|
|
1914
|
+
};
|
|
1915
|
+
}
|
|
1906
1916
|
}
|
|
1907
1917
|
|
|
1908
1918
|
class Transform2D extends Matrix3 {
|
|
@@ -2078,7 +2088,7 @@ class Vector3 extends Vector {
|
|
|
2078
2088
|
}
|
|
2079
2089
|
|
|
2080
2090
|
var __defProp$Q = Object.defineProperty;
|
|
2081
|
-
var __decorateClass$
|
|
2091
|
+
var __decorateClass$Z = (decorators, target, key, kind) => {
|
|
2082
2092
|
var result = void 0 ;
|
|
2083
2093
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2084
2094
|
if (decorator = decorators[i])
|
|
@@ -2126,10 +2136,10 @@ class MainLoop extends CoreObject {
|
|
|
2126
2136
|
this.stop();
|
|
2127
2137
|
}
|
|
2128
2138
|
}
|
|
2129
|
-
__decorateClass$
|
|
2130
|
-
modernIdoc.property({ fallback:
|
|
2139
|
+
__decorateClass$Z([
|
|
2140
|
+
modernIdoc.property({ fallback: 60 })
|
|
2131
2141
|
], MainLoop.prototype, "fps");
|
|
2132
|
-
__decorateClass$
|
|
2142
|
+
__decorateClass$Z([
|
|
2133
2143
|
modernIdoc.property({ fallback: 1 })
|
|
2134
2144
|
], MainLoop.prototype, "speed");
|
|
2135
2145
|
|
|
@@ -2445,7 +2455,7 @@ attribute vec4 aColorMatrixOffset;
|
|
|
2445
2455
|
attribute vec4 aDisableWrapMode;
|
|
2446
2456
|
|
|
2447
2457
|
uniform mat3 projectionMatrix;
|
|
2448
|
-
uniform mat3
|
|
2458
|
+
uniform mat3 worldTransformMatrix;
|
|
2449
2459
|
uniform vec4 modulate;
|
|
2450
2460
|
|
|
2451
2461
|
varying float vTextureId;
|
|
@@ -2457,8 +2467,14 @@ varying vec4 vColorMatrixOffset;
|
|
|
2457
2467
|
varying vec4 vDisableWrapMode;
|
|
2458
2468
|
|
|
2459
2469
|
void main(void) {
|
|
2470
|
+
mat3 modelMatrix = mat3(
|
|
2471
|
+
1.0, 0.0, 0.0,
|
|
2472
|
+
0.0, 1.0, 0.0,
|
|
2473
|
+
0.0, 0.0, 1.0
|
|
2474
|
+
);
|
|
2460
2475
|
vTextureId = aTextureId;
|
|
2461
|
-
|
|
2476
|
+
mat3 modelViewProjectionMatrix = projectionMatrix * worldTransformMatrix * modelMatrix;
|
|
2477
|
+
gl_Position = vec4((modelViewProjectionMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);
|
|
2462
2478
|
vUv = aUv;
|
|
2463
2479
|
vModulate = aModulate * modulate;
|
|
2464
2480
|
vBackgroundColor = aBackgroundColor;
|
|
@@ -2549,7 +2565,6 @@ void main(void) {
|
|
|
2549
2565
|
renderer2.program.updateUniforms(program, {
|
|
2550
2566
|
samplers,
|
|
2551
2567
|
modulate: [1, 1, 1, 1],
|
|
2552
|
-
translationMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
2553
2568
|
...renderer2.program.uniforms
|
|
2554
2569
|
});
|
|
2555
2570
|
renderer2.vertexArray.bind(vao ?? vertexArray);
|
|
@@ -3204,7 +3219,8 @@ class WebGLProgramModule extends WebGLModule {
|
|
|
3204
3219
|
}
|
|
3205
3220
|
boundProgram = null;
|
|
3206
3221
|
uniforms = {
|
|
3207
|
-
projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
|
|
3222
|
+
projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
3223
|
+
worldTransformMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
|
|
3208
3224
|
};
|
|
3209
3225
|
create(options) {
|
|
3210
3226
|
const program = this.gl.createProgram();
|
|
@@ -3406,7 +3422,10 @@ ${gl.getShaderInfoLog(shader)}`);
|
|
|
3406
3422
|
reset() {
|
|
3407
3423
|
super.reset();
|
|
3408
3424
|
this.boundProgram = null;
|
|
3409
|
-
this.uniforms = {
|
|
3425
|
+
this.uniforms = {
|
|
3426
|
+
projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
3427
|
+
worldTransformMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
|
|
3428
|
+
};
|
|
3410
3429
|
}
|
|
3411
3430
|
free() {
|
|
3412
3431
|
super.free();
|
|
@@ -3446,6 +3465,33 @@ function getVarTypeSize(type) {
|
|
|
3446
3465
|
}
|
|
3447
3466
|
}
|
|
3448
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
|
+
}
|
|
3449
3495
|
class WebGLScissorModule extends WebGLModule {
|
|
3450
3496
|
install(renderer) {
|
|
3451
3497
|
super.install(renderer);
|
|
@@ -3471,19 +3517,21 @@ class WebGLScissorModule extends WebGLModule {
|
|
|
3471
3517
|
}
|
|
3472
3518
|
use() {
|
|
3473
3519
|
const renderer = this._renderer;
|
|
3474
|
-
const { pixelRatio, mask, viewport, screen, gl } = renderer;
|
|
3475
|
-
const
|
|
3476
|
-
|
|
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;
|
|
3477
3525
|
if (viewport.boundViewport) {
|
|
3478
|
-
|
|
3526
|
+
scissorY = viewport.boundViewport.height - (height + y) * pixelRatio;
|
|
3479
3527
|
} else {
|
|
3480
|
-
|
|
3528
|
+
scissorY = (screen.height - (height + y)) * pixelRatio;
|
|
3481
3529
|
}
|
|
3482
3530
|
gl.scissor(
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3531
|
+
x * pixelRatio,
|
|
3532
|
+
scissorY,
|
|
3533
|
+
width * pixelRatio,
|
|
3534
|
+
height * pixelRatio
|
|
3487
3535
|
);
|
|
3488
3536
|
}
|
|
3489
3537
|
}
|
|
@@ -4160,15 +4208,13 @@ class WebGLRenderer extends Renderer {
|
|
|
4160
4208
|
this.view?.removeEventListener("webglcontextrestored", this._onContextRestored, false);
|
|
4161
4209
|
this.extensions.loseContext?.loseContext();
|
|
4162
4210
|
}
|
|
4163
|
-
toPixels() {
|
|
4164
|
-
const width = this.gl.drawingBufferWidth;
|
|
4165
|
-
const height = this.gl.drawingBufferHeight;
|
|
4211
|
+
toPixels(x = 0, y = 0, width = this.gl.drawingBufferWidth, height = this.gl.drawingBufferHeight) {
|
|
4166
4212
|
const length = width * height * 4;
|
|
4167
4213
|
const row = width * 4;
|
|
4168
4214
|
const end = (height - 1) * row;
|
|
4169
4215
|
const flipedPixels = new Uint8Array(length);
|
|
4170
4216
|
const pixels = new Uint8ClampedArray(length);
|
|
4171
|
-
this.gl.readPixels(
|
|
4217
|
+
this.gl.readPixels(x, y, width, height, this.gl.RGBA, this.gl.UNSIGNED_BYTE, flipedPixels);
|
|
4172
4218
|
for (let i = 0; i < length; i += row) {
|
|
4173
4219
|
pixels.set(flipedPixels.subarray(i, i + row), end - i);
|
|
4174
4220
|
}
|
|
@@ -4200,152 +4246,6 @@ class FontLoader extends Loader {
|
|
|
4200
4246
|
}
|
|
4201
4247
|
}
|
|
4202
4248
|
|
|
4203
|
-
const defaultFilters = {
|
|
4204
|
-
"brightness": 1,
|
|
4205
|
-
"contrast": 1,
|
|
4206
|
-
"grayscale": 0,
|
|
4207
|
-
"hue-rotate": 0,
|
|
4208
|
-
"invert": 0,
|
|
4209
|
-
"opacity": 1,
|
|
4210
|
-
"saturate": 1,
|
|
4211
|
-
"sepia": 0
|
|
4212
|
-
};
|
|
4213
|
-
function parseCSSFilter(filter) {
|
|
4214
|
-
const m = new ColorMatrix();
|
|
4215
|
-
if (filter === "none") {
|
|
4216
|
-
return m;
|
|
4217
|
-
}
|
|
4218
|
-
const filters = parseCssFunctions(filter).reduce((filter2, { name, args }) => {
|
|
4219
|
-
filter2[name] = args[0].normalizedIntValue;
|
|
4220
|
-
return filter2;
|
|
4221
|
-
}, {});
|
|
4222
|
-
Object.keys(defaultFilters).forEach((name) => {
|
|
4223
|
-
filters[name] = filters[name] ?? defaultFilters[name];
|
|
4224
|
-
});
|
|
4225
|
-
for (const name in filters) {
|
|
4226
|
-
const value = filters[name];
|
|
4227
|
-
switch (name) {
|
|
4228
|
-
case "hue-rotate":
|
|
4229
|
-
m.hueRotate(value * PI_2);
|
|
4230
|
-
break;
|
|
4231
|
-
case "saturate":
|
|
4232
|
-
m.saturate(value);
|
|
4233
|
-
break;
|
|
4234
|
-
case "brightness":
|
|
4235
|
-
m.brightness(value);
|
|
4236
|
-
break;
|
|
4237
|
-
case "contrast":
|
|
4238
|
-
m.contrast(value);
|
|
4239
|
-
break;
|
|
4240
|
-
case "invert":
|
|
4241
|
-
m.invert(value);
|
|
4242
|
-
break;
|
|
4243
|
-
case "sepia":
|
|
4244
|
-
m.sepia(value);
|
|
4245
|
-
break;
|
|
4246
|
-
case "opacity":
|
|
4247
|
-
m.opacity(value);
|
|
4248
|
-
break;
|
|
4249
|
-
case "grayscale":
|
|
4250
|
-
m.grayscale(value);
|
|
4251
|
-
break;
|
|
4252
|
-
}
|
|
4253
|
-
}
|
|
4254
|
-
return m;
|
|
4255
|
-
}
|
|
4256
|
-
|
|
4257
|
-
function parseCSSTransform(transform, width, height, output = new Transform2D()) {
|
|
4258
|
-
transform = !transform || transform === "none" ? "" : transform;
|
|
4259
|
-
parseCssFunctions(transform, { width, height }).reverse().forEach(({ name, args }) => {
|
|
4260
|
-
const values = args.map((arg) => arg.normalizedIntValue);
|
|
4261
|
-
switch (name) {
|
|
4262
|
-
case "translate":
|
|
4263
|
-
output.translate(values[0] * width, (values[1] ?? values[0]) * height);
|
|
4264
|
-
break;
|
|
4265
|
-
case "translateX":
|
|
4266
|
-
output.translateX(values[0] * width);
|
|
4267
|
-
break;
|
|
4268
|
-
case "translateY":
|
|
4269
|
-
output.translateY(values[0] * height);
|
|
4270
|
-
break;
|
|
4271
|
-
case "translateZ":
|
|
4272
|
-
output.translateZ(values[0]);
|
|
4273
|
-
break;
|
|
4274
|
-
case "translate3d":
|
|
4275
|
-
output.translate3d(
|
|
4276
|
-
values[0] * width,
|
|
4277
|
-
(values[1] ?? values[0]) * height,
|
|
4278
|
-
values[2] ?? values[1] ?? values[0]
|
|
4279
|
-
);
|
|
4280
|
-
break;
|
|
4281
|
-
case "scale":
|
|
4282
|
-
output.scale(values[0], values[1] ?? values[0]);
|
|
4283
|
-
break;
|
|
4284
|
-
case "scaleX":
|
|
4285
|
-
output.scaleX(values[0]);
|
|
4286
|
-
break;
|
|
4287
|
-
case "scaleY":
|
|
4288
|
-
output.scaleY(values[0]);
|
|
4289
|
-
break;
|
|
4290
|
-
case "scale3d":
|
|
4291
|
-
output.scale3d(values[0], values[1] ?? values[0], values[2] ?? values[1] ?? values[0]);
|
|
4292
|
-
break;
|
|
4293
|
-
case "rotate":
|
|
4294
|
-
output.rotate(values[0] * PI_2);
|
|
4295
|
-
break;
|
|
4296
|
-
case "rotateX":
|
|
4297
|
-
output.rotateX(values[0] * PI_2);
|
|
4298
|
-
break;
|
|
4299
|
-
case "rotateY":
|
|
4300
|
-
output.rotateY(values[0] * PI_2);
|
|
4301
|
-
break;
|
|
4302
|
-
case "rotateZ":
|
|
4303
|
-
output.rotateZ(values[0] * PI_2);
|
|
4304
|
-
break;
|
|
4305
|
-
case "rotate3d":
|
|
4306
|
-
output.rotate3d(
|
|
4307
|
-
values[0] * PI_2,
|
|
4308
|
-
(values[1] ?? values[0]) * PI_2,
|
|
4309
|
-
(values[2] ?? values[1] ?? values[0]) * PI_2,
|
|
4310
|
-
(values[3] ?? values[2] ?? values[1] ?? values[0]) * PI_2
|
|
4311
|
-
);
|
|
4312
|
-
break;
|
|
4313
|
-
case "skew":
|
|
4314
|
-
output.skew(values[0], values[0] ?? values[1]);
|
|
4315
|
-
break;
|
|
4316
|
-
case "skewX":
|
|
4317
|
-
output.skewX(values[0]);
|
|
4318
|
-
break;
|
|
4319
|
-
case "skewY":
|
|
4320
|
-
output.skewY(values[0]);
|
|
4321
|
-
break;
|
|
4322
|
-
case "matrix":
|
|
4323
|
-
output.set(values);
|
|
4324
|
-
break;
|
|
4325
|
-
}
|
|
4326
|
-
});
|
|
4327
|
-
return output;
|
|
4328
|
-
}
|
|
4329
|
-
|
|
4330
|
-
function parseCSSTransformOrigin(transformOrigin) {
|
|
4331
|
-
const [originX, originY = originX] = transformOrigin.split(" ");
|
|
4332
|
-
return [originX, originY].map((val) => {
|
|
4333
|
-
val = val.trim();
|
|
4334
|
-
switch (val) {
|
|
4335
|
-
case "left":
|
|
4336
|
-
case "top":
|
|
4337
|
-
return 0;
|
|
4338
|
-
case "center":
|
|
4339
|
-
return 0.5;
|
|
4340
|
-
case "right":
|
|
4341
|
-
case "bottom":
|
|
4342
|
-
return 1;
|
|
4343
|
-
default:
|
|
4344
|
-
return Number(val);
|
|
4345
|
-
}
|
|
4346
|
-
});
|
|
4347
|
-
}
|
|
4348
|
-
|
|
4349
4249
|
class Geometry extends Resource {
|
|
4350
4250
|
vertexAttributes;
|
|
4351
4251
|
indexBuffer;
|
|
@@ -4432,7 +4332,7 @@ class Geometry extends Resource {
|
|
|
4432
4332
|
}
|
|
4433
4333
|
|
|
4434
4334
|
var __defProp$P = Object.defineProperty;
|
|
4435
|
-
var __decorateClass$
|
|
4335
|
+
var __decorateClass$Y = (decorators, target, key, kind) => {
|
|
4436
4336
|
var result = void 0 ;
|
|
4437
4337
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4438
4338
|
if (decorator = decorators[i])
|
|
@@ -4481,15 +4381,15 @@ class IndexBuffer extends Resource {
|
|
|
4481
4381
|
return result;
|
|
4482
4382
|
}
|
|
4483
4383
|
}
|
|
4484
|
-
__decorateClass$
|
|
4384
|
+
__decorateClass$Y([
|
|
4485
4385
|
modernIdoc.property({ protected: true, default: null })
|
|
4486
4386
|
], IndexBuffer.prototype, "data");
|
|
4487
|
-
__decorateClass$
|
|
4387
|
+
__decorateClass$Y([
|
|
4488
4388
|
modernIdoc.property({ protected: true, fallback: false })
|
|
4489
4389
|
], IndexBuffer.prototype, "dynamic");
|
|
4490
4390
|
|
|
4491
4391
|
var __defProp$O = Object.defineProperty;
|
|
4492
|
-
var __decorateClass$
|
|
4392
|
+
var __decorateClass$X = (decorators, target, key, kind) => {
|
|
4493
4393
|
var result = void 0 ;
|
|
4494
4394
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4495
4395
|
if (decorator = decorators[i])
|
|
@@ -4538,15 +4438,15 @@ class VertexBuffer extends Resource {
|
|
|
4538
4438
|
return result;
|
|
4539
4439
|
}
|
|
4540
4440
|
}
|
|
4541
|
-
__decorateClass$
|
|
4441
|
+
__decorateClass$X([
|
|
4542
4442
|
modernIdoc.property({ protected: true, default: null })
|
|
4543
4443
|
], VertexBuffer.prototype, "data");
|
|
4544
|
-
__decorateClass$
|
|
4444
|
+
__decorateClass$X([
|
|
4545
4445
|
modernIdoc.property({ protected: true, fallback: false })
|
|
4546
4446
|
], VertexBuffer.prototype, "dynamic");
|
|
4547
4447
|
|
|
4548
4448
|
var __defProp$N = Object.defineProperty;
|
|
4549
|
-
var __decorateClass$
|
|
4449
|
+
var __decorateClass$W = (decorators, target, key, kind) => {
|
|
4550
4450
|
var result = void 0 ;
|
|
4551
4451
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4552
4452
|
if (decorator = decorators[i])
|
|
@@ -4585,25 +4485,25 @@ class VertexAttribute extends Resource {
|
|
|
4585
4485
|
return result;
|
|
4586
4486
|
}
|
|
4587
4487
|
}
|
|
4588
|
-
__decorateClass$
|
|
4488
|
+
__decorateClass$W([
|
|
4589
4489
|
modernIdoc.property({ protected: true })
|
|
4590
4490
|
], VertexAttribute.prototype, "buffer");
|
|
4591
|
-
__decorateClass$
|
|
4491
|
+
__decorateClass$W([
|
|
4592
4492
|
modernIdoc.property({ fallback: 0 })
|
|
4593
4493
|
], VertexAttribute.prototype, "size");
|
|
4594
|
-
__decorateClass$
|
|
4494
|
+
__decorateClass$W([
|
|
4595
4495
|
modernIdoc.property({ fallback: false })
|
|
4596
4496
|
], VertexAttribute.prototype, "normalized");
|
|
4597
|
-
__decorateClass$
|
|
4497
|
+
__decorateClass$W([
|
|
4598
4498
|
modernIdoc.property({ fallback: "float" })
|
|
4599
4499
|
], VertexAttribute.prototype, "type");
|
|
4600
|
-
__decorateClass$
|
|
4500
|
+
__decorateClass$W([
|
|
4601
4501
|
modernIdoc.property()
|
|
4602
4502
|
], VertexAttribute.prototype, "stride");
|
|
4603
|
-
__decorateClass$
|
|
4503
|
+
__decorateClass$W([
|
|
4604
4504
|
modernIdoc.property()
|
|
4605
4505
|
], VertexAttribute.prototype, "offset");
|
|
4606
|
-
__decorateClass$
|
|
4506
|
+
__decorateClass$W([
|
|
4607
4507
|
modernIdoc.property()
|
|
4608
4508
|
], VertexAttribute.prototype, "divisor");
|
|
4609
4509
|
|
|
@@ -4848,7 +4748,7 @@ class UvGeometry extends Geometry {
|
|
|
4848
4748
|
}
|
|
4849
4749
|
|
|
4850
4750
|
var __defProp$M = Object.defineProperty;
|
|
4851
|
-
var __decorateClass$
|
|
4751
|
+
var __decorateClass$V = (decorators, target, key, kind) => {
|
|
4852
4752
|
var result = void 0 ;
|
|
4853
4753
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4854
4754
|
if (decorator = decorators[i])
|
|
@@ -4979,22 +4879,22 @@ class Texture2D extends Resource {
|
|
|
4979
4879
|
}
|
|
4980
4880
|
}
|
|
4981
4881
|
}
|
|
4982
|
-
__decorateClass$
|
|
4882
|
+
__decorateClass$V([
|
|
4983
4883
|
modernIdoc.property({ protected: true })
|
|
4984
4884
|
], Texture2D.prototype, "source");
|
|
4985
|
-
__decorateClass$
|
|
4885
|
+
__decorateClass$V([
|
|
4986
4886
|
modernIdoc.property({ fallback: 0 })
|
|
4987
4887
|
], Texture2D.prototype, "width");
|
|
4988
|
-
__decorateClass$
|
|
4888
|
+
__decorateClass$V([
|
|
4989
4889
|
modernIdoc.property({ fallback: 0 })
|
|
4990
4890
|
], Texture2D.prototype, "height");
|
|
4991
|
-
__decorateClass$
|
|
4891
|
+
__decorateClass$V([
|
|
4992
4892
|
modernIdoc.property({ fallback: "linear" })
|
|
4993
4893
|
], Texture2D.prototype, "filterMode");
|
|
4994
|
-
__decorateClass$
|
|
4894
|
+
__decorateClass$V([
|
|
4995
4895
|
modernIdoc.property({ fallback: "clamp_to_edge" })
|
|
4996
4896
|
], Texture2D.prototype, "wrapMode");
|
|
4997
|
-
__decorateClass$
|
|
4897
|
+
__decorateClass$V([
|
|
4998
4898
|
modernIdoc.property({ fallback: 1 })
|
|
4999
4899
|
], Texture2D.prototype, "pixelRatio");
|
|
5000
4900
|
|
|
@@ -5025,7 +4925,7 @@ class AnimatedTexture extends Resource {
|
|
|
5025
4925
|
}
|
|
5026
4926
|
|
|
5027
4927
|
var __defProp$L = Object.defineProperty;
|
|
5028
|
-
var __decorateClass$
|
|
4928
|
+
var __decorateClass$U = (decorators, target, key, kind) => {
|
|
5029
4929
|
var result = void 0 ;
|
|
5030
4930
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5031
4931
|
if (decorator = decorators[i])
|
|
@@ -5049,7 +4949,7 @@ class CanvasTexture extends Texture2D {
|
|
|
5049
4949
|
super._updateProperty(key, value, oldValue, declaration);
|
|
5050
4950
|
}
|
|
5051
4951
|
}
|
|
5052
|
-
__decorateClass$
|
|
4952
|
+
__decorateClass$U([
|
|
5053
4953
|
modernIdoc.property({ fallback: 2 })
|
|
5054
4954
|
], CanvasTexture.prototype, "pixelRatio");
|
|
5055
4955
|
|
|
@@ -5270,7 +5170,7 @@ class PixelsTexture extends Texture2D {
|
|
|
5270
5170
|
}
|
|
5271
5171
|
|
|
5272
5172
|
var __defProp$K = Object.defineProperty;
|
|
5273
|
-
var __decorateClass$
|
|
5173
|
+
var __decorateClass$T = (decorators, target, key, kind) => {
|
|
5274
5174
|
var result = void 0 ;
|
|
5275
5175
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5276
5176
|
if (decorator = decorators[i])
|
|
@@ -5519,10 +5419,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
|
|
|
5519
5419
|
}
|
|
5520
5420
|
}
|
|
5521
5421
|
};
|
|
5522
|
-
__decorateClass$
|
|
5422
|
+
__decorateClass$T([
|
|
5523
5423
|
modernIdoc.property({ protected: true, fallback: true })
|
|
5524
5424
|
], _VideoTexture.prototype, "autoUpdate");
|
|
5525
|
-
__decorateClass$
|
|
5425
|
+
__decorateClass$T([
|
|
5526
5426
|
modernIdoc.property({ protected: true, fallback: 0 })
|
|
5527
5427
|
], _VideoTexture.prototype, "fps");
|
|
5528
5428
|
let VideoTexture = _VideoTexture;
|
|
@@ -5531,33 +5431,204 @@ class ViewportTexture extends PixelsTexture {
|
|
|
5531
5431
|
//
|
|
5532
5432
|
}
|
|
5533
5433
|
|
|
5534
|
-
class
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
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
|
+
}
|
|
5547
5452
|
}
|
|
5548
|
-
|
|
5549
|
-
this.
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
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":
|
|
5561
5632
|
this.back.push(item);
|
|
5562
5633
|
break;
|
|
5563
5634
|
}
|
|
@@ -5582,9 +5653,9 @@ class Children extends Array {
|
|
|
5582
5653
|
}
|
|
5583
5654
|
|
|
5584
5655
|
var __defProp$J = Object.defineProperty;
|
|
5585
|
-
var __getOwnPropDesc$
|
|
5586
|
-
var __decorateClass$
|
|
5587
|
-
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;
|
|
5588
5659
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5589
5660
|
if (decorator = decorators[i])
|
|
5590
5661
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
@@ -5649,7 +5720,7 @@ exports.Node = class Node extends CoreObject {
|
|
|
5649
5720
|
return this._tree;
|
|
5650
5721
|
}
|
|
5651
5722
|
getViewport() {
|
|
5652
|
-
return this.
|
|
5723
|
+
return this.parent?.getViewport() ?? this.getWindow();
|
|
5653
5724
|
}
|
|
5654
5725
|
getWindow() {
|
|
5655
5726
|
return this._tree?.root;
|
|
@@ -6072,38 +6143,38 @@ exports.Node = class Node extends CoreObject {
|
|
|
6072
6143
|
return node;
|
|
6073
6144
|
}
|
|
6074
6145
|
};
|
|
6075
|
-
__decorateClass$
|
|
6146
|
+
__decorateClass$S([
|
|
6076
6147
|
modernIdoc.property({ fallback: modernIdoc.idGenerator() })
|
|
6077
6148
|
], exports.Node.prototype, "id", 2);
|
|
6078
|
-
__decorateClass$
|
|
6149
|
+
__decorateClass$S([
|
|
6079
6150
|
modernIdoc.property({ fallback: modernIdoc.idGenerator() })
|
|
6080
6151
|
], exports.Node.prototype, "name", 2);
|
|
6081
|
-
__decorateClass$
|
|
6152
|
+
__decorateClass$S([
|
|
6082
6153
|
modernIdoc.property({ fallback: "inherit" })
|
|
6083
6154
|
], exports.Node.prototype, "processMode", 2);
|
|
6084
|
-
__decorateClass$
|
|
6155
|
+
__decorateClass$S([
|
|
6085
6156
|
modernIdoc.property({ fallback: "default" })
|
|
6086
6157
|
], exports.Node.prototype, "processSortMode", 2);
|
|
6087
|
-
__decorateClass$
|
|
6158
|
+
__decorateClass$S([
|
|
6088
6159
|
modernIdoc.property({ fallback: "inherit" })
|
|
6089
6160
|
], exports.Node.prototype, "renderMode", 2);
|
|
6090
|
-
__decorateClass$
|
|
6161
|
+
__decorateClass$S([
|
|
6091
6162
|
modernIdoc.property({ fallback: "default" })
|
|
6092
6163
|
], exports.Node.prototype, "internalMode", 2);
|
|
6093
|
-
__decorateClass$
|
|
6164
|
+
__decorateClass$S([
|
|
6094
6165
|
modernIdoc.property({ default: () => ({}) })
|
|
6095
6166
|
], exports.Node.prototype, "meta", 2);
|
|
6096
|
-
__decorateClass$
|
|
6167
|
+
__decorateClass$S([
|
|
6097
6168
|
modernIdoc.property({ protected: true })
|
|
6098
6169
|
], exports.Node.prototype, "mask", 2);
|
|
6099
|
-
exports.Node = __decorateClass$
|
|
6170
|
+
exports.Node = __decorateClass$S([
|
|
6100
6171
|
customNode("Node")
|
|
6101
6172
|
], exports.Node);
|
|
6102
6173
|
|
|
6103
6174
|
var __defProp$I = Object.defineProperty;
|
|
6104
|
-
var __getOwnPropDesc$
|
|
6105
|
-
var __decorateClass$
|
|
6106
|
-
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;
|
|
6107
6178
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6108
6179
|
if (decorator = decorators[i])
|
|
6109
6180
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
@@ -6167,52 +6238,231 @@ exports.TimelineNode = class TimelineNode extends exports.Node {
|
|
|
6167
6238
|
this._updateCurrentTime();
|
|
6168
6239
|
}
|
|
6169
6240
|
};
|
|
6170
|
-
__decorateClass$
|
|
6241
|
+
__decorateClass$R([
|
|
6171
6242
|
modernIdoc.property({ fallback: 0 })
|
|
6172
6243
|
], exports.TimelineNode.prototype, "delay", 2);
|
|
6173
|
-
__decorateClass$
|
|
6244
|
+
__decorateClass$R([
|
|
6174
6245
|
modernIdoc.property({ fallback: 0 })
|
|
6175
6246
|
], exports.TimelineNode.prototype, "duration", 2);
|
|
6176
|
-
__decorateClass$
|
|
6247
|
+
__decorateClass$R([
|
|
6177
6248
|
modernIdoc.property({ fallback: false })
|
|
6178
6249
|
], exports.TimelineNode.prototype, "paused", 2);
|
|
6179
|
-
__decorateClass$
|
|
6250
|
+
__decorateClass$R([
|
|
6180
6251
|
modernIdoc.property({ protected: true, fallback: false })
|
|
6181
6252
|
], exports.TimelineNode.prototype, "insideTimeRange", 2);
|
|
6182
|
-
exports.TimelineNode = __decorateClass$
|
|
6253
|
+
exports.TimelineNode = __decorateClass$R([
|
|
6183
6254
|
customNode("TimelineNode")
|
|
6184
6255
|
], exports.TimelineNode);
|
|
6185
6256
|
|
|
6186
6257
|
var __defProp$H = Object.defineProperty;
|
|
6187
|
-
var __getOwnPropDesc$
|
|
6188
|
-
var __decorateClass$
|
|
6189
|
-
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;
|
|
6190
6261
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6191
6262
|
if (decorator = decorators[i])
|
|
6192
6263
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6193
6264
|
if (kind && result) __defProp$H(target, key, result);
|
|
6194
6265
|
return result;
|
|
6195
6266
|
};
|
|
6196
|
-
exports.
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
this.
|
|
6267
|
+
exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
|
|
6268
|
+
_parentGlobalVisible;
|
|
6269
|
+
_globalVisible;
|
|
6270
|
+
get globalVisible() {
|
|
6271
|
+
return this._globalVisible ?? true;
|
|
6201
6272
|
}
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
{ texture: new ViewportTexture(), needsUpload: false }
|
|
6207
|
-
];
|
|
6208
|
-
get valid() {
|
|
6209
|
-
return Boolean(this.width && this.height);
|
|
6273
|
+
_parentGlobalOpacity;
|
|
6274
|
+
_globalOpacity;
|
|
6275
|
+
get globalOpacity() {
|
|
6276
|
+
return this._globalOpacity ?? 1;
|
|
6210
6277
|
}
|
|
6211
|
-
|
|
6212
|
-
|
|
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);
|
|
6213
6291
|
}
|
|
6214
|
-
|
|
6215
|
-
|
|
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];
|
|
6460
|
+
}
|
|
6461
|
+
get texture() {
|
|
6462
|
+
return this.framebuffer.texture;
|
|
6463
|
+
}
|
|
6464
|
+
getViewport() {
|
|
6465
|
+
return this;
|
|
6216
6466
|
}
|
|
6217
6467
|
/** @internal */
|
|
6218
6468
|
_glFramebufferOptions(renderer) {
|
|
@@ -6245,13 +6495,13 @@ exports.Viewport = class Viewport extends exports.Node {
|
|
|
6245
6495
|
case "x":
|
|
6246
6496
|
case "y":
|
|
6247
6497
|
this.requestUpload();
|
|
6248
|
-
this.
|
|
6498
|
+
this.projection.translate(this.x, this.y);
|
|
6249
6499
|
this.emit("updateRect");
|
|
6250
6500
|
break;
|
|
6251
6501
|
case "width":
|
|
6252
6502
|
case "height":
|
|
6253
6503
|
this.requestUpload();
|
|
6254
|
-
this.
|
|
6504
|
+
this.projection.resize(this.width, this.height);
|
|
6255
6505
|
this.emit("updateRect");
|
|
6256
6506
|
break;
|
|
6257
6507
|
}
|
|
@@ -6310,6 +6560,8 @@ exports.Viewport = class Viewport extends exports.Node {
|
|
|
6310
6560
|
}
|
|
6311
6561
|
render(renderer, next) {
|
|
6312
6562
|
const oldViewport = this._tree?.getCurrentViewport();
|
|
6563
|
+
renderer.program.uniforms.projectionMatrix = this.projection.toArray(true);
|
|
6564
|
+
renderer.program.uniforms.worldTransformMatrix = this.canvasTransform.toArray(true);
|
|
6313
6565
|
this.activate(renderer);
|
|
6314
6566
|
renderer.clear();
|
|
6315
6567
|
super.render(renderer, next);
|
|
@@ -6324,9 +6576,6 @@ exports.Viewport = class Viewport extends exports.Node {
|
|
|
6324
6576
|
getRect() {
|
|
6325
6577
|
return new Rect2(this.x, this.y, this.width, this.height);
|
|
6326
6578
|
}
|
|
6327
|
-
toProjectionArray(transpose = false) {
|
|
6328
|
-
return this._projection.toArray(transpose);
|
|
6329
|
-
}
|
|
6330
6579
|
};
|
|
6331
6580
|
__decorateClass$P([
|
|
6332
6581
|
modernIdoc.property({ fallback: 0 })
|
|
@@ -6344,14 +6593,14 @@ exports.Viewport = __decorateClass$P([
|
|
|
6344
6593
|
customNode("Viewport")
|
|
6345
6594
|
], exports.Viewport);
|
|
6346
6595
|
|
|
6347
|
-
var __defProp$
|
|
6596
|
+
var __defProp$F = Object.defineProperty;
|
|
6348
6597
|
var __getOwnPropDesc$F = Object.getOwnPropertyDescriptor;
|
|
6349
6598
|
var __decorateClass$O = (decorators, target, key, kind) => {
|
|
6350
6599
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$F(target, key) : target;
|
|
6351
6600
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6352
6601
|
if (decorator = decorators[i])
|
|
6353
6602
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6354
|
-
if (kind && result) __defProp$
|
|
6603
|
+
if (kind && result) __defProp$F(target, key, result);
|
|
6355
6604
|
return result;
|
|
6356
6605
|
};
|
|
6357
6606
|
exports.Effect = class Effect extends exports.TimelineNode {
|
|
@@ -6609,295 +6858,228 @@ exports.Effect = __decorateClass$O([
|
|
|
6609
6858
|
customNode("Effect")
|
|
6610
6859
|
], exports.Effect);
|
|
6611
6860
|
|
|
6612
|
-
|
|
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;
|
|
6613
6888
|
var __getOwnPropDesc$E = Object.getOwnPropertyDescriptor;
|
|
6614
|
-
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6615
6889
|
var __decorateClass$N = (decorators, target, key, kind) => {
|
|
6616
6890
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$E(target, key) : target;
|
|
6617
6891
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6618
6892
|
if (decorator = decorators[i])
|
|
6619
6893
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6620
|
-
if (kind && result) __defProp$
|
|
6894
|
+
if (kind && result) __defProp$E(target, key, result);
|
|
6621
6895
|
return result;
|
|
6622
6896
|
};
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
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) {
|
|
6626
6907
|
super();
|
|
6627
|
-
this.setProperties(properties)
|
|
6908
|
+
this.setProperties(properties);
|
|
6628
6909
|
}
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
alpha: this.alpha,
|
|
6640
|
-
gamma: Math.max(this.gamma ?? 1, 1e-4)
|
|
6641
|
-
});
|
|
6642
|
-
});
|
|
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
|
+
}
|
|
6643
6920
|
}
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
uniform float gamma;
|
|
6657
|
-
uniform float contrast;
|
|
6658
|
-
uniform float saturation;
|
|
6659
|
-
uniform float brightness;
|
|
6660
|
-
uniform float red;
|
|
6661
|
-
uniform float green;
|
|
6662
|
-
uniform float blue;
|
|
6663
|
-
uniform float alpha;
|
|
6664
|
-
|
|
6665
|
-
void main(void) {
|
|
6666
|
-
vec4 c = texture2D(sampler, vUv);
|
|
6667
|
-
if (c.a > 0.0) {
|
|
6668
|
-
c.rgb /= c.a;
|
|
6669
|
-
vec3 rgb = pow(c.rgb, vec3(1. / gamma));
|
|
6670
|
-
rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);
|
|
6671
|
-
rgb.r *= red;
|
|
6672
|
-
rgb.g *= green;
|
|
6673
|
-
rgb.b *= blue;
|
|
6674
|
-
c.rgb = rgb * brightness;
|
|
6675
|
-
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;
|
|
6676
6933
|
}
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
], exports.ColorAdjustEffect.prototype, "saturation", 2);
|
|
6683
|
-
__decorateClass$N([
|
|
6684
|
-
modernIdoc.property()
|
|
6685
|
-
], exports.ColorAdjustEffect.prototype, "contrast", 2);
|
|
6686
|
-
__decorateClass$N([
|
|
6687
|
-
modernIdoc.property()
|
|
6688
|
-
], exports.ColorAdjustEffect.prototype, "brightness", 2);
|
|
6689
|
-
__decorateClass$N([
|
|
6690
|
-
modernIdoc.property()
|
|
6691
|
-
], exports.ColorAdjustEffect.prototype, "red", 2);
|
|
6934
|
+
_process(delta) {
|
|
6935
|
+
super._process(delta);
|
|
6936
|
+
this.addTime(delta);
|
|
6937
|
+
}
|
|
6938
|
+
};
|
|
6692
6939
|
__decorateClass$N([
|
|
6693
|
-
modernIdoc.property()
|
|
6694
|
-
], exports.
|
|
6940
|
+
modernIdoc.property({ fallback: 0 })
|
|
6941
|
+
], exports.Timeline.prototype, "startTime", 2);
|
|
6695
6942
|
__decorateClass$N([
|
|
6696
|
-
modernIdoc.property()
|
|
6697
|
-
], exports.
|
|
6943
|
+
modernIdoc.property({ fallback: 0 })
|
|
6944
|
+
], exports.Timeline.prototype, "currentTime", 2);
|
|
6698
6945
|
__decorateClass$N([
|
|
6699
|
-
modernIdoc.property()
|
|
6700
|
-
], exports.
|
|
6946
|
+
modernIdoc.property({ fallback: Number.MAX_SAFE_INTEGER })
|
|
6947
|
+
], exports.Timeline.prototype, "endTime", 2);
|
|
6701
6948
|
__decorateClass$N([
|
|
6702
|
-
modernIdoc.property()
|
|
6703
|
-
], exports.
|
|
6704
|
-
exports.
|
|
6705
|
-
customNode("
|
|
6706
|
-
], exports.
|
|
6949
|
+
modernIdoc.property({ fallback: false })
|
|
6950
|
+
], exports.Timeline.prototype, "loop", 2);
|
|
6951
|
+
exports.Timeline = __decorateClass$N([
|
|
6952
|
+
customNode("Timeline")
|
|
6953
|
+
], exports.Timeline);
|
|
6707
6954
|
|
|
6708
|
-
var __defProp$E = Object.defineProperty;
|
|
6709
6955
|
var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
|
|
6710
|
-
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6711
6956
|
var __decorateClass$M = (decorators, target, key, kind) => {
|
|
6712
6957
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$D(target, key) : target;
|
|
6713
6958
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6714
6959
|
if (decorator = decorators[i])
|
|
6715
|
-
result = (
|
|
6716
|
-
if (kind && result) __defProp$E(target, key, result);
|
|
6960
|
+
result = (decorator(result)) || result;
|
|
6717
6961
|
return result;
|
|
6718
6962
|
};
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
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()) {
|
|
6723
6993
|
super();
|
|
6724
|
-
this.
|
|
6994
|
+
this.timeline = timeline.setTree(this);
|
|
6725
6995
|
}
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
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
|
-
source.redraw(renderer, () => {
|
|
6762
|
-
QuadUvGeometry.draw(renderer, exports.ColorFilterEffect.material, {
|
|
6763
|
-
sampler: 0,
|
|
6764
|
-
m: matrix.toArray()
|
|
6765
|
-
});
|
|
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
|
|
6766
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);
|
|
6767
7041
|
}
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
attribute vec2 uv;
|
|
6773
|
-
varying vec2 vUv;
|
|
6774
|
-
void main() {
|
|
6775
|
-
gl_Position = vec4(position, 0.0, 1.0);
|
|
6776
|
-
vUv = uv;
|
|
6777
|
-
}`,
|
|
6778
|
-
frag: `precision highp float;
|
|
6779
|
-
varying vec2 vUv;
|
|
6780
|
-
uniform sampler2D sampler;
|
|
6781
|
-
uniform float m[20];
|
|
6782
|
-
|
|
6783
|
-
void main(void) {
|
|
6784
|
-
vec4 c = texture2D(sampler, vUv);
|
|
6785
|
-
if (c.a > 0.0) {
|
|
6786
|
-
c.rgb /= c.a;
|
|
7042
|
+
free() {
|
|
7043
|
+
super.free();
|
|
7044
|
+
this.root.children.internal.forEach((node) => this.root.removeChild(node));
|
|
7045
|
+
this.input.removeEventListeners();
|
|
6787
7046
|
}
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
);
|
|
6794
|
-
}`
|
|
6795
|
-
}));
|
|
6796
|
-
__decorateClass$M([
|
|
7047
|
+
}
|
|
7048
|
+
__decorateClass$L([
|
|
7049
|
+
modernIdoc.property({ fallback: false })
|
|
7050
|
+
], SceneTree.prototype, "processPaused");
|
|
7051
|
+
__decorateClass$L([
|
|
6797
7052
|
modernIdoc.property()
|
|
6798
|
-
],
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
],
|
|
7053
|
+
], SceneTree.prototype, "backgroundColor");
|
|
7054
|
+
__decorateClass$L([
|
|
7055
|
+
modernIdoc.property({ protected: true, fallback: false })
|
|
7056
|
+
], SceneTree.prototype, "debug");
|
|
6802
7057
|
|
|
6803
|
-
var __defProp$D = Object.defineProperty;
|
|
6804
7058
|
var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
|
|
6805
|
-
var
|
|
6806
|
-
var __decorateClass$L = (decorators, target, key, kind) => {
|
|
7059
|
+
var __decorateClass$K = (decorators, target, key, kind) => {
|
|
6807
7060
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$C(target, key) : target;
|
|
6808
7061
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6809
7062
|
if (decorator = decorators[i])
|
|
6810
|
-
result = (
|
|
6811
|
-
if (kind && result) __defProp$D(target, key, result);
|
|
7063
|
+
result = (decorator(result)) || result;
|
|
6812
7064
|
return result;
|
|
6813
7065
|
};
|
|
6814
|
-
|
|
6815
|
-
const MAX_COLORS$1 = 50;
|
|
6816
|
-
exports.ColorOverlayEffect = class ColorOverlayEffect extends exports.Effect {
|
|
6817
|
-
_color = new Color();
|
|
7066
|
+
exports.Transition = class Transition extends exports.Effect {
|
|
6818
7067
|
constructor(properties, children = []) {
|
|
6819
7068
|
super();
|
|
6820
7069
|
this.setProperties(properties).append(children);
|
|
6821
7070
|
}
|
|
6822
|
-
apply(renderer, source) {
|
|
6823
|
-
source.redraw(renderer, () => {
|
|
6824
|
-
const colors = this.colors.map((val) => {
|
|
6825
|
-
this._color.value = val;
|
|
6826
|
-
const rgba = this._color.toArray();
|
|
6827
|
-
rgba[3] = this.alpha;
|
|
6828
|
-
return rgba;
|
|
6829
|
-
});
|
|
6830
|
-
while (colors.length < MAX_COLORS$1) {
|
|
6831
|
-
colors.push([0, 0, 0, 0]);
|
|
6832
|
-
}
|
|
6833
|
-
QuadUvGeometry.draw(renderer, exports.ColorOverlayEffect.material, {
|
|
6834
|
-
sampler: 0,
|
|
6835
|
-
colors: colors.slice(0, MAX_COLORS$1).flatMap((item) => item)
|
|
6836
|
-
});
|
|
6837
|
-
});
|
|
6838
|
-
}
|
|
6839
7071
|
};
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
vUv = uv;
|
|
6848
|
-
}`,
|
|
6849
|
-
frag: `precision mediump float;
|
|
6850
|
-
uniform sampler2D sampler;
|
|
6851
|
-
uniform vec4 colors[${MAX_COLORS$1}];
|
|
6852
|
-
varying vec2 vUv;
|
|
6853
|
-
|
|
6854
|
-
float calcWidth() {
|
|
6855
|
-
return distance(vec2(0, 0), vec2(1, 0));
|
|
6856
|
-
}
|
|
6857
|
-
|
|
6858
|
-
int calcCount() {
|
|
6859
|
-
int count = 0;
|
|
6860
|
-
for (int i = 0; i < ${MAX_COLORS$1}; i++) {
|
|
6861
|
-
if (colors[i] != vec4(0,0,0,0)){
|
|
6862
|
-
count++;
|
|
6863
|
-
}
|
|
6864
|
-
}
|
|
6865
|
-
return count;
|
|
6866
|
-
}
|
|
6867
|
-
|
|
6868
|
-
vec4 calcColor(float x) {
|
|
6869
|
-
float perUnit = calcWidth() / float(calcCount());
|
|
6870
|
-
int index = int(x / perUnit);
|
|
6871
|
-
|
|
6872
|
-
for(int i=0; i<${MAX_COLORS$1}; i++){
|
|
6873
|
-
if(i==index){
|
|
6874
|
-
return colors[i];
|
|
6875
|
-
}
|
|
6876
|
-
}
|
|
6877
|
-
|
|
6878
|
-
return vec4(0, 0, 0, 0);
|
|
6879
|
-
}
|
|
6880
|
-
|
|
6881
|
-
void main(void) {
|
|
6882
|
-
vec4 color = texture2D(sampler, vUv);
|
|
6883
|
-
vec4 mask = calcColor(vUv.x);
|
|
6884
|
-
gl_FragColor = vec4(mix(color.rgb, mask.rgb, color.a * mask.a), color.a);
|
|
6885
|
-
}`
|
|
6886
|
-
}));
|
|
6887
|
-
__decorateClass$L([
|
|
6888
|
-
modernIdoc.property()
|
|
6889
|
-
], exports.ColorOverlayEffect.prototype, "colors", 2);
|
|
6890
|
-
__decorateClass$L([
|
|
6891
|
-
modernIdoc.property()
|
|
6892
|
-
], exports.ColorOverlayEffect.prototype, "alpha", 2);
|
|
6893
|
-
exports.ColorOverlayEffect = __decorateClass$L([
|
|
6894
|
-
customNode("ColorOverlayEffect")
|
|
6895
|
-
], exports.ColorOverlayEffect);
|
|
7072
|
+
exports.Transition = __decorateClass$K([
|
|
7073
|
+
customNode("Transition", {
|
|
7074
|
+
effectMode: "transition",
|
|
7075
|
+
processMode: "pausable",
|
|
7076
|
+
duration: 2e3
|
|
7077
|
+
})
|
|
7078
|
+
], exports.Transition);
|
|
6896
7079
|
|
|
6897
7080
|
var __defProp$C = Object.defineProperty;
|
|
6898
7081
|
var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
|
|
6899
|
-
var
|
|
6900
|
-
var __decorateClass$K = (decorators, target, key, kind) => {
|
|
7082
|
+
var __decorateClass$J = (decorators, target, key, kind) => {
|
|
6901
7083
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$B(target, key) : target;
|
|
6902
7084
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6903
7085
|
if (decorator = decorators[i])
|
|
@@ -6905,84 +7087,119 @@ var __decorateClass$K = (decorators, target, key, kind) => {
|
|
|
6905
7087
|
if (kind && result) __defProp$C(target, key, result);
|
|
6906
7088
|
return result;
|
|
6907
7089
|
};
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
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 = []) {
|
|
6912
7101
|
super();
|
|
6913
|
-
this.setProperties(properties).append(
|
|
7102
|
+
this.setProperties(properties).append(nodes);
|
|
6914
7103
|
}
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
});
|
|
6922
|
-
while (colors.length < maxColors) {
|
|
6923
|
-
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;
|
|
6924
7110
|
}
|
|
6925
|
-
colors.slice(0, maxColors).forEach((originalColor, i) => {
|
|
6926
|
-
originalColors[i * 3] = originalColor[0];
|
|
6927
|
-
originalColors[i * 3 + 1] = originalColor[1];
|
|
6928
|
-
originalColors[i * 3 + 2] = originalColor[2];
|
|
6929
|
-
});
|
|
6930
|
-
source.redraw(renderer, () => {
|
|
6931
|
-
QuadUvGeometry.draw(renderer, exports.ColorRemoveEffect.material, {
|
|
6932
|
-
sampler: 0,
|
|
6933
|
-
epsilon: this.epsilon,
|
|
6934
|
-
originalColors
|
|
6935
|
-
});
|
|
6936
|
-
});
|
|
6937
7111
|
}
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
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);
|
|
6961
7138
|
}
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
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;
|
|
6966
7169
|
}
|
|
7170
|
+
return newVertices;
|
|
6967
7171
|
}
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
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);
|
|
6981
7199
|
|
|
6982
7200
|
var __defProp$B = Object.defineProperty;
|
|
6983
7201
|
var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
|
|
6984
|
-
var
|
|
6985
|
-
var __decorateClass$J = (decorators, target, key, kind) => {
|
|
7202
|
+
var __decorateClass$I = (decorators, target, key, kind) => {
|
|
6986
7203
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$A(target, key) : target;
|
|
6987
7204
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6988
7205
|
if (decorator = decorators[i])
|
|
@@ -6990,53 +7207,242 @@ var __decorateClass$J = (decorators, target, key, kind) => {
|
|
|
6990
7207
|
if (kind && result) __defProp$B(target, key, result);
|
|
6991
7208
|
return result;
|
|
6992
7209
|
};
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
_color = new Color();
|
|
6997
|
-
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 = []) {
|
|
6998
7213
|
super();
|
|
6999
|
-
this.setProperties(properties).append(
|
|
7214
|
+
this.setProperties(properties).append(nodes);
|
|
7000
7215
|
}
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
const
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
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
|
+
}
|
|
7020
7243
|
}
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
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) {
|
|
7029
7430
|
source.redraw(renderer, () => {
|
|
7030
|
-
QuadUvGeometry.draw(renderer, exports.
|
|
7431
|
+
QuadUvGeometry.draw(renderer, exports.ColorAdjustEffect.material, {
|
|
7031
7432
|
sampler: 0,
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
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)
|
|
7035
7441
|
});
|
|
7036
7442
|
});
|
|
7037
7443
|
}
|
|
7038
7444
|
};
|
|
7039
|
-
__publicField$
|
|
7445
|
+
__publicField$i(exports.ColorAdjustEffect, "material", new Material({
|
|
7040
7446
|
vert: `precision mediump float;
|
|
7041
7447
|
attribute vec2 position;
|
|
7042
7448
|
attribute vec2 uv;
|
|
@@ -7047,606 +7453,448 @@ void main() {
|
|
|
7047
7453
|
}`,
|
|
7048
7454
|
frag: `varying vec2 vUv;
|
|
7049
7455
|
uniform sampler2D sampler;
|
|
7050
|
-
uniform float
|
|
7051
|
-
|
|
7052
|
-
uniform
|
|
7053
|
-
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;
|
|
7054
7464
|
|
|
7055
7465
|
void main(void) {
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
vec3 origColor = originalColors[i];
|
|
7067
|
-
if (origColor.r < 0.0) {
|
|
7068
|
-
break;
|
|
7069
|
-
}
|
|
7070
|
-
vec3 colorDiff = origColor - color;
|
|
7071
|
-
if (length(colorDiff) < epsilon) {
|
|
7072
|
-
vec3 targetColor = targetColors[i];
|
|
7073
|
-
gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);
|
|
7074
|
-
return;
|
|
7075
|
-
}
|
|
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;
|
|
7076
7476
|
}
|
|
7477
|
+
gl_FragColor = c * alpha;
|
|
7077
7478
|
}`
|
|
7078
7479
|
}));
|
|
7079
|
-
__decorateClass$
|
|
7480
|
+
__decorateClass$H([
|
|
7080
7481
|
modernIdoc.property()
|
|
7081
|
-
], exports.
|
|
7082
|
-
__decorateClass$
|
|
7482
|
+
], exports.ColorAdjustEffect.prototype, "saturation", 2);
|
|
7483
|
+
__decorateClass$H([
|
|
7083
7484
|
modernIdoc.property()
|
|
7084
|
-
], exports.
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
], exports.
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
}
|
|
7107
|
-
}
|
|
7108
|
-
stroke(options) {
|
|
7109
|
-
if (!this.curves.length) {
|
|
7110
|
-
return;
|
|
7111
|
-
}
|
|
7112
|
-
let strokeStyle = this.strokeStyle;
|
|
7113
|
-
if (!strokeStyle && this.style.stroke) {
|
|
7114
|
-
switch (typeof this.style.stroke) {
|
|
7115
|
-
case "string":
|
|
7116
|
-
strokeStyle = this.style.stroke;
|
|
7117
|
-
break;
|
|
7118
|
-
case "object":
|
|
7119
|
-
if (modernIdoc.isColorFillObject(this.style.stroke)) {
|
|
7120
|
-
strokeStyle = this.style.stroke.color;
|
|
7121
|
-
}
|
|
7122
|
-
break;
|
|
7123
|
-
}
|
|
7124
|
-
}
|
|
7125
|
-
this._draws.push({
|
|
7126
|
-
...options,
|
|
7127
|
-
type: "stroke",
|
|
7128
|
-
path: new modernPath2d.Path2D(this),
|
|
7129
|
-
texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
|
|
7130
|
-
uvTransform: this.uvTransform,
|
|
7131
|
-
vertTransform: this.vertTransform,
|
|
7132
|
-
style: {
|
|
7133
|
-
alignment: 0.5,
|
|
7134
|
-
cap: this.lineCap ?? "butt",
|
|
7135
|
-
join: this.lineJoin ?? "miter",
|
|
7136
|
-
width: this.lineWidth ?? 1,
|
|
7137
|
-
miterLimit: this.miterLimit ?? 10
|
|
7138
|
-
}
|
|
7139
|
-
});
|
|
7140
|
-
super.reset();
|
|
7141
|
-
}
|
|
7142
|
-
fillRect(x, y, width, height) {
|
|
7143
|
-
this.rect(x, y, width, height).fill();
|
|
7144
|
-
}
|
|
7145
|
-
strokeRect(x, y, width, height) {
|
|
7146
|
-
this.rect(x, y, width, height).stroke();
|
|
7147
|
-
}
|
|
7148
|
-
fill(options) {
|
|
7149
|
-
if (!this.curves.length) {
|
|
7150
|
-
return;
|
|
7151
|
-
}
|
|
7152
|
-
let fillStyle = this.fillStyle;
|
|
7153
|
-
if (!fillStyle && this.style.fill) {
|
|
7154
|
-
switch (typeof this.style.fill) {
|
|
7155
|
-
case "string":
|
|
7156
|
-
fillStyle = this.style.fill;
|
|
7157
|
-
break;
|
|
7158
|
-
case "object":
|
|
7159
|
-
if (modernIdoc.isColorFillObject(this.style.fill)) {
|
|
7160
|
-
fillStyle = this.style.fill.color;
|
|
7161
|
-
}
|
|
7162
|
-
break;
|
|
7163
|
-
}
|
|
7164
|
-
}
|
|
7165
|
-
this._draws.push({
|
|
7166
|
-
...options,
|
|
7167
|
-
type: "fill",
|
|
7168
|
-
path: new modernPath2d.Path2D(this),
|
|
7169
|
-
texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
|
|
7170
|
-
uvTransform: this.uvTransform,
|
|
7171
|
-
vertTransform: this.vertTransform
|
|
7172
|
-
});
|
|
7173
|
-
super.reset();
|
|
7174
|
-
}
|
|
7175
|
-
copy(source) {
|
|
7176
|
-
super.copy(source);
|
|
7177
|
-
this.strokeStyle = source.strokeStyle;
|
|
7178
|
-
this.fillStyle = source.fillStyle;
|
|
7179
|
-
this.uvTransform = source.uvTransform;
|
|
7180
|
-
this.vertTransform = source.vertTransform;
|
|
7181
|
-
this.lineCap = source.lineCap;
|
|
7182
|
-
this.lineJoin = source.lineJoin;
|
|
7183
|
-
this.lineWidth = source.lineWidth;
|
|
7184
|
-
this.miterLimit = source.miterLimit;
|
|
7185
|
-
this._draws = source._draws.slice();
|
|
7186
|
-
return this;
|
|
7187
|
-
}
|
|
7188
|
-
reset() {
|
|
7189
|
-
super.reset();
|
|
7190
|
-
this.strokeStyle = void 0;
|
|
7191
|
-
this.fillStyle = void 0;
|
|
7192
|
-
this.uvTransform = void 0;
|
|
7193
|
-
this.vertTransform = void 0;
|
|
7194
|
-
this.lineCap = void 0;
|
|
7195
|
-
this.lineJoin = void 0;
|
|
7196
|
-
this.lineWidth = void 0;
|
|
7197
|
-
this.miterLimit = void 0;
|
|
7198
|
-
this._draws.length = 0;
|
|
7199
|
-
return this;
|
|
7200
|
-
}
|
|
7201
|
-
buildUvs(start, vertices, uvs, texture, uvTransform) {
|
|
7202
|
-
if (texture) {
|
|
7203
|
-
const _uvTransform = uvTransform ? typeof uvTransform === "function" ? uvTransform : (x, y) => uvTransform.applyToPoint(x, y) : uvTransform;
|
|
7204
|
-
const w = texture.width;
|
|
7205
|
-
const h = texture.height;
|
|
7206
|
-
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
7207
|
-
const x = vertices[i];
|
|
7208
|
-
const y = vertices[i + 1];
|
|
7209
|
-
let uvX;
|
|
7210
|
-
let uvY;
|
|
7211
|
-
if (_uvTransform) {
|
|
7212
|
-
[uvX, uvY] = _uvTransform(x, y);
|
|
7213
|
-
} else {
|
|
7214
|
-
[uvX, uvY] = [x / w, y / h];
|
|
7215
|
-
}
|
|
7216
|
-
uvs.push(uvX, uvY);
|
|
7217
|
-
}
|
|
7218
|
-
} else {
|
|
7219
|
-
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
7220
|
-
uvs.push(0, 0);
|
|
7221
|
-
}
|
|
7222
|
-
}
|
|
7223
|
-
}
|
|
7224
|
-
toBatchables() {
|
|
7225
|
-
const batchables = [];
|
|
7226
|
-
for (let len = this._draws.length, i = 0; i < len; i++) {
|
|
7227
|
-
const current = this._draws[i];
|
|
7228
|
-
const vertices = [];
|
|
7229
|
-
const indices = [];
|
|
7230
|
-
const uvs = [];
|
|
7231
|
-
if (current.type === "fill") {
|
|
7232
|
-
current.path.fillTriangulate({
|
|
7233
|
-
vertices,
|
|
7234
|
-
indices
|
|
7235
|
-
});
|
|
7236
|
-
} else {
|
|
7237
|
-
current.path.strokeTriangulate({
|
|
7238
|
-
vertices,
|
|
7239
|
-
indices,
|
|
7240
|
-
lineStyle: current.style,
|
|
7241
|
-
flipAlignment: false,
|
|
7242
|
-
closed: true
|
|
7243
|
-
});
|
|
7244
|
-
}
|
|
7245
|
-
this.buildUvs(0, vertices, uvs, current.texture, current.uvTransform);
|
|
7246
|
-
batchables.push({
|
|
7247
|
-
vertices,
|
|
7248
|
-
indices,
|
|
7249
|
-
uvs,
|
|
7250
|
-
texture: current.texture,
|
|
7251
|
-
type: current.type,
|
|
7252
|
-
disableWrapMode: current.disableWrapMode,
|
|
7253
|
-
vertTransform: current.vertTransform
|
|
7254
|
-
});
|
|
7255
|
-
}
|
|
7256
|
-
return batchables;
|
|
7257
|
-
}
|
|
7258
|
-
}
|
|
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);
|
|
7259
7507
|
|
|
7260
|
-
var __defProp$
|
|
7261
|
-
var __getOwnPropDesc$
|
|
7262
|
-
var
|
|
7263
|
-
|
|
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;
|
|
7264
7513
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7265
7514
|
if (decorator = decorators[i])
|
|
7266
7515
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7267
|
-
if (kind && result) __defProp$
|
|
7516
|
+
if (kind && result) __defProp$z(target, key, result);
|
|
7268
7517
|
return result;
|
|
7269
7518
|
};
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
return this._globalVisible ?? true;
|
|
7275
|
-
}
|
|
7276
|
-
_parentGlobalOpacity;
|
|
7277
|
-
_globalOpacity;
|
|
7278
|
-
get globalOpacity() {
|
|
7279
|
-
return this._globalOpacity ?? 1;
|
|
7280
|
-
}
|
|
7281
|
-
_modulate = new Color(4294967295);
|
|
7282
|
-
// Batch render
|
|
7283
|
-
context = new CanvasContext();
|
|
7284
|
-
_resetContext = true;
|
|
7285
|
-
_redrawing = true;
|
|
7286
|
-
_relayouting = false;
|
|
7287
|
-
_repainting = false;
|
|
7288
|
-
_originalBatchables = [];
|
|
7289
|
-
_layoutedBatchables = [];
|
|
7290
|
-
_batchables = [];
|
|
7291
|
-
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 = []) {
|
|
7292
7523
|
super();
|
|
7293
|
-
this.setProperties(properties).append(
|
|
7294
|
-
}
|
|
7295
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
7296
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
7297
|
-
switch (key) {
|
|
7298
|
-
case "modulate":
|
|
7299
|
-
this._modulate.value = value;
|
|
7300
|
-
this.requestRepaint();
|
|
7301
|
-
break;
|
|
7302
|
-
case "blendMode":
|
|
7303
|
-
this.requestRepaint();
|
|
7304
|
-
break;
|
|
7305
|
-
case "opacity":
|
|
7306
|
-
this._updateGlobalOpacity();
|
|
7307
|
-
break;
|
|
7308
|
-
case "visible":
|
|
7309
|
-
case "insideTimeRange":
|
|
7310
|
-
this._updateGlobalVisible();
|
|
7311
|
-
break;
|
|
7312
|
-
}
|
|
7313
|
-
}
|
|
7314
|
-
show() {
|
|
7315
|
-
this.visible = true;
|
|
7316
|
-
}
|
|
7317
|
-
hide() {
|
|
7318
|
-
this.visible = false;
|
|
7319
|
-
}
|
|
7320
|
-
isVisibleInTree() {
|
|
7321
|
-
return this.globalOpacity > 0 && this.globalVisible;
|
|
7322
|
-
}
|
|
7323
|
-
canRender() {
|
|
7324
|
-
return super.canRender() && this.isVisibleInTree();
|
|
7325
|
-
}
|
|
7326
|
-
requestRedraw() {
|
|
7327
|
-
this._redrawing = true;
|
|
7328
|
-
}
|
|
7329
|
-
requestRelayout() {
|
|
7330
|
-
this._relayouting = true;
|
|
7331
|
-
}
|
|
7332
|
-
requestRepaint() {
|
|
7333
|
-
this._repainting = true;
|
|
7334
|
-
}
|
|
7335
|
-
_updateGlobalVisible() {
|
|
7336
|
-
this._parentGlobalVisible = this.getParent()?.globalVisible;
|
|
7337
|
-
this._globalVisible = (this._parentGlobalVisible ?? true) && this.visible && this.insideTimeRange;
|
|
7338
|
-
}
|
|
7339
|
-
_updateGlobalOpacity() {
|
|
7340
|
-
this._parentGlobalOpacity = this.getParent()?.opacity;
|
|
7341
|
-
const globalOpacity = clamp(0, this.opacity, 1) * (this._parentGlobalOpacity ?? 1);
|
|
7342
|
-
if (this._globalOpacity !== globalOpacity) {
|
|
7343
|
-
this._globalOpacity = globalOpacity;
|
|
7344
|
-
this.requestRepaint();
|
|
7345
|
-
}
|
|
7346
|
-
}
|
|
7347
|
-
_draw() {
|
|
7348
|
-
this.emit("draw");
|
|
7349
|
-
}
|
|
7350
|
-
_redraw() {
|
|
7351
|
-
this.log(this.name, "drawing");
|
|
7352
|
-
this._draw();
|
|
7353
|
-
return this.context.toBatchables();
|
|
7354
|
-
}
|
|
7355
|
-
_relayout(batchables) {
|
|
7356
|
-
this.log(this.name, "layouting");
|
|
7357
|
-
return batchables;
|
|
7358
|
-
}
|
|
7359
|
-
_repaint(batchables) {
|
|
7360
|
-
this.log(this.name, "painting");
|
|
7361
|
-
return batchables.map((batchable) => {
|
|
7362
|
-
return {
|
|
7363
|
-
...batchable,
|
|
7364
|
-
modulate: this._modulate.toArgb(this.globalOpacity, true),
|
|
7365
|
-
blendMode: this.blendMode
|
|
7366
|
-
};
|
|
7367
|
-
});
|
|
7368
|
-
}
|
|
7369
|
-
_process(delta) {
|
|
7370
|
-
super._process(delta);
|
|
7371
|
-
const parent = this.getParent();
|
|
7372
|
-
if (this._parentGlobalVisible !== parent?.globalVisible) {
|
|
7373
|
-
this._updateGlobalVisible();
|
|
7374
|
-
}
|
|
7375
|
-
if (this._parentGlobalOpacity !== parent?.globalOpacity) {
|
|
7376
|
-
this._updateGlobalOpacity();
|
|
7377
|
-
}
|
|
7524
|
+
this.setProperties(properties).append(children);
|
|
7378
7525
|
}
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
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;
|
|
7398
7559
|
}
|
|
7399
|
-
}
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
this._repainting = false;
|
|
7405
|
-
}
|
|
7406
|
-
}
|
|
7407
|
-
_render(renderer) {
|
|
7408
|
-
this._updateBatchables();
|
|
7409
|
-
this._batchables.forEach((batchable) => {
|
|
7410
|
-
batchable.texture?.upload(renderer);
|
|
7411
|
-
renderer.batch2D.render({
|
|
7412
|
-
...batchable,
|
|
7413
|
-
texture: batchable.texture?._glTexture(renderer)
|
|
7560
|
+
});
|
|
7561
|
+
source.redraw(renderer, () => {
|
|
7562
|
+
QuadUvGeometry.draw(renderer, exports.ColorFilterEffect.material, {
|
|
7563
|
+
sampler: 0,
|
|
7564
|
+
m: matrix.toArray()
|
|
7414
7565
|
});
|
|
7415
7566
|
});
|
|
7416
|
-
super._render(renderer);
|
|
7417
7567
|
}
|
|
7418
7568
|
};
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
calls = [];
|
|
7438
|
-
createCall(renderable) {
|
|
7439
|
-
return {
|
|
7440
|
-
renderable,
|
|
7441
|
-
parentCall: this.currentCall,
|
|
7442
|
-
fn: renderable.render.bind(renderable),
|
|
7443
|
-
calls: []
|
|
7444
|
-
};
|
|
7445
|
-
}
|
|
7446
|
-
push(renderable) {
|
|
7447
|
-
const call = this.createCall(renderable);
|
|
7448
|
-
(this.currentCall?.calls ?? this.calls).push(call);
|
|
7449
|
-
return call;
|
|
7450
|
-
}
|
|
7451
|
-
render(renderer) {
|
|
7452
|
-
this.calls.forEach(function render(call) {
|
|
7453
|
-
call.fn(renderer, () => {
|
|
7454
|
-
call.calls.forEach(render);
|
|
7455
|
-
});
|
|
7456
|
-
});
|
|
7457
|
-
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;
|
|
7458
7587
|
}
|
|
7459
|
-
|
|
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);
|
|
7460
7602
|
|
|
7461
|
-
var __defProp$
|
|
7462
|
-
var __getOwnPropDesc$
|
|
7463
|
-
var
|
|
7464
|
-
|
|
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;
|
|
7465
7608
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7466
7609
|
if (decorator = decorators[i])
|
|
7467
7610
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7468
|
-
if (kind && result) __defProp$
|
|
7611
|
+
if (kind && result) __defProp$y(target, key, result);
|
|
7469
7612
|
return result;
|
|
7470
7613
|
};
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
endTime,
|
|
7477
|
-
loop
|
|
7478
|
-
});
|
|
7479
|
-
}
|
|
7480
|
-
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 = []) {
|
|
7481
7619
|
super();
|
|
7482
|
-
this.setProperties(properties);
|
|
7620
|
+
this.setProperties(properties).append(children);
|
|
7483
7621
|
}
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
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
|
+
});
|
|
7494
7638
|
}
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
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];
|
|
7502
7675
|
}
|
|
7503
|
-
current = clamp(start, current, end);
|
|
7504
|
-
this.currentTime = current;
|
|
7505
|
-
this.emit("updateCurrentTime", current, delta);
|
|
7506
|
-
return this;
|
|
7507
|
-
}
|
|
7508
|
-
_process(delta) {
|
|
7509
|
-
super._process(delta);
|
|
7510
|
-
this.addTime(delta);
|
|
7511
7676
|
}
|
|
7512
|
-
};
|
|
7513
|
-
__decorateClass$H([
|
|
7514
|
-
modernIdoc.property({ fallback: 0 })
|
|
7515
|
-
], exports.Timeline.prototype, "startTime", 2);
|
|
7516
|
-
__decorateClass$H([
|
|
7517
|
-
modernIdoc.property({ fallback: 0 })
|
|
7518
|
-
], exports.Timeline.prototype, "currentTime", 2);
|
|
7519
|
-
__decorateClass$H([
|
|
7520
|
-
modernIdoc.property({ fallback: Number.MAX_SAFE_INTEGER })
|
|
7521
|
-
], exports.Timeline.prototype, "endTime", 2);
|
|
7522
|
-
__decorateClass$H([
|
|
7523
|
-
modernIdoc.property({ fallback: false })
|
|
7524
|
-
], exports.Timeline.prototype, "loop", 2);
|
|
7525
|
-
exports.Timeline = __decorateClass$H([
|
|
7526
|
-
customNode("Timeline")
|
|
7527
|
-
], exports.Timeline);
|
|
7528
7677
|
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
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;
|
|
7532
7702
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7533
7703
|
if (decorator = decorators[i])
|
|
7534
|
-
result = (decorator(target, key, result) ) || result;
|
|
7535
|
-
if (result) __defProp$
|
|
7704
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7705
|
+
if (kind && result) __defProp$x(target, key, result);
|
|
7536
7706
|
return result;
|
|
7537
7707
|
};
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
timeline;
|
|
7543
|
-
nodes = /* @__PURE__ */ new Map();
|
|
7544
|
-
_backgroundColor = new Color();
|
|
7545
|
-
_currentViewport;
|
|
7546
|
-
getCurrentViewport() {
|
|
7547
|
-
return this._currentViewport;
|
|
7548
|
-
}
|
|
7549
|
-
setCurrentViewport(viewport) {
|
|
7550
|
-
this._currentViewport = viewport;
|
|
7551
|
-
}
|
|
7552
|
-
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 = []) {
|
|
7553
7712
|
super();
|
|
7554
|
-
this.
|
|
7555
|
-
}
|
|
7556
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
7557
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
7558
|
-
switch (key) {
|
|
7559
|
-
case "backgroundColor":
|
|
7560
|
-
this._backgroundColor.value = value;
|
|
7561
|
-
break;
|
|
7562
|
-
}
|
|
7713
|
+
this.setProperties(properties).append(children);
|
|
7563
7714
|
}
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
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]);
|
|
7567
7724
|
}
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
this.root.emit("process", delta);
|
|
7573
|
-
this.emit("processed");
|
|
7574
|
-
}
|
|
7575
|
-
_render(renderer) {
|
|
7576
|
-
this.emit("rendering");
|
|
7577
|
-
renderer.program.uniforms.projectionMatrix = this.root.toProjectionArray(true);
|
|
7578
|
-
this.renderStack.render(renderer);
|
|
7579
|
-
this._renderScreen(renderer);
|
|
7580
|
-
this.emit("rendered");
|
|
7581
|
-
}
|
|
7582
|
-
_renderScreen(renderer) {
|
|
7583
|
-
renderer.state.reset();
|
|
7584
|
-
renderer.framebuffer.bind(null);
|
|
7585
|
-
renderer.viewport.bind({
|
|
7586
|
-
x: 0,
|
|
7587
|
-
y: 0,
|
|
7588
|
-
width: this.root.width * renderer.pixelRatio,
|
|
7589
|
-
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];
|
|
7590
7729
|
});
|
|
7591
|
-
|
|
7592
|
-
|
|
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;
|
|
7593
7761
|
}
|
|
7594
|
-
|
|
7595
|
-
if (
|
|
7596
|
-
|
|
7762
|
+
vec3 colorDiff = origColor - color.rgb;
|
|
7763
|
+
if (length(colorDiff) < epsilon) {
|
|
7764
|
+
gl_FragColor = vec4(0, 0, 0, 0);
|
|
7765
|
+
return;
|
|
7597
7766
|
}
|
|
7598
|
-
const texture = this.root.texture;
|
|
7599
|
-
texture.activate(renderer, 0);
|
|
7600
|
-
QuadUvGeometry.draw(renderer);
|
|
7601
|
-
renderer.texture.unbind(texture);
|
|
7602
|
-
}
|
|
7603
|
-
free() {
|
|
7604
|
-
super.free();
|
|
7605
|
-
this.root.children.internal.forEach((node) => this.root.removeChild(node));
|
|
7606
|
-
this.input.removeEventListeners();
|
|
7607
7767
|
}
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
__decorateClass$
|
|
7768
|
+
|
|
7769
|
+
gl_FragColor = color;
|
|
7770
|
+
}`
|
|
7771
|
+
}));
|
|
7772
|
+
__decorateClass$E([
|
|
7613
7773
|
modernIdoc.property()
|
|
7614
|
-
],
|
|
7615
|
-
__decorateClass$
|
|
7616
|
-
modernIdoc.property(
|
|
7617
|
-
],
|
|
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);
|
|
7618
7781
|
|
|
7619
|
-
var
|
|
7620
|
-
var
|
|
7621
|
-
|
|
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;
|
|
7622
7787
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7623
7788
|
if (decorator = decorators[i])
|
|
7624
|
-
result = (decorator(result)) || result;
|
|
7789
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7790
|
+
if (kind && result) __defProp$w(target, key, result);
|
|
7625
7791
|
return result;
|
|
7626
7792
|
};
|
|
7627
|
-
|
|
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();
|
|
7628
7797
|
constructor(properties, children = []) {
|
|
7629
7798
|
super();
|
|
7630
7799
|
this.setProperties(properties).append(children);
|
|
7631
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
|
+
}
|
|
7632
7838
|
};
|
|
7633
|
-
exports.
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
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];
|
|
7640
7854
|
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
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;
|
|
7646
7894
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7647
7895
|
if (decorator = decorators[i])
|
|
7648
7896
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7649
|
-
if (kind && result) __defProp$
|
|
7897
|
+
if (kind && result) __defProp$v(target, key, result);
|
|
7650
7898
|
return result;
|
|
7651
7899
|
};
|
|
7652
7900
|
var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -7752,25 +8000,25 @@ void main(void) {
|
|
|
7752
8000
|
}`,
|
|
7753
8001
|
frag: frag$2
|
|
7754
8002
|
}));
|
|
7755
|
-
__decorateClass$
|
|
8003
|
+
__decorateClass$C([
|
|
7756
8004
|
modernIdoc.property({ default: 4 })
|
|
7757
8005
|
], exports.GaussianBlurEffect.prototype, "strength", 2);
|
|
7758
|
-
__decorateClass$
|
|
8006
|
+
__decorateClass$C([
|
|
7759
8007
|
modernIdoc.property({ default: 3 })
|
|
7760
8008
|
], exports.GaussianBlurEffect.prototype, "quality", 2);
|
|
7761
|
-
exports.GaussianBlurEffect = __decorateClass$
|
|
8009
|
+
exports.GaussianBlurEffect = __decorateClass$C([
|
|
7762
8010
|
customNode("GaussianBlurEffect")
|
|
7763
8011
|
], exports.GaussianBlurEffect);
|
|
7764
8012
|
|
|
7765
|
-
var __defProp$
|
|
7766
|
-
var __getOwnPropDesc$
|
|
7767
|
-
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$
|
|
7768
|
-
var __decorateClass$
|
|
7769
|
-
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;
|
|
7770
8018
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7771
8019
|
if (decorator = decorators[i])
|
|
7772
8020
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7773
|
-
if (kind && result) __defProp$
|
|
8021
|
+
if (kind && result) __defProp$u(target, key, result);
|
|
7774
8022
|
return result;
|
|
7775
8023
|
};
|
|
7776
8024
|
var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, key + "" , value);
|
|
@@ -7834,34 +8082,34 @@ void main(void) {
|
|
|
7834
8082
|
gl_FragColor = sample;
|
|
7835
8083
|
}`
|
|
7836
8084
|
}));
|
|
7837
|
-
__decorateClass$
|
|
8085
|
+
__decorateClass$B([
|
|
7838
8086
|
modernIdoc.property()
|
|
7839
8087
|
], exports.DropShadowEffect.prototype, "color", 2);
|
|
7840
|
-
__decorateClass$
|
|
8088
|
+
__decorateClass$B([
|
|
7841
8089
|
modernIdoc.property()
|
|
7842
8090
|
], exports.DropShadowEffect.prototype, "blur", 2);
|
|
7843
|
-
__decorateClass$
|
|
8091
|
+
__decorateClass$B([
|
|
7844
8092
|
modernIdoc.property()
|
|
7845
8093
|
], exports.DropShadowEffect.prototype, "offsetX", 2);
|
|
7846
|
-
__decorateClass$
|
|
8094
|
+
__decorateClass$B([
|
|
7847
8095
|
modernIdoc.property()
|
|
7848
8096
|
], exports.DropShadowEffect.prototype, "offsetY", 2);
|
|
7849
|
-
__decorateClass$
|
|
8097
|
+
__decorateClass$B([
|
|
7850
8098
|
modernIdoc.property()
|
|
7851
8099
|
], exports.DropShadowEffect.prototype, "shadowOnly", 2);
|
|
7852
|
-
exports.DropShadowEffect = __decorateClass$
|
|
8100
|
+
exports.DropShadowEffect = __decorateClass$B([
|
|
7853
8101
|
customNode("DropShadowEffect")
|
|
7854
8102
|
], exports.DropShadowEffect);
|
|
7855
8103
|
|
|
7856
|
-
var __defProp$
|
|
7857
|
-
var __getOwnPropDesc$
|
|
7858
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$
|
|
7859
|
-
var __decorateClass$
|
|
7860
|
-
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;
|
|
7861
8109
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7862
8110
|
if (decorator = decorators[i])
|
|
7863
8111
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7864
|
-
if (kind && result) __defProp$
|
|
8112
|
+
if (kind && result) __defProp$t(target, key, result);
|
|
7865
8113
|
return result;
|
|
7866
8114
|
};
|
|
7867
8115
|
var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, key + "" , value);
|
|
@@ -7906,22 +8154,22 @@ void main(void) {
|
|
|
7906
8154
|
gl_FragColor = vec4(color.rgb * alpha, alpha);
|
|
7907
8155
|
}`
|
|
7908
8156
|
}));
|
|
7909
|
-
__decorateClass$
|
|
8157
|
+
__decorateClass$A([
|
|
7910
8158
|
modernIdoc.property()
|
|
7911
8159
|
], exports.EmbossEffect.prototype, "strength", 2);
|
|
7912
|
-
exports.EmbossEffect = __decorateClass$
|
|
8160
|
+
exports.EmbossEffect = __decorateClass$A([
|
|
7913
8161
|
customNode("EmbossEffect")
|
|
7914
8162
|
], exports.EmbossEffect);
|
|
7915
8163
|
|
|
7916
|
-
var __defProp$
|
|
7917
|
-
var __getOwnPropDesc$
|
|
7918
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$
|
|
7919
|
-
var __decorateClass$
|
|
7920
|
-
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;
|
|
7921
8169
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7922
8170
|
if (decorator = decorators[i])
|
|
7923
8171
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7924
|
-
if (kind && result) __defProp$
|
|
8172
|
+
if (kind && result) __defProp$s(target, key, result);
|
|
7925
8173
|
return result;
|
|
7926
8174
|
};
|
|
7927
8175
|
var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, key + "" , value);
|
|
@@ -8095,46 +8343,46 @@ void main(void) {
|
|
|
8095
8343
|
gl_FragColor.a = texture2D(sampler, coord).a;
|
|
8096
8344
|
}`
|
|
8097
8345
|
}));
|
|
8098
|
-
__decorateClass$
|
|
8346
|
+
__decorateClass$z([
|
|
8099
8347
|
modernIdoc.property()
|
|
8100
8348
|
], exports.GlitchEffect.prototype, "slices", 2);
|
|
8101
|
-
__decorateClass$
|
|
8349
|
+
__decorateClass$z([
|
|
8102
8350
|
modernIdoc.property()
|
|
8103
8351
|
], exports.GlitchEffect.prototype, "sampleSize", 2);
|
|
8104
|
-
__decorateClass$
|
|
8352
|
+
__decorateClass$z([
|
|
8105
8353
|
modernIdoc.property()
|
|
8106
8354
|
], exports.GlitchEffect.prototype, "offset", 2);
|
|
8107
|
-
__decorateClass$
|
|
8355
|
+
__decorateClass$z([
|
|
8108
8356
|
modernIdoc.property()
|
|
8109
8357
|
], exports.GlitchEffect.prototype, "direction", 2);
|
|
8110
|
-
__decorateClass$
|
|
8358
|
+
__decorateClass$z([
|
|
8111
8359
|
modernIdoc.property()
|
|
8112
8360
|
], exports.GlitchEffect.prototype, "fillMode", 2);
|
|
8113
|
-
__decorateClass$
|
|
8361
|
+
__decorateClass$z([
|
|
8114
8362
|
modernIdoc.property()
|
|
8115
8363
|
], exports.GlitchEffect.prototype, "seed", 2);
|
|
8116
|
-
__decorateClass$
|
|
8364
|
+
__decorateClass$z([
|
|
8117
8365
|
modernIdoc.property()
|
|
8118
8366
|
], exports.GlitchEffect.prototype, "red", 2);
|
|
8119
|
-
__decorateClass$
|
|
8367
|
+
__decorateClass$z([
|
|
8120
8368
|
modernIdoc.property()
|
|
8121
8369
|
], exports.GlitchEffect.prototype, "green", 2);
|
|
8122
|
-
__decorateClass$
|
|
8370
|
+
__decorateClass$z([
|
|
8123
8371
|
modernIdoc.property()
|
|
8124
8372
|
], exports.GlitchEffect.prototype, "blue", 2);
|
|
8125
|
-
exports.GlitchEffect = __decorateClass$
|
|
8373
|
+
exports.GlitchEffect = __decorateClass$z([
|
|
8126
8374
|
customNode("GlitchEffect")
|
|
8127
8375
|
], exports.GlitchEffect);
|
|
8128
8376
|
|
|
8129
|
-
var __defProp$
|
|
8130
|
-
var __getOwnPropDesc$
|
|
8131
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$
|
|
8132
|
-
var __decorateClass$
|
|
8133
|
-
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;
|
|
8134
8382
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8135
8383
|
if (decorator = decorators[i])
|
|
8136
8384
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8137
|
-
if (kind && result) __defProp$
|
|
8385
|
+
if (kind && result) __defProp$r(target, key, result);
|
|
8138
8386
|
return result;
|
|
8139
8387
|
};
|
|
8140
8388
|
var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
|
|
@@ -8312,39 +8560,39 @@ void main(void) {
|
|
|
8312
8560
|
gl_FragColor = vec4(color.rgb + mist.rgb, color.a);
|
|
8313
8561
|
}`
|
|
8314
8562
|
}));
|
|
8315
|
-
__decorateClass$
|
|
8563
|
+
__decorateClass$y([
|
|
8316
8564
|
modernIdoc.property()
|
|
8317
8565
|
], exports.GodrayEffect.prototype, "time", 2);
|
|
8318
|
-
__decorateClass$
|
|
8566
|
+
__decorateClass$y([
|
|
8319
8567
|
modernIdoc.property()
|
|
8320
8568
|
], exports.GodrayEffect.prototype, "angle", 2);
|
|
8321
|
-
__decorateClass$
|
|
8569
|
+
__decorateClass$y([
|
|
8322
8570
|
modernIdoc.property()
|
|
8323
8571
|
], exports.GodrayEffect.prototype, "gain", 2);
|
|
8324
|
-
__decorateClass$
|
|
8572
|
+
__decorateClass$y([
|
|
8325
8573
|
modernIdoc.property()
|
|
8326
8574
|
], exports.GodrayEffect.prototype, "lacunarity", 2);
|
|
8327
|
-
__decorateClass$
|
|
8575
|
+
__decorateClass$y([
|
|
8328
8576
|
modernIdoc.property()
|
|
8329
8577
|
], exports.GodrayEffect.prototype, "parallel", 2);
|
|
8330
|
-
__decorateClass$
|
|
8578
|
+
__decorateClass$y([
|
|
8331
8579
|
modernIdoc.property()
|
|
8332
8580
|
], exports.GodrayEffect.prototype, "center", 2);
|
|
8333
|
-
__decorateClass$
|
|
8581
|
+
__decorateClass$y([
|
|
8334
8582
|
modernIdoc.property()
|
|
8335
8583
|
], exports.GodrayEffect.prototype, "alpha", 2);
|
|
8336
|
-
exports.GodrayEffect = __decorateClass$
|
|
8584
|
+
exports.GodrayEffect = __decorateClass$y([
|
|
8337
8585
|
customNode("GodrayEffect")
|
|
8338
8586
|
], exports.GodrayEffect);
|
|
8339
8587
|
|
|
8340
|
-
var __defProp$
|
|
8341
|
-
var __getOwnPropDesc$
|
|
8342
|
-
var __decorateClass$
|
|
8343
|
-
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;
|
|
8344
8592
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8345
8593
|
if (decorator = decorators[i])
|
|
8346
8594
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8347
|
-
if (kind && result) __defProp$
|
|
8595
|
+
if (kind && result) __defProp$q(target, key, result);
|
|
8348
8596
|
return result;
|
|
8349
8597
|
};
|
|
8350
8598
|
const frag$1 = `varying vec2 vUv;
|
|
@@ -8434,28 +8682,28 @@ void main() {
|
|
|
8434
8682
|
});
|
|
8435
8683
|
}
|
|
8436
8684
|
};
|
|
8437
|
-
__decorateClass$
|
|
8685
|
+
__decorateClass$x([
|
|
8438
8686
|
modernIdoc.property()
|
|
8439
8687
|
], exports.KawaseBlurEffect.prototype, "strength", 2);
|
|
8440
|
-
__decorateClass$
|
|
8688
|
+
__decorateClass$x([
|
|
8441
8689
|
modernIdoc.property()
|
|
8442
8690
|
], exports.KawaseBlurEffect.prototype, "quality", 2);
|
|
8443
|
-
__decorateClass$
|
|
8691
|
+
__decorateClass$x([
|
|
8444
8692
|
modernIdoc.property()
|
|
8445
8693
|
], exports.KawaseBlurEffect.prototype, "pixelSize", 2);
|
|
8446
|
-
exports.KawaseBlurEffect = __decorateClass$
|
|
8694
|
+
exports.KawaseBlurEffect = __decorateClass$x([
|
|
8447
8695
|
customNode("KawaseBlurEffect")
|
|
8448
8696
|
], exports.KawaseBlurEffect);
|
|
8449
8697
|
|
|
8450
|
-
var __defProp$
|
|
8451
|
-
var __getOwnPropDesc$
|
|
8452
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$
|
|
8453
|
-
var __decorateClass$
|
|
8454
|
-
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;
|
|
8455
8703
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8456
8704
|
if (decorator = decorators[i])
|
|
8457
8705
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8458
|
-
if (kind && result) __defProp$
|
|
8706
|
+
if (kind && result) __defProp$p(target, key, result);
|
|
8459
8707
|
return result;
|
|
8460
8708
|
};
|
|
8461
8709
|
var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
|
|
@@ -8543,25 +8791,25 @@ void main(void) {
|
|
|
8543
8791
|
}
|
|
8544
8792
|
}`
|
|
8545
8793
|
}));
|
|
8546
|
-
__decorateClass$
|
|
8794
|
+
__decorateClass$w([
|
|
8547
8795
|
modernIdoc.property({ protected: true })
|
|
8548
8796
|
], exports.MaskEffect.prototype, "texture", 2);
|
|
8549
|
-
__decorateClass$
|
|
8797
|
+
__decorateClass$w([
|
|
8550
8798
|
modernIdoc.property({ default: "" })
|
|
8551
8799
|
], exports.MaskEffect.prototype, "src", 2);
|
|
8552
|
-
exports.MaskEffect = __decorateClass$
|
|
8800
|
+
exports.MaskEffect = __decorateClass$w([
|
|
8553
8801
|
customNode("MaskEffect")
|
|
8554
8802
|
], exports.MaskEffect);
|
|
8555
8803
|
|
|
8556
|
-
var __defProp$
|
|
8557
|
-
var __getOwnPropDesc$
|
|
8558
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$
|
|
8559
|
-
var __decorateClass$
|
|
8560
|
-
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;
|
|
8561
8809
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8562
8810
|
if (decorator = decorators[i])
|
|
8563
8811
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8564
|
-
if (kind && result) __defProp$
|
|
8812
|
+
if (kind && result) __defProp$o(target, key, result);
|
|
8565
8813
|
return result;
|
|
8566
8814
|
};
|
|
8567
8815
|
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -8648,40 +8896,40 @@ void main() {
|
|
|
8648
8896
|
};
|
|
8649
8897
|
__publicField$7(exports.OutlineEffect, "MIN_SAMPLES", 1);
|
|
8650
8898
|
__publicField$7(exports.OutlineEffect, "MAX_SAMPLES", 100);
|
|
8651
|
-
__decorateClass$
|
|
8899
|
+
__decorateClass$v([
|
|
8652
8900
|
modernIdoc.property()
|
|
8653
8901
|
], exports.OutlineEffect.prototype, "color", 2);
|
|
8654
|
-
__decorateClass$
|
|
8902
|
+
__decorateClass$v([
|
|
8655
8903
|
modernIdoc.property()
|
|
8656
8904
|
], exports.OutlineEffect.prototype, "width", 2);
|
|
8657
|
-
__decorateClass$
|
|
8905
|
+
__decorateClass$v([
|
|
8658
8906
|
modernIdoc.property()
|
|
8659
8907
|
], exports.OutlineEffect.prototype, "style", 2);
|
|
8660
|
-
__decorateClass$
|
|
8908
|
+
__decorateClass$v([
|
|
8661
8909
|
modernIdoc.property()
|
|
8662
8910
|
], exports.OutlineEffect.prototype, "image", 2);
|
|
8663
|
-
__decorateClass$
|
|
8911
|
+
__decorateClass$v([
|
|
8664
8912
|
modernIdoc.property()
|
|
8665
8913
|
], exports.OutlineEffect.prototype, "opacity", 2);
|
|
8666
|
-
__decorateClass$
|
|
8914
|
+
__decorateClass$v([
|
|
8667
8915
|
modernIdoc.property()
|
|
8668
8916
|
], exports.OutlineEffect.prototype, "quality", 2);
|
|
8669
|
-
__decorateClass$
|
|
8917
|
+
__decorateClass$v([
|
|
8670
8918
|
modernIdoc.property()
|
|
8671
8919
|
], exports.OutlineEffect.prototype, "knockout", 2);
|
|
8672
|
-
exports.OutlineEffect = __decorateClass$
|
|
8920
|
+
exports.OutlineEffect = __decorateClass$v([
|
|
8673
8921
|
customNode("OutlineEffect")
|
|
8674
8922
|
], exports.OutlineEffect);
|
|
8675
8923
|
|
|
8676
|
-
var __defProp$
|
|
8677
|
-
var __getOwnPropDesc$
|
|
8678
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$
|
|
8679
|
-
var __decorateClass$
|
|
8680
|
-
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;
|
|
8681
8929
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8682
8930
|
if (decorator = decorators[i])
|
|
8683
8931
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8684
|
-
if (kind && result) __defProp$
|
|
8932
|
+
if (kind && result) __defProp$n(target, key, result);
|
|
8685
8933
|
return result;
|
|
8686
8934
|
};
|
|
8687
8935
|
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
|
|
@@ -8737,22 +8985,22 @@ void main(void) {
|
|
|
8737
8985
|
gl_FragColor = texture2D(sampler, coord);
|
|
8738
8986
|
}`
|
|
8739
8987
|
}));
|
|
8740
|
-
__decorateClass$
|
|
8988
|
+
__decorateClass$u([
|
|
8741
8989
|
modernIdoc.property()
|
|
8742
8990
|
], exports.PixelateEffect.prototype, "strength", 2);
|
|
8743
|
-
exports.PixelateEffect = __decorateClass$
|
|
8991
|
+
exports.PixelateEffect = __decorateClass$u([
|
|
8744
8992
|
customNode("PixelateEffect")
|
|
8745
8993
|
], exports.PixelateEffect);
|
|
8746
8994
|
|
|
8747
|
-
var __defProp$
|
|
8748
|
-
var __getOwnPropDesc$
|
|
8749
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$
|
|
8750
|
-
var __decorateClass$
|
|
8751
|
-
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;
|
|
8752
9000
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8753
9001
|
if (decorator = decorators[i])
|
|
8754
9002
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8755
|
-
if (kind && result) __defProp$
|
|
9003
|
+
if (kind && result) __defProp$m(target, key, result);
|
|
8756
9004
|
return result;
|
|
8757
9005
|
};
|
|
8758
9006
|
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
|
|
@@ -8865,29 +9113,29 @@ void main() {
|
|
|
8865
9113
|
gl_FragColor = color;
|
|
8866
9114
|
}`
|
|
8867
9115
|
}));
|
|
8868
|
-
__decorateClass$
|
|
9116
|
+
__decorateClass$t([
|
|
8869
9117
|
modernIdoc.property()
|
|
8870
9118
|
], exports.ZoomBlurEffect.prototype, "center", 2);
|
|
8871
|
-
__decorateClass$
|
|
9119
|
+
__decorateClass$t([
|
|
8872
9120
|
modernIdoc.property()
|
|
8873
9121
|
], exports.ZoomBlurEffect.prototype, "innerRadius", 2);
|
|
8874
|
-
__decorateClass$
|
|
9122
|
+
__decorateClass$t([
|
|
8875
9123
|
modernIdoc.property()
|
|
8876
9124
|
], exports.ZoomBlurEffect.prototype, "radius", 2);
|
|
8877
|
-
__decorateClass$
|
|
9125
|
+
__decorateClass$t([
|
|
8878
9126
|
modernIdoc.property()
|
|
8879
9127
|
], exports.ZoomBlurEffect.prototype, "strength", 2);
|
|
8880
|
-
exports.ZoomBlurEffect = __decorateClass$
|
|
9128
|
+
exports.ZoomBlurEffect = __decorateClass$t([
|
|
8881
9129
|
customNode("ZoomBlurEffect")
|
|
8882
9130
|
], exports.ZoomBlurEffect);
|
|
8883
9131
|
|
|
8884
|
-
var __defProp$
|
|
8885
|
-
var __decorateClass$
|
|
9132
|
+
var __defProp$l = Object.defineProperty;
|
|
9133
|
+
var __decorateClass$s = (decorators, target, key, kind) => {
|
|
8886
9134
|
var result = void 0 ;
|
|
8887
9135
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8888
9136
|
if (decorator = decorators[i])
|
|
8889
9137
|
result = (decorator(target, key, result) ) || result;
|
|
8890
|
-
if (result) __defProp$
|
|
9138
|
+
if (result) __defProp$l(target, key, result);
|
|
8891
9139
|
return result;
|
|
8892
9140
|
};
|
|
8893
9141
|
class BaseElement2DFill extends CoreObject {
|
|
@@ -8995,47 +9243,47 @@ class BaseElement2DFill extends CoreObject {
|
|
|
8995
9243
|
});
|
|
8996
9244
|
}
|
|
8997
9245
|
}
|
|
8998
|
-
__decorateClass$
|
|
9246
|
+
__decorateClass$s([
|
|
8999
9247
|
modernIdoc.property({ fallback: true })
|
|
9000
9248
|
], BaseElement2DFill.prototype, "enabled");
|
|
9001
|
-
__decorateClass$
|
|
9249
|
+
__decorateClass$s([
|
|
9002
9250
|
modernIdoc.property()
|
|
9003
9251
|
], BaseElement2DFill.prototype, "color");
|
|
9004
|
-
__decorateClass$
|
|
9252
|
+
__decorateClass$s([
|
|
9005
9253
|
modernIdoc.property()
|
|
9006
9254
|
], BaseElement2DFill.prototype, "image");
|
|
9007
|
-
__decorateClass$
|
|
9255
|
+
__decorateClass$s([
|
|
9008
9256
|
modernIdoc.property()
|
|
9009
9257
|
], BaseElement2DFill.prototype, "linearGradient");
|
|
9010
|
-
__decorateClass$
|
|
9258
|
+
__decorateClass$s([
|
|
9011
9259
|
modernIdoc.property()
|
|
9012
9260
|
], BaseElement2DFill.prototype, "radialGradient");
|
|
9013
|
-
__decorateClass$
|
|
9261
|
+
__decorateClass$s([
|
|
9014
9262
|
modernIdoc.property()
|
|
9015
9263
|
], BaseElement2DFill.prototype, "cropRect");
|
|
9016
|
-
__decorateClass$
|
|
9264
|
+
__decorateClass$s([
|
|
9017
9265
|
modernIdoc.property()
|
|
9018
9266
|
], BaseElement2DFill.prototype, "stretchRect");
|
|
9019
|
-
__decorateClass$
|
|
9267
|
+
__decorateClass$s([
|
|
9020
9268
|
modernIdoc.property()
|
|
9021
9269
|
], BaseElement2DFill.prototype, "dpi");
|
|
9022
|
-
__decorateClass$
|
|
9270
|
+
__decorateClass$s([
|
|
9023
9271
|
modernIdoc.property()
|
|
9024
9272
|
], BaseElement2DFill.prototype, "rotateWithShape");
|
|
9025
|
-
__decorateClass$
|
|
9273
|
+
__decorateClass$s([
|
|
9026
9274
|
modernIdoc.property()
|
|
9027
9275
|
], BaseElement2DFill.prototype, "tile");
|
|
9028
|
-
__decorateClass$
|
|
9276
|
+
__decorateClass$s([
|
|
9029
9277
|
modernIdoc.property()
|
|
9030
9278
|
], BaseElement2DFill.prototype, "opacity");
|
|
9031
9279
|
|
|
9032
|
-
var __defProp$
|
|
9033
|
-
var __decorateClass$
|
|
9280
|
+
var __defProp$k = Object.defineProperty;
|
|
9281
|
+
var __decorateClass$r = (decorators, target, key, kind) => {
|
|
9034
9282
|
var result = void 0 ;
|
|
9035
9283
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9036
9284
|
if (decorator = decorators[i])
|
|
9037
9285
|
result = (decorator(target, key, result) ) || result;
|
|
9038
|
-
if (result) __defProp$
|
|
9286
|
+
if (result) __defProp$k(target, key, result);
|
|
9039
9287
|
return result;
|
|
9040
9288
|
};
|
|
9041
9289
|
class BaseElement2DBackground extends BaseElement2DFill {
|
|
@@ -9045,17 +9293,17 @@ class BaseElement2DBackground extends BaseElement2DFill {
|
|
|
9045
9293
|
);
|
|
9046
9294
|
}
|
|
9047
9295
|
}
|
|
9048
|
-
__decorateClass$
|
|
9296
|
+
__decorateClass$r([
|
|
9049
9297
|
modernIdoc.property()
|
|
9050
9298
|
], BaseElement2DBackground.prototype, "fillWithShape");
|
|
9051
9299
|
|
|
9052
|
-
var __defProp$
|
|
9053
|
-
var __decorateClass$
|
|
9300
|
+
var __defProp$j = Object.defineProperty;
|
|
9301
|
+
var __decorateClass$q = (decorators, target, key, kind) => {
|
|
9054
9302
|
var result = void 0 ;
|
|
9055
9303
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9056
9304
|
if (decorator = decorators[i])
|
|
9057
9305
|
result = (decorator(target, key, result) ) || result;
|
|
9058
|
-
if (result) __defProp$
|
|
9306
|
+
if (result) __defProp$j(target, key, result);
|
|
9059
9307
|
return result;
|
|
9060
9308
|
};
|
|
9061
9309
|
class BaseElement2DForeground extends BaseElement2DFill {
|
|
@@ -9065,17 +9313,17 @@ class BaseElement2DForeground extends BaseElement2DFill {
|
|
|
9065
9313
|
);
|
|
9066
9314
|
}
|
|
9067
9315
|
}
|
|
9068
|
-
__decorateClass$
|
|
9316
|
+
__decorateClass$q([
|
|
9069
9317
|
modernIdoc.property()
|
|
9070
9318
|
], BaseElement2DForeground.prototype, "fillWithShape");
|
|
9071
9319
|
|
|
9072
|
-
var __defProp$
|
|
9073
|
-
var __decorateClass$
|
|
9320
|
+
var __defProp$i = Object.defineProperty;
|
|
9321
|
+
var __decorateClass$p = (decorators, target, key, kind) => {
|
|
9074
9322
|
var result = void 0 ;
|
|
9075
9323
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9076
9324
|
if (decorator = decorators[i])
|
|
9077
9325
|
result = (decorator(target, key, result) ) || result;
|
|
9078
|
-
if (result) __defProp$
|
|
9326
|
+
if (result) __defProp$i(target, key, result);
|
|
9079
9327
|
return result;
|
|
9080
9328
|
};
|
|
9081
9329
|
class BaseElement2DOutline extends BaseElement2DFill {
|
|
@@ -9108,23 +9356,23 @@ class BaseElement2DOutline extends BaseElement2DFill {
|
|
|
9108
9356
|
ctx.stroke({ disableWrapMode });
|
|
9109
9357
|
}
|
|
9110
9358
|
}
|
|
9111
|
-
__decorateClass$
|
|
9359
|
+
__decorateClass$p([
|
|
9112
9360
|
modernIdoc.property({ fallback: "#00000000" })
|
|
9113
9361
|
], BaseElement2DOutline.prototype, "color");
|
|
9114
|
-
__decorateClass$
|
|
9362
|
+
__decorateClass$p([
|
|
9115
9363
|
modernIdoc.property({ fallback: 0 })
|
|
9116
9364
|
], BaseElement2DOutline.prototype, "width");
|
|
9117
|
-
__decorateClass$
|
|
9365
|
+
__decorateClass$p([
|
|
9118
9366
|
modernIdoc.property({ fallback: "solid" })
|
|
9119
9367
|
], BaseElement2DOutline.prototype, "style");
|
|
9120
9368
|
|
|
9121
|
-
var __defProp$
|
|
9122
|
-
var __decorateClass$
|
|
9369
|
+
var __defProp$h = Object.defineProperty;
|
|
9370
|
+
var __decorateClass$o = (decorators, target, key, kind) => {
|
|
9123
9371
|
var result = void 0 ;
|
|
9124
9372
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9125
9373
|
if (decorator = decorators[i])
|
|
9126
9374
|
result = (decorator(target, key, result) ) || result;
|
|
9127
|
-
if (result) __defProp$
|
|
9375
|
+
if (result) __defProp$h(target, key, result);
|
|
9128
9376
|
return result;
|
|
9129
9377
|
};
|
|
9130
9378
|
class BaseElement2DShadow extends CoreObject {
|
|
@@ -9164,29 +9412,29 @@ class BaseElement2DShadow extends CoreObject {
|
|
|
9164
9412
|
}
|
|
9165
9413
|
}
|
|
9166
9414
|
}
|
|
9167
|
-
__decorateClass$
|
|
9415
|
+
__decorateClass$o([
|
|
9168
9416
|
modernIdoc.property({ fallback: true })
|
|
9169
9417
|
], BaseElement2DShadow.prototype, "enabled");
|
|
9170
|
-
__decorateClass$
|
|
9418
|
+
__decorateClass$o([
|
|
9171
9419
|
modernIdoc.property({ fallback: "#000000FF" })
|
|
9172
9420
|
], BaseElement2DShadow.prototype, "color");
|
|
9173
|
-
__decorateClass$
|
|
9421
|
+
__decorateClass$o([
|
|
9174
9422
|
modernIdoc.property({ fallback: 0 })
|
|
9175
9423
|
], BaseElement2DShadow.prototype, "blur");
|
|
9176
|
-
__decorateClass$
|
|
9424
|
+
__decorateClass$o([
|
|
9177
9425
|
modernIdoc.property({ fallback: 0 })
|
|
9178
9426
|
], BaseElement2DShadow.prototype, "offsetY");
|
|
9179
|
-
__decorateClass$
|
|
9427
|
+
__decorateClass$o([
|
|
9180
9428
|
modernIdoc.property({ fallback: 0 })
|
|
9181
9429
|
], BaseElement2DShadow.prototype, "offsetX");
|
|
9182
9430
|
|
|
9183
|
-
var __defProp$
|
|
9184
|
-
var __decorateClass$
|
|
9431
|
+
var __defProp$g = Object.defineProperty;
|
|
9432
|
+
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
9185
9433
|
var result = void 0 ;
|
|
9186
9434
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9187
9435
|
if (decorator = decorators[i])
|
|
9188
9436
|
result = (decorator(target, key, result) ) || result;
|
|
9189
|
-
if (result) __defProp$
|
|
9437
|
+
if (result) __defProp$g(target, key, result);
|
|
9190
9438
|
return result;
|
|
9191
9439
|
};
|
|
9192
9440
|
class BaseElement2DShape extends CoreObject {
|
|
@@ -9261,19 +9509,19 @@ class BaseElement2DShape extends CoreObject {
|
|
|
9261
9509
|
}
|
|
9262
9510
|
}
|
|
9263
9511
|
}
|
|
9264
|
-
__decorateClass$
|
|
9512
|
+
__decorateClass$n([
|
|
9265
9513
|
modernIdoc.property({ fallback: true })
|
|
9266
9514
|
], BaseElement2DShape.prototype, "enabled");
|
|
9267
|
-
__decorateClass$
|
|
9515
|
+
__decorateClass$n([
|
|
9268
9516
|
modernIdoc.property()
|
|
9269
9517
|
], BaseElement2DShape.prototype, "preset");
|
|
9270
|
-
__decorateClass$
|
|
9518
|
+
__decorateClass$n([
|
|
9271
9519
|
modernIdoc.property()
|
|
9272
9520
|
], BaseElement2DShape.prototype, "svg");
|
|
9273
|
-
__decorateClass$
|
|
9521
|
+
__decorateClass$n([
|
|
9274
9522
|
modernIdoc.property()
|
|
9275
9523
|
], BaseElement2DShape.prototype, "viewBox");
|
|
9276
|
-
__decorateClass$
|
|
9524
|
+
__decorateClass$n([
|
|
9277
9525
|
modernIdoc.property()
|
|
9278
9526
|
], BaseElement2DShape.prototype, "paths");
|
|
9279
9527
|
|
|
@@ -9289,13 +9537,13 @@ for (const key in defaultStyles$1) {
|
|
|
9289
9537
|
modernIdoc.defineProperty(BaseElement2DStyle, key, { fallback });
|
|
9290
9538
|
}
|
|
9291
9539
|
|
|
9292
|
-
var __defProp$
|
|
9293
|
-
var __decorateClass$
|
|
9540
|
+
var __defProp$f = Object.defineProperty;
|
|
9541
|
+
var __decorateClass$m = (decorators, target, key, kind) => {
|
|
9294
9542
|
var result = void 0 ;
|
|
9295
9543
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9296
9544
|
if (decorator = decorators[i])
|
|
9297
9545
|
result = (decorator(target, key, result) ) || result;
|
|
9298
|
-
if (result) __defProp$
|
|
9546
|
+
if (result) __defProp$f(target, key, result);
|
|
9299
9547
|
return result;
|
|
9300
9548
|
};
|
|
9301
9549
|
class BaseElement2DText extends CoreObject {
|
|
@@ -9343,180 +9591,60 @@ class BaseElement2DText extends CoreObject {
|
|
|
9343
9591
|
textAlign: "center",
|
|
9344
9592
|
...this.parent.style.toJSON()
|
|
9345
9593
|
};
|
|
9346
|
-
this.base.requestUpdate();
|
|
9347
|
-
}
|
|
9348
|
-
measure() {
|
|
9349
|
-
this._updateText();
|
|
9350
|
-
return this.base.measure();
|
|
9351
|
-
}
|
|
9352
|
-
updateMeasure() {
|
|
9353
|
-
this.measureResult = this.measure();
|
|
9354
|
-
return this;
|
|
9355
|
-
}
|
|
9356
|
-
canDraw() {
|
|
9357
|
-
return Boolean(
|
|
9358
|
-
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
9359
|
-
);
|
|
9360
|
-
}
|
|
9361
|
-
draw() {
|
|
9362
|
-
const ctx = this.parent.context;
|
|
9363
|
-
this.base.update();
|
|
9364
|
-
this.base.pathSets.forEach((pathSet) => {
|
|
9365
|
-
pathSet.paths.forEach((path) => {
|
|
9366
|
-
ctx.addPath(path);
|
|
9367
|
-
ctx.style = { ...path.style };
|
|
9368
|
-
ctx.fillStyle = void 0;
|
|
9369
|
-
ctx.strokeStyle = void 0;
|
|
9370
|
-
ctx.fill();
|
|
9371
|
-
});
|
|
9372
|
-
});
|
|
9373
|
-
}
|
|
9374
|
-
}
|
|
9375
|
-
__decorateClass$o([
|
|
9376
|
-
modernIdoc.property({ fallback: true })
|
|
9377
|
-
], BaseElement2DText.prototype, "enabled");
|
|
9378
|
-
__decorateClass$o([
|
|
9379
|
-
modernIdoc.property({ alias: "base.content", fallback: () => [] })
|
|
9380
|
-
], BaseElement2DText.prototype, "content");
|
|
9381
|
-
__decorateClass$o([
|
|
9382
|
-
modernIdoc.property({ alias: "base.effects" })
|
|
9383
|
-
], BaseElement2DText.prototype, "effects");
|
|
9384
|
-
__decorateClass$o([
|
|
9385
|
-
modernIdoc.property({ alias: "base.fill" })
|
|
9386
|
-
], BaseElement2DText.prototype, "fill");
|
|
9387
|
-
__decorateClass$o([
|
|
9388
|
-
modernIdoc.property({ alias: "base.outline" })
|
|
9389
|
-
], BaseElement2DText.prototype, "outline");
|
|
9390
|
-
__decorateClass$o([
|
|
9391
|
-
modernIdoc.property({ protected: true, alias: "base.measureDom" })
|
|
9392
|
-
], BaseElement2DText.prototype, "measureDom");
|
|
9393
|
-
__decorateClass$o([
|
|
9394
|
-
modernIdoc.property({ protected: true, alias: "base.fonts" })
|
|
9395
|
-
], BaseElement2DText.prototype, "fonts");
|
|
9396
|
-
|
|
9397
|
-
var __defProp$g = Object.defineProperty;
|
|
9398
|
-
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
9399
|
-
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
9400
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
9401
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9402
|
-
if (decorator = decorators[i])
|
|
9403
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9404
|
-
if (kind && result) __defProp$g(target, key, result);
|
|
9405
|
-
return result;
|
|
9406
|
-
};
|
|
9407
|
-
exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
9408
|
-
position = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
9409
|
-
scale = new Vector2(1, 1).on("update", () => this.updateGlobalTransform());
|
|
9410
|
-
skew = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
9411
|
-
transform = new Transform2D();
|
|
9412
|
-
globalPosition = new Vector2();
|
|
9413
|
-
globalScale = new Vector2();
|
|
9414
|
-
globalSkew = new Vector2();
|
|
9415
|
-
globalTransform = new Transform2D();
|
|
9416
|
-
_parentTransformDirtyId;
|
|
9417
|
-
constructor(properties, nodes = []) {
|
|
9418
|
-
super();
|
|
9419
|
-
this.setProperties(properties).append(nodes);
|
|
9420
|
-
}
|
|
9421
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
9422
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
9423
|
-
switch (key) {
|
|
9424
|
-
case "rotation":
|
|
9425
|
-
this.requestRelayout();
|
|
9426
|
-
break;
|
|
9427
|
-
}
|
|
9428
|
-
}
|
|
9429
|
-
getTransformOrigin() {
|
|
9430
|
-
return new Vector2(0, 0);
|
|
9431
|
-
}
|
|
9432
|
-
getTransform(cb) {
|
|
9433
|
-
const origin = this.getTransformOrigin();
|
|
9434
|
-
const transform = new Transform2D();
|
|
9435
|
-
transform.translate(-origin.x, -origin.y).scale(this.scale.x, this.scale.y).skew(this.skew.x, this.skew.y).rotate(this.rotation);
|
|
9436
|
-
cb?.(transform);
|
|
9437
|
-
transform.translate(this.position.x, this.position.y).translate(origin.x, origin.y);
|
|
9438
|
-
return transform;
|
|
9594
|
+
this.base.requestUpdate();
|
|
9439
9595
|
}
|
|
9440
|
-
|
|
9441
|
-
this.
|
|
9596
|
+
measure() {
|
|
9597
|
+
this._updateText();
|
|
9598
|
+
return this.base.measure();
|
|
9442
9599
|
}
|
|
9443
|
-
|
|
9444
|
-
this.
|
|
9445
|
-
|
|
9446
|
-
if (parent?.globalTransform) {
|
|
9447
|
-
this._parentTransformDirtyId = parent.globalTransform.dirtyId;
|
|
9448
|
-
this.globalScale.set(parent.globalScale.x * this.scale.x, parent.globalScale.y * this.scale.y);
|
|
9449
|
-
this.globalRotation = parent.globalRotation + this.rotation;
|
|
9450
|
-
parent.globalTransform.multiply(this.transform, this.globalTransform);
|
|
9451
|
-
} else {
|
|
9452
|
-
this.globalScale.copy(this.scale);
|
|
9453
|
-
this.globalRotation = this.rotation;
|
|
9454
|
-
this.globalTransform.copy(this.transform);
|
|
9455
|
-
}
|
|
9456
|
-
const [
|
|
9457
|
-
a,
|
|
9458
|
-
c,
|
|
9459
|
-
tx,
|
|
9460
|
-
b,
|
|
9461
|
-
d,
|
|
9462
|
-
ty
|
|
9463
|
-
] = this.globalTransform.toArray();
|
|
9464
|
-
this.globalPosition.set(tx, ty);
|
|
9465
|
-
this.globalSkew.x = Math.atan2(c, a) - this.globalRotation;
|
|
9466
|
-
this.globalSkew.y = Math.atan2(b, d) - this.globalRotation;
|
|
9467
|
-
this.requestRelayout();
|
|
9600
|
+
updateMeasure() {
|
|
9601
|
+
this.measureResult = this.measure();
|
|
9602
|
+
return this;
|
|
9468
9603
|
}
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
globalTransform.multiply(
|
|
9474
|
-
typeof vertTransform === "function" ? vertTransform?.() : vertTransform
|
|
9475
|
-
);
|
|
9476
|
-
[a, c, tx, b, d, ty] = globalTransform.toArray();
|
|
9477
|
-
} else {
|
|
9478
|
-
[a, c, tx, b, d, ty] = this.globalTransform.toArray();
|
|
9479
|
-
}
|
|
9480
|
-
const newVertices = vertices.slice();
|
|
9481
|
-
for (let len = vertices.length, i = 0; i < len; i += 2) {
|
|
9482
|
-
const x = vertices[i];
|
|
9483
|
-
const y = vertices[i + 1];
|
|
9484
|
-
newVertices[i] = a * x + c * y + tx;
|
|
9485
|
-
newVertices[i + 1] = b * x + d * y + ty;
|
|
9486
|
-
}
|
|
9487
|
-
return newVertices;
|
|
9604
|
+
canDraw() {
|
|
9605
|
+
return Boolean(
|
|
9606
|
+
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
9607
|
+
);
|
|
9488
9608
|
}
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
this.
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
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
|
+
});
|
|
9497
9620
|
});
|
|
9498
9621
|
}
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
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");
|
|
9516
9644
|
|
|
9517
|
-
var __getOwnPropDesc$
|
|
9518
|
-
var __decorateClass$
|
|
9519
|
-
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;
|
|
9520
9648
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9521
9649
|
if (decorator = decorators[i])
|
|
9522
9650
|
result = (decorator(result)) || result;
|
|
@@ -9740,15 +9868,46 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
9740
9868
|
maxY - minY
|
|
9741
9869
|
);
|
|
9742
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
|
+
// }
|
|
9743
9908
|
_updateOverflow() {
|
|
9744
9909
|
if (this.style.overflow === "hidden") {
|
|
9745
|
-
|
|
9746
|
-
this.mask = {
|
|
9747
|
-
x: rect.x,
|
|
9748
|
-
y: rect.y,
|
|
9749
|
-
width: rect.width,
|
|
9750
|
-
height: rect.height
|
|
9751
|
-
};
|
|
9910
|
+
this.mask = this.getRect().toJSON();
|
|
9752
9911
|
} else {
|
|
9753
9912
|
this.mask = void 0;
|
|
9754
9913
|
}
|
|
@@ -9851,7 +10010,7 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
9851
10010
|
});
|
|
9852
10011
|
}
|
|
9853
10012
|
};
|
|
9854
|
-
exports.BaseElement2D = __decorateClass$
|
|
10013
|
+
exports.BaseElement2D = __decorateClass$l([
|
|
9855
10014
|
customNode("BaseElement2D")
|
|
9856
10015
|
], exports.BaseElement2D);
|
|
9857
10016
|
|
|
@@ -9871,9 +10030,16 @@ for (const key in defaultStyles) {
|
|
|
9871
10030
|
modernIdoc.defineProperty(Element2DStyle, key, { fallback: defaultStyles[key] });
|
|
9872
10031
|
}
|
|
9873
10032
|
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
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;
|
|
9877
10043
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9878
10044
|
if (decorator = decorators[i])
|
|
9879
10045
|
result = (decorator(result)) || result;
|
|
@@ -9924,17 +10090,10 @@ exports.Element2D = class Element2D extends exports.BaseElement2D {
|
|
|
9924
10090
|
}
|
|
9925
10091
|
}
|
|
9926
10092
|
};
|
|
9927
|
-
exports.Element2D = __decorateClass$
|
|
10093
|
+
exports.Element2D = __decorateClass$k([
|
|
9928
10094
|
customNode("Element2D")
|
|
9929
10095
|
], exports.Element2D);
|
|
9930
10096
|
|
|
9931
|
-
class FlexElement2DStyle extends BaseElement2DStyle {
|
|
9932
|
-
constructor(properties) {
|
|
9933
|
-
super();
|
|
9934
|
-
this.setProperties(properties);
|
|
9935
|
-
}
|
|
9936
|
-
}
|
|
9937
|
-
|
|
9938
10097
|
const alignMap = {
|
|
9939
10098
|
"auto": load.Align.Auto,
|
|
9940
10099
|
"flex-start": load.Align.FlexStart,
|
|
@@ -10176,9 +10335,9 @@ class FlexLayout {
|
|
|
10176
10335
|
}
|
|
10177
10336
|
}
|
|
10178
10337
|
|
|
10179
|
-
var __getOwnPropDesc$
|
|
10180
|
-
var __decorateClass$
|
|
10181
|
-
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;
|
|
10182
10341
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10183
10342
|
if (decorator = decorators[i])
|
|
10184
10343
|
result = (decorator(result)) || result;
|
|
@@ -10255,18 +10414,18 @@ exports.FlexElement2D = class FlexElement2D extends exports.BaseElement2D {
|
|
|
10255
10414
|
}
|
|
10256
10415
|
}
|
|
10257
10416
|
};
|
|
10258
|
-
exports.FlexElement2D = __decorateClass$
|
|
10417
|
+
exports.FlexElement2D = __decorateClass$j([
|
|
10259
10418
|
customNode("FlexElement2D")
|
|
10260
10419
|
], exports.FlexElement2D);
|
|
10261
10420
|
|
|
10262
|
-
var __defProp$
|
|
10263
|
-
var __getOwnPropDesc$
|
|
10264
|
-
var __decorateClass$
|
|
10265
|
-
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;
|
|
10266
10425
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10267
10426
|
if (decorator = decorators[i])
|
|
10268
10427
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10269
|
-
if (kind && result) __defProp$
|
|
10428
|
+
if (kind && result) __defProp$e(target, key, result);
|
|
10270
10429
|
return result;
|
|
10271
10430
|
};
|
|
10272
10431
|
exports.Image2D = class Image2D extends exports.Element2D {
|
|
@@ -10402,19 +10561,19 @@ exports.Image2D = class Image2D extends exports.Element2D {
|
|
|
10402
10561
|
});
|
|
10403
10562
|
}
|
|
10404
10563
|
};
|
|
10405
|
-
__decorateClass$
|
|
10564
|
+
__decorateClass$i([
|
|
10406
10565
|
modernIdoc.property({ protected: true })
|
|
10407
10566
|
], exports.Image2D.prototype, "texture", 2);
|
|
10408
|
-
__decorateClass$
|
|
10567
|
+
__decorateClass$i([
|
|
10409
10568
|
modernIdoc.property({ fallback: "" })
|
|
10410
10569
|
], exports.Image2D.prototype, "src", 2);
|
|
10411
|
-
__decorateClass$
|
|
10570
|
+
__decorateClass$i([
|
|
10412
10571
|
modernIdoc.property()
|
|
10413
10572
|
], exports.Image2D.prototype, "srcRect", 2);
|
|
10414
|
-
__decorateClass$
|
|
10573
|
+
__decorateClass$i([
|
|
10415
10574
|
modernIdoc.property({ fallback: false })
|
|
10416
10575
|
], exports.Image2D.prototype, "gif", 2);
|
|
10417
|
-
exports.Image2D = __decorateClass$
|
|
10576
|
+
exports.Image2D = __decorateClass$i([
|
|
10418
10577
|
customNode("Image2D")
|
|
10419
10578
|
], exports.Image2D);
|
|
10420
10579
|
|
|
@@ -10438,14 +10597,14 @@ class TextureRect2D extends exports.Element2D {
|
|
|
10438
10597
|
}
|
|
10439
10598
|
}
|
|
10440
10599
|
|
|
10441
|
-
var __defProp$
|
|
10442
|
-
var __getOwnPropDesc$
|
|
10443
|
-
var __decorateClass$
|
|
10444
|
-
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;
|
|
10445
10604
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10446
10605
|
if (decorator = decorators[i])
|
|
10447
10606
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10448
|
-
if (kind && result) __defProp$
|
|
10607
|
+
if (kind && result) __defProp$d(target, key, result);
|
|
10449
10608
|
return result;
|
|
10450
10609
|
};
|
|
10451
10610
|
exports.Lottie2D = class Lottie2D extends TextureRect2D {
|
|
@@ -10488,189 +10647,13 @@ exports.Lottie2D = class Lottie2D extends TextureRect2D {
|
|
|
10488
10647
|
super._process(delta);
|
|
10489
10648
|
}
|
|
10490
10649
|
};
|
|
10491
|
-
__decorateClass$
|
|
10650
|
+
__decorateClass$h([
|
|
10492
10651
|
modernIdoc.property({ fallback: "" })
|
|
10493
10652
|
], exports.Lottie2D.prototype, "src", 2);
|
|
10494
|
-
exports.Lottie2D = __decorateClass$
|
|
10653
|
+
exports.Lottie2D = __decorateClass$h([
|
|
10495
10654
|
customNode("Lottie2D")
|
|
10496
10655
|
], exports.Lottie2D);
|
|
10497
10656
|
|
|
10498
|
-
var __defProp$d = Object.defineProperty;
|
|
10499
|
-
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
10500
|
-
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
10501
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
10502
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10503
|
-
if (decorator = decorators[i])
|
|
10504
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10505
|
-
if (kind && result) __defProp$d(target, key, result);
|
|
10506
|
-
return result;
|
|
10507
|
-
};
|
|
10508
|
-
const textStyles = new Set(Object.keys(modernText.textDefaultStyle));
|
|
10509
|
-
exports.Text2D = class Text2D extends TextureRect2D {
|
|
10510
|
-
texture = new CanvasTexture();
|
|
10511
|
-
base = new modernText.Text();
|
|
10512
|
-
measureResult;
|
|
10513
|
-
_subTextsCount = 0;
|
|
10514
|
-
constructor(properties, children = []) {
|
|
10515
|
-
super();
|
|
10516
|
-
this.setProperties(properties);
|
|
10517
|
-
this.append(children);
|
|
10518
|
-
if (properties?.plugins) {
|
|
10519
|
-
properties.plugins.forEach((plugin) => {
|
|
10520
|
-
this.base.use(plugin);
|
|
10521
|
-
});
|
|
10522
|
-
}
|
|
10523
|
-
}
|
|
10524
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
10525
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
10526
|
-
switch (key) {
|
|
10527
|
-
case "content":
|
|
10528
|
-
case "effects":
|
|
10529
|
-
case "measureDOM":
|
|
10530
|
-
case "fonts":
|
|
10531
|
-
case "split":
|
|
10532
|
-
this._updateSplit();
|
|
10533
|
-
this.requestRedraw();
|
|
10534
|
-
break;
|
|
10535
|
-
}
|
|
10536
|
-
if (this._subTextsCount && key === "effects") {
|
|
10537
|
-
this._getSubTexts().forEach((child) => {
|
|
10538
|
-
child.setProperties({ [key]: value });
|
|
10539
|
-
});
|
|
10540
|
-
}
|
|
10541
|
-
}
|
|
10542
|
-
_updateBase() {
|
|
10543
|
-
this.base.style = this.style.toJSON();
|
|
10544
|
-
this.emit("updateBase", this.base);
|
|
10545
|
-
this.base.requestUpdate();
|
|
10546
|
-
}
|
|
10547
|
-
_updateStyleProperty(key, value, oldValue) {
|
|
10548
|
-
switch (key) {
|
|
10549
|
-
case "left":
|
|
10550
|
-
case "top":
|
|
10551
|
-
case "width":
|
|
10552
|
-
case "height":
|
|
10553
|
-
this.requestRedraw();
|
|
10554
|
-
break;
|
|
10555
|
-
default:
|
|
10556
|
-
super._updateStyleProperty(key, value, oldValue);
|
|
10557
|
-
break;
|
|
10558
|
-
}
|
|
10559
|
-
switch (key) {
|
|
10560
|
-
case "width":
|
|
10561
|
-
if (this.split) {
|
|
10562
|
-
this._updateSubTexts();
|
|
10563
|
-
}
|
|
10564
|
-
break;
|
|
10565
|
-
}
|
|
10566
|
-
if (typeof key === "string" && textStyles.has(key)) {
|
|
10567
|
-
if (this._subTextsCount && key !== "width" && key !== "height") {
|
|
10568
|
-
this._getSubTexts().forEach((child) => {
|
|
10569
|
-
child.style.setProperties({ [key]: value });
|
|
10570
|
-
});
|
|
10571
|
-
}
|
|
10572
|
-
this.requestRedraw();
|
|
10573
|
-
}
|
|
10574
|
-
}
|
|
10575
|
-
_getSubTexts() {
|
|
10576
|
-
return this.children.front.filter((node) => node instanceof exports.Text2D);
|
|
10577
|
-
}
|
|
10578
|
-
_updateSubTexts() {
|
|
10579
|
-
const subTexts = this._getSubTexts();
|
|
10580
|
-
let i = 0;
|
|
10581
|
-
if (this.split) {
|
|
10582
|
-
this.updateMeasure().measureResult?.paragraphs.forEach((p) => {
|
|
10583
|
-
p.fragments.forEach((f) => {
|
|
10584
|
-
f.characters.forEach((c) => {
|
|
10585
|
-
const child = subTexts[i];
|
|
10586
|
-
if (child) {
|
|
10587
|
-
child.style.left = c.inlineBox.left;
|
|
10588
|
-
child.style.top = c.inlineBox.top;
|
|
10589
|
-
}
|
|
10590
|
-
i++;
|
|
10591
|
-
});
|
|
10592
|
-
});
|
|
10593
|
-
});
|
|
10594
|
-
}
|
|
10595
|
-
}
|
|
10596
|
-
measure() {
|
|
10597
|
-
this._updateBase();
|
|
10598
|
-
return this.base.measure();
|
|
10599
|
-
}
|
|
10600
|
-
updateMeasure() {
|
|
10601
|
-
this.measureResult = this.measure();
|
|
10602
|
-
const { boundingBox } = this.measureResult;
|
|
10603
|
-
const { left, top } = this.style;
|
|
10604
|
-
this.position.x = left + Math.min(0, boundingBox.left);
|
|
10605
|
-
this.position.y = top + Math.min(0, boundingBox.top);
|
|
10606
|
-
this.size.width = boundingBox.width;
|
|
10607
|
-
this.size.height = boundingBox.height;
|
|
10608
|
-
return this;
|
|
10609
|
-
}
|
|
10610
|
-
_updateSplit() {
|
|
10611
|
-
if (this._subTextsCount) {
|
|
10612
|
-
this.children.front.forEach((child) => this.removeChild(child));
|
|
10613
|
-
this._subTextsCount = 0;
|
|
10614
|
-
}
|
|
10615
|
-
if (this.split) {
|
|
10616
|
-
this.measure().paragraphs.forEach((p) => {
|
|
10617
|
-
p.fragments.forEach((f) => {
|
|
10618
|
-
f.characters.forEach((c) => {
|
|
10619
|
-
this.append(
|
|
10620
|
-
new exports.Text2D({
|
|
10621
|
-
internalMode: "front",
|
|
10622
|
-
style: {
|
|
10623
|
-
...c.computedStyle,
|
|
10624
|
-
left: c.inlineBox.x,
|
|
10625
|
-
top: c.inlineBox.y,
|
|
10626
|
-
width: 0,
|
|
10627
|
-
height: 0
|
|
10628
|
-
},
|
|
10629
|
-
content: c.content,
|
|
10630
|
-
effects: this.effects,
|
|
10631
|
-
fonts: this.fonts
|
|
10632
|
-
})
|
|
10633
|
-
);
|
|
10634
|
-
this._subTextsCount++;
|
|
10635
|
-
});
|
|
10636
|
-
});
|
|
10637
|
-
});
|
|
10638
|
-
}
|
|
10639
|
-
}
|
|
10640
|
-
_redraw() {
|
|
10641
|
-
this.updateMeasure();
|
|
10642
|
-
return super._redraw();
|
|
10643
|
-
}
|
|
10644
|
-
_drawContent() {
|
|
10645
|
-
if (!this.split) {
|
|
10646
|
-
this.base.render({
|
|
10647
|
-
pixelRatio: this.texture.pixelRatio,
|
|
10648
|
-
view: this.texture.source
|
|
10649
|
-
});
|
|
10650
|
-
this.texture.requestUpload();
|
|
10651
|
-
super._drawContent();
|
|
10652
|
-
}
|
|
10653
|
-
}
|
|
10654
|
-
};
|
|
10655
|
-
__decorateClass$h([
|
|
10656
|
-
modernIdoc.property({ fallback: false })
|
|
10657
|
-
], exports.Text2D.prototype, "split", 2);
|
|
10658
|
-
__decorateClass$h([
|
|
10659
|
-
modernIdoc.property({ alias: "base.content" })
|
|
10660
|
-
], exports.Text2D.prototype, "content", 2);
|
|
10661
|
-
__decorateClass$h([
|
|
10662
|
-
modernIdoc.property({ alias: "base.effects" })
|
|
10663
|
-
], exports.Text2D.prototype, "effects", 2);
|
|
10664
|
-
__decorateClass$h([
|
|
10665
|
-
modernIdoc.property({ protected: true, alias: "base.measureDOM" })
|
|
10666
|
-
], exports.Text2D.prototype, "measureDOM", 2);
|
|
10667
|
-
__decorateClass$h([
|
|
10668
|
-
modernIdoc.property({ protected: true, alias: "base.fonts" })
|
|
10669
|
-
], exports.Text2D.prototype, "fonts", 2);
|
|
10670
|
-
exports.Text2D = __decorateClass$h([
|
|
10671
|
-
customNode("Text2D")
|
|
10672
|
-
], exports.Text2D);
|
|
10673
|
-
|
|
10674
10657
|
var __defProp$c = Object.defineProperty;
|
|
10675
10658
|
var __decorateClass$g = (decorators, target, key, kind) => {
|
|
10676
10659
|
var result = void 0 ;
|