@awayjs/scene 0.13.250 → 0.13.252
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/bundle/awayjs-scene.umd.js +41 -31
- package/bundle/awayjs-scene.umd.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/base/Timeline.js +1 -1
- package/dist/lib/display/DisplayObject.d.ts +1 -0
- package/dist/lib/display/DisplayObject.d.ts.map +1 -1
- package/dist/lib/display/DisplayObject.js +36 -25
- package/dist/lib/display/DisplayObjectContainer.d.ts.map +1 -1
- package/dist/lib/display/MorphSprite.d.ts.map +1 -1
- package/dist/lib/display/MovieClip.d.ts.map +1 -1
- package/dist/lib/display/Sprite.d.ts.map +1 -1
- package/dist/lib/display/TextField.d.ts.map +1 -1
- package/dist/lib/display/TextField.js +3 -4
- package/index.ts +1 -1
- package/lib/base/Timeline.ts +1 -1
- package/lib/display/DisplayObject.ts +43 -26
- package/lib/display/DisplayObjectContainer.ts +1 -1
- package/lib/display/MorphSprite.ts +1 -3
- package/lib/display/MovieClip.ts +0 -1
- package/lib/display/Sprite.ts +2 -2
- package/lib/display/TextField.ts +5 -6
- package/package.json +1 -1
|
@@ -2359,30 +2359,41 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
2359
2359
|
configurable: true
|
|
2360
2360
|
});
|
|
2361
2361
|
DisplayObject.prototype._mergeMasks = function (timeline, script) {
|
|
2362
|
-
if (!timeline && !script)
|
|
2363
|
-
return
|
|
2364
|
-
}
|
|
2362
|
+
if (!timeline && !script)
|
|
2363
|
+
return;
|
|
2365
2364
|
// we can not have mask array, create it
|
|
2366
|
-
if (!timeline && script)
|
|
2367
|
-
script.maskMode = true;
|
|
2365
|
+
if (!timeline && script)
|
|
2368
2366
|
return [script];
|
|
2369
|
-
}
|
|
2370
2367
|
// and make sure that we not have same script mask in it
|
|
2371
|
-
if (script && !timeline.includes(script))
|
|
2368
|
+
if (script && !timeline.includes(script))
|
|
2372
2369
|
timeline.push(script);
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2370
|
+
return timeline;
|
|
2371
|
+
};
|
|
2372
|
+
DisplayObject.prototype._setMasks = function (masks) {
|
|
2373
|
+
var oldMasks = this._masks ? this._masks : [];
|
|
2374
|
+
if (masks) {
|
|
2375
|
+
// and make sure that mask mode enabled if not already
|
|
2376
|
+
for (var i = masks.length - 1; i >= 0; i--) {
|
|
2377
|
+
var mask = masks[i];
|
|
2378
|
+
if (!mask) {
|
|
2379
|
+
console.warn('[DisplayObject] Timeline mask has null value, skipping it');
|
|
2380
|
+
masks.splice(i, 1);
|
|
2381
|
+
}
|
|
2382
|
+
else {
|
|
2383
|
+
var index = oldMasks.indexOf(mask);
|
|
2384
|
+
if (index != -1) {
|
|
2385
|
+
oldMasks.splice(index, 1);
|
|
2386
|
+
}
|
|
2387
|
+
else {
|
|
2388
|
+
mask.maskMode = true;
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2383
2391
|
}
|
|
2384
2392
|
}
|
|
2385
|
-
|
|
2393
|
+
//set mask mode to false for old masks
|
|
2394
|
+
for (var i = oldMasks.length - 1; i >= 0; i--)
|
|
2395
|
+
oldMasks[i].maskMode = false;
|
|
2396
|
+
this._masks = masks;
|
|
2386
2397
|
};
|
|
2387
2398
|
Object.defineProperty(DisplayObject.prototype, "scriptMask", {
|
|
2388
2399
|
get: function () {
|
|
@@ -2405,6 +2416,8 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
2405
2416
|
}
|
|
2406
2417
|
this._scriptMask = mask;
|
|
2407
2418
|
this._masks = this._mergeMasks(this._masks, mask);
|
|
2419
|
+
if (mask)
|
|
2420
|
+
mask.maskMode = true;
|
|
2408
2421
|
this._invalidateHierarchicalProperty(_awayjs_view.HierarchicalProperty.MASKS);
|
|
2409
2422
|
},
|
|
2410
2423
|
enumerable: true,
|
|
@@ -2416,7 +2429,7 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
2416
2429
|
* @param masks Masks from timeline
|
|
2417
2430
|
*/
|
|
2418
2431
|
DisplayObject.prototype.updateTimelineMask = function (masks) {
|
|
2419
|
-
this.
|
|
2432
|
+
this._setMasks(this._mergeMasks(masks, this._scriptMask));
|
|
2420
2433
|
this._invalidateHierarchicalProperty(_awayjs_view.HierarchicalProperty.MASKS);
|
|
2421
2434
|
};
|
|
2422
2435
|
Object.defineProperty(DisplayObject.prototype, "masks", {
|
|
@@ -2430,7 +2443,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
2430
2443
|
set: function (value) {
|
|
2431
2444
|
if (this._masks == value)
|
|
2432
2445
|
return;
|
|
2433
|
-
this._masks = value;
|
|
2434
2446
|
// this is edge case, if we set masks direct,
|
|
2435
2447
|
// this means that we should reset _scriptMask when it not present in input mask
|
|
2436
2448
|
if (!value || !value.length) {
|
|
@@ -2439,14 +2451,13 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
2439
2451
|
else {
|
|
2440
2452
|
var len = value.length;
|
|
2441
2453
|
var hasScriptMask = false;
|
|
2442
|
-
for (var i = 0; i < len; i++)
|
|
2443
|
-
value[i].maskMode = true;
|
|
2454
|
+
for (var i = 0; i < len; i++)
|
|
2444
2455
|
hasScriptMask = hasScriptMask || (value[i] === this._scriptMask);
|
|
2445
|
-
|
|
2446
|
-
if (this._scriptMask && !hasScriptMask)
|
|
2456
|
+
//if we had a script mask set but it wasn't present in the new masks value, remove it
|
|
2457
|
+
if (this._scriptMask && !hasScriptMask)
|
|
2447
2458
|
this._scriptMask = null;
|
|
2448
|
-
}
|
|
2449
2459
|
}
|
|
2460
|
+
this._setMasks(value);
|
|
2450
2461
|
this._invalidateHierarchicalProperty(_awayjs_view.HierarchicalProperty.MASKS);
|
|
2451
2462
|
},
|
|
2452
2463
|
enumerable: true,
|
|
@@ -4097,7 +4108,7 @@ var Timeline = /** @class */ (function () {
|
|
|
4097
4108
|
child.maskMode = true;
|
|
4098
4109
|
};
|
|
4099
4110
|
Timeline.remove_masks = function (_timeline, child, _target_mc, _i) {
|
|
4100
|
-
child.
|
|
4111
|
+
child.updateTimelineMask(null);
|
|
4101
4112
|
};
|
|
4102
4113
|
Timeline.update_filters = function (timeline, child, _target_mc, i) {
|
|
4103
4114
|
var startFilter = timeline.properties_stream_int[i++];
|
|
@@ -11355,18 +11366,17 @@ var TextField = /** @class */ (function (_super) {
|
|
|
11355
11366
|
this.maskChild.graphics.endFill();
|
|
11356
11367
|
this.addChild(this.maskChild);
|
|
11357
11368
|
this.addChild(this.textChild);
|
|
11358
|
-
this.maskChild.
|
|
11359
|
-
//this.textChild.masks = [this.maskChild];
|
|
11369
|
+
this.maskChild.visible = false;
|
|
11360
11370
|
this._graphics.clear();
|
|
11361
11371
|
this.targetGraphics = this.textChild.graphics;
|
|
11362
11372
|
return;
|
|
11363
11373
|
}
|
|
11364
11374
|
// only use masking if needed:
|
|
11365
11375
|
if (this._textWidth > this._width || this._textHeight > this._height) {
|
|
11366
|
-
this.textChild.
|
|
11376
|
+
this.textChild.scriptMask = this.maskChild;
|
|
11367
11377
|
}
|
|
11368
11378
|
else {
|
|
11369
|
-
this.textChild.
|
|
11379
|
+
this.textChild.scriptMask = null;
|
|
11370
11380
|
}
|
|
11371
11381
|
return;
|
|
11372
11382
|
};
|
|
@@ -18174,7 +18184,7 @@ var Scene = /** @class */ (function () {
|
|
|
18174
18184
|
_awayjs_graphics.MaterialManager.materialClass = _awayjs_materials.MethodMaterial;
|
|
18175
18185
|
_awayjs_graphics.MaterialManager.textureClass = _awayjs_renderer.ImageTexture2D;
|
|
18176
18186
|
|
|
18177
|
-
console.debug('AwayJS - Scene - 0.13.
|
|
18187
|
+
console.debug('AwayJS - Scene - 0.13.252');
|
|
18178
18188
|
|
|
18179
18189
|
exports.Timeline = Timeline;
|
|
18180
18190
|
exports.ControllerBase = ControllerBase;
|