@pixi/display
Advanced tools
Comparing version 7.1.0-alpha to 7.1.0
@@ -20,2 +20,7 @@ declare namespace GlobalMixins | ||
} | ||
interface Settings | ||
{ | ||
SORTABLE_CHILDREN: boolean; | ||
} | ||
} |
import { Rectangle } from '@pixi/core'; | ||
import type { IPointData, Transform, Matrix } from '@pixi/core'; | ||
import type { IPointData, Matrix, Transform } from '@pixi/core'; | ||
/** | ||
@@ -4,0 +4,0 @@ * 'Builder' pattern for bounds rectangles. |
import { DisplayObject } from './DisplayObject'; | ||
import type { Renderer, Rectangle } from '@pixi/core'; | ||
import type { Rectangle, Renderer } from '@pixi/core'; | ||
import type { IDestroyOptions } from './DisplayObject'; | ||
@@ -37,2 +37,16 @@ export interface Container extends GlobalMixins.Container, DisplayObject { | ||
/** | ||
* Sets the default value for the container property `sortableChildren`. | ||
* If set to true, the container will sort its children by zIndex value | ||
* when `updateTransform()` is called, or manually if `sortChildren()` is called. | ||
* | ||
* This actually changes the order of elements in the array, so should be treated | ||
* as a basic solution that is not performant compared to other solutions, | ||
* such as {@link https://github.com/pixijs/layers PixiJS Layers}. | ||
* | ||
* Also be aware of that this may not work nicely with the `addChildAt()` function, | ||
* as the `zIndex` sorting may cause the child to automatically sorted to another position. | ||
* @static | ||
*/ | ||
static defaultSortableChildren: boolean; | ||
/** | ||
* The array of children of this container. | ||
@@ -43,12 +57,12 @@ * @readonly | ||
/** | ||
* If set to true, the container will sort its children by zIndex value | ||
* when updateTransform() is called, or manually if sortChildren() is called. | ||
* If set to true, the container will sort its children by `zIndex` value | ||
* when `updateTransform()` is called, or manually if `sortChildren()` is called. | ||
* | ||
* This actually changes the order of elements in the array, so should be treated | ||
* as a basic solution that is not performant compared to other solutions, | ||
* such as @link https://github.com/pixijs/pixi-display | ||
* such as {@link https://github.com/pixijs/layers PixiJS Layers} | ||
* | ||
* Also be aware of that this may not work nicely with the addChildAt() function, | ||
* as the zIndex sorting may cause the child to automatically sorted to another position. | ||
* @see PIXI.settings.SORTABLE_CHILDREN | ||
* Also be aware of that this may not work nicely with the `addChildAt()` function, | ||
* as the `zIndex` sorting may cause the child to automatically sorted to another position. | ||
* @see PIXI.Container.defaultSortableChildren | ||
*/ | ||
@@ -55,0 +69,0 @@ sortableChildren: boolean; |
@@ -8,2 +8,3 @@ 'use strict'; | ||
const tempMatrix = new core.Matrix(); | ||
function sortChildren(a, b) { | ||
@@ -15,7 +16,7 @@ if (a.zIndex === b.zIndex) { | ||
} | ||
class Container extends DisplayObject.DisplayObject { | ||
const _Container = class extends DisplayObject.DisplayObject { | ||
constructor() { | ||
super(); | ||
this.children = []; | ||
this.sortableChildren = core.settings.SORTABLE_CHILDREN; | ||
this.sortableChildren = _Container.defaultSortableChildren; | ||
this.sortDirty = false; | ||
@@ -228,5 +229,14 @@ } | ||
transform = this.worldTransform; | ||
} else if (this._render !== Container.prototype._render) { | ||
} else if (this._render !== _Container.prototype._render) { | ||
bounds = this.getBounds(true); | ||
} | ||
const projectionTransform = renderer.projection.transform; | ||
if (projectionTransform) { | ||
if (transform) { | ||
transform = tempMatrix.copyFrom(transform); | ||
transform.prepend(projectionTransform); | ||
} else { | ||
transform = projectionTransform; | ||
} | ||
} | ||
if (bounds && sourceFrame.intersects(bounds, transform)) { | ||
@@ -339,3 +349,5 @@ this._render(renderer); | ||
} | ||
} | ||
}; | ||
let Container = _Container; | ||
Container.defaultSortableChildren = false; | ||
Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; | ||
@@ -342,0 +354,0 @@ |
import { Rectangle, Transform, utils } from '@pixi/core'; | ||
import { Bounds } from './Bounds'; | ||
import type { Filter, IPointData, Matrix, MaskData, ObservablePoint, Point, Renderer } from '@pixi/core'; | ||
import type { Filter, IPointData, MaskData, Matrix, ObservablePoint, Point, Renderer } from '@pixi/core'; | ||
import type { Container } from './Container'; | ||
@@ -5,0 +5,0 @@ export interface IDestroyOptions { |
/// <reference path="../global.d.ts" /> | ||
import './settings'; | ||
export * from './Bounds'; | ||
export * from './Container'; | ||
export * from './DisplayObject'; | ||
export * from './Container'; |
@@ -7,4 +7,4 @@ 'use strict'; | ||
var Bounds = require('./Bounds.js'); | ||
var Container = require('./Container.js'); | ||
var DisplayObject = require('./DisplayObject.js'); | ||
var Container = require('./Container.js'); | ||
@@ -14,5 +14,5 @@ | ||
exports.Bounds = Bounds.Bounds; | ||
exports.Container = Container.Container; | ||
exports.DisplayObject = DisplayObject.DisplayObject; | ||
exports.TemporaryDisplayObject = DisplayObject.TemporaryDisplayObject; | ||
exports.Container = Container.Container; | ||
//# sourceMappingURL=index.js.map |
@@ -6,9 +6,20 @@ 'use strict'; | ||
var core = require('@pixi/core'); | ||
var Container = require('./Container.js'); | ||
core.settings.SORTABLE_CHILDREN = false; | ||
Object.defineProperties(core.settings, { | ||
SORTABLE_CHILDREN: { | ||
get() { | ||
return Container.Container.defaultSortableChildren; | ||
}, | ||
set(value) { | ||
core.utils.deprecation("7.1.0", "settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"); | ||
Container.Container.defaultSortableChildren = value; | ||
} | ||
} | ||
}); | ||
Object.defineProperty(exports, 'settings', { | ||
enumerable: true, | ||
get: function () { return core.settings; } | ||
enumerable: true, | ||
get: function () { return core.settings; } | ||
}); | ||
//# sourceMappingURL=settings.js.map |
{ | ||
"name": "@pixi/display", | ||
"version": "7.1.0-alpha", | ||
"version": "7.1.0", | ||
"main": "lib/index.js", | ||
@@ -25,7 +25,7 @@ "module": "lib/index.mjs", | ||
"homepage": "http://pixijs.com/", | ||
"bugs": "https://github.com/pixijs/pixi.js/issues", | ||
"bugs": "https://github.com/pixijs/pixijs/issues", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pixijs/pixi.js.git" | ||
"url": "https://github.com/pixijs/pixijs.git" | ||
}, | ||
@@ -42,3 +42,3 @@ "publishConfig": { | ||
], | ||
"gitHead": "0fb26a500c738cb550da277c112d15d9dd3f87b6" | ||
"gitHead": "4079e92895ecb692afe9f0b15d3e48ee40852ada" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
329222
2761
0