@leafer/display
Advanced tools
+9
-9
| { | ||
| "name": "@leafer/display", | ||
| "version": "1.0.0-beta.4", | ||
| "version": "1.0.0-beta.5", | ||
| "description": "@leafer/display", | ||
@@ -22,13 +22,13 @@ "author": "Chao (Leafer) Wan", | ||
| "dependencies": { | ||
| "@leafer/math": "1.0.0-beta.4", | ||
| "@leafer/data": "1.0.0-beta.4", | ||
| "@leafer/layout": "1.0.0-beta.4", | ||
| "@leafer/display-module": "1.0.0-beta.4", | ||
| "@leafer/event": "1.0.0-beta.4", | ||
| "@leafer/decorator": "1.0.0-beta.4", | ||
| "@leafer/helper": "1.0.0-beta.4" | ||
| "@leafer/math": "1.0.0-beta.5", | ||
| "@leafer/data": "1.0.0-beta.5", | ||
| "@leafer/layout": "1.0.0-beta.5", | ||
| "@leafer/display-module": "1.0.0-beta.5", | ||
| "@leafer/event": "1.0.0-beta.5", | ||
| "@leafer/decorator": "1.0.0-beta.5", | ||
| "@leafer/helper": "1.0.0-beta.5" | ||
| }, | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.0.0-beta.4" | ||
| "@leafer/interface": "1.0.0-beta.5" | ||
| } | ||
| } |
+4
-64
@@ -1,2 +0,2 @@ | ||
| import { ILeaf, ILeaferCanvas, IRenderOptions } from '@leafer/interface' | ||
| import { ILeaf } from '@leafer/interface' | ||
| import { ChildEvent } from '@leafer/event' | ||
@@ -6,3 +6,3 @@ import { BoundsHelper } from '@leafer/math' | ||
| import { useModule } from '@leafer/decorator' | ||
| import { LeafMask } from '@leafer/display-module' | ||
| import { BranchRender, LeafMask } from '@leafer/display-module' | ||
@@ -16,2 +16,4 @@ import { Leaf } from './Leaf' | ||
| @useModule(BranchRender) | ||
| @useModule(LeafMask) | ||
@@ -56,11 +58,3 @@ export class Branch extends Leaf { | ||
| public __updateChange(): void { | ||
| const { __layout: layout } = this | ||
| if (layout.childrenSortChanged) { | ||
| this.__updateSortChildren() | ||
| layout.childrenSortChanged = false | ||
| } | ||
| } | ||
| // own | ||
@@ -78,56 +72,2 @@ | ||
| public __render(canvas: ILeaferCanvas, options: IRenderOptions): void { | ||
| if (this.__worldOpacity) { | ||
| let child: ILeaf | ||
| const { children } = this | ||
| if (this.__hasMask && children.length > 1) { | ||
| let mask: boolean | ||
| let maskCanvas = canvas.getSameCanvas() | ||
| let contentCanvas = canvas.getSameCanvas() | ||
| for (let i = 0, len = children.length; i < len; i++) { | ||
| child = children[i] | ||
| if (child.isMask) { | ||
| if (mask) { | ||
| this.__renderMask(canvas, contentCanvas, maskCanvas) | ||
| maskCanvas.clear() | ||
| contentCanvas.clear() | ||
| } else { | ||
| mask = true | ||
| } | ||
| child.__render(maskCanvas, options) | ||
| continue | ||
| } | ||
| child.__render(contentCanvas, options) | ||
| } | ||
| this.__renderMask(canvas, contentCanvas, maskCanvas) | ||
| maskCanvas.recycle() | ||
| contentCanvas.recycle() | ||
| } else { | ||
| const { bounds, hideBounds } = options | ||
| for (let i = 0, len = children.length; i < len; i++) { | ||
| child = children[i] | ||
| if (bounds && !bounds.hit(child.__world, options.matrix)) continue | ||
| if (hideBounds && hideBounds.includes(child.__world, options.matrix)) continue | ||
| child.__render(canvas, options) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| public add(child: ILeaf, index?: number): void { | ||
@@ -134,0 +74,0 @@ |
+26
-5
@@ -7,3 +7,3 @@ import { ILeafer, ILeaf, ILeafInputData, ILeafData, ILeaferCanvas, IRenderOptions, IMatrixWithBoundsData, __Number, __Boolean, __Value, ILeafLayout, InnerId, IHitCanvas, IRadiusPointData, IEventListenerMap, IEventListener, IEventListenerOptions, IEventListenerId, IEvent, IObject, IFunction, __String, IPointData, IMatrixDecompositionAttr, ILayoutBoundsType, ILayoutLocationType, IBoundsData, IMatrixData } from '@leafer/interface' | ||
| import { useModule } from '@leafer/decorator' | ||
| import { WaitHelper } from '@leafer/helper' | ||
| import { LeafHelper, WaitHelper } from '@leafer/helper' | ||
@@ -62,6 +62,7 @@ | ||
| public __hasMask?: boolean | ||
| public __hasEraser?: boolean | ||
| public __hitCanvas?: IHitCanvas | ||
| public get __onlyHitMask(): boolean { return this.__hasMask && !this.__.hitChildren } | ||
| public get __ignoreHitWorld(): boolean { return this.__hasMask && this.__.hitChildren } | ||
| public get __ignoreHitWorld(): boolean { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren } | ||
@@ -95,7 +96,7 @@ // event | ||
| public waitParent(item: IFunction): void { | ||
| this.__parentWait ? this.__parentWait.push(item) : this.__parentWait = [item] | ||
| this.parent ? item() : (this.__parentWait ? this.__parentWait.push(item) : this.__parentWait = [item]) | ||
| } | ||
| public waitLeafer(item: IFunction): void { | ||
| this.__leaferWait ? this.__leaferWait.push(item) : this.__leaferWait = [item] | ||
| this.leafer ? item() : (this.__leaferWait ? this.__leaferWait.push(item) : this.__leaferWait = [item]) | ||
| } | ||
@@ -180,4 +181,6 @@ | ||
| public __updateMask(): void { } | ||
| public __updateEraser(_value?: boolean): void { } | ||
| public __updateMask(_value?: boolean): void { } | ||
| public __renderMask(_canvas: ILeaferCanvas, _content: ILeaferCanvas, _mask: ILeaferCanvas): void { } | ||
@@ -226,2 +229,20 @@ | ||
| // transform | ||
| public move(x: number, y?: number): void { | ||
| LeafHelper.moveLocal(this, x, y) | ||
| } | ||
| public scaleOf(origin: IPointData, x: number, y?: number): void { | ||
| this.__layout.checkUpdate() | ||
| if (y === undefined) y = x | ||
| LeafHelper.zoomOfLocal(this, PointHelper.tempToOuterOf(origin, this.__local), x, y) | ||
| } | ||
| public rotateOf(origin: IPointData, angle: number): void { | ||
| this.__layout.checkUpdate() | ||
| LeafHelper.rotateOfLocal(this, PointHelper.tempToOuterOf(origin, this.__local), angle) | ||
| } | ||
| // LeafHit rewrite | ||
@@ -228,0 +249,0 @@ |
16322
-6.57%312
-8.24%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated