|
123 | 123 | } |
124 | 124 | this.__engineData = engine.getOrAddExternalDataWithFactory("__BJSCANVAS2D__", k => new Canvas2DEngineBoundData()); |
125 | 125 | this._cachingStrategy = cachingstrategy; |
126 | | - this._depthLevel = 0; |
127 | | - this._hierarchyMaxDepth = 100; |
128 | | - this._hierarchyLevelZFactor = 1 / this._hierarchyMaxDepth; |
129 | | - this._hierarchyLevelMaxSiblingCount = 1000; |
130 | | - this._hierarchySiblingZDelta = this._hierarchyLevelZFactor / this._hierarchyLevelMaxSiblingCount; |
131 | 126 | this._primPointerInfo = new PrimitivePointerInfo(); |
132 | 127 | this._capturedPointers = new StringDictionary<Prim2DBase>(); |
133 | 128 | this._pickStartingPosition = Vector2.Zero(); |
134 | 129 |
|
135 | 130 | this.setupGroup2D(this, null, name, Vector2.Zero(), size, this._cachingStrategy===Canvas2D.CACHESTRATEGY_ALLGROUPS ? Group2D.GROUPCACHEBEHAVIOR_DONTCACHEOVERRIDE : Group2D.GROUPCACHEBEHAVIOR_FOLLOWCACHESTRATEGY); |
136 | 131 |
|
| 132 | + this._hierarchyLevelMaxSiblingCount = 100; |
| 133 | + this._hierarchyDepthOffset = 0; |
| 134 | + this._siblingDepthOffset = 1 / this._hierarchyLevelMaxSiblingCount; |
137 | 135 | this._scene = scene; |
138 | 136 | this._engine = engine; |
139 | 137 | this._renderingSize = new Size(0, 0); |
|
168 | 166 | this._setupInteraction(enableInteraction); |
169 | 167 | } |
170 | 168 |
|
| 169 | + public get hierarchyLevelMaxSiblingCount(): number { |
| 170 | + return this._hierarchyLevelMaxSiblingCount; |
| 171 | + } |
| 172 | + |
171 | 173 | private _setupInteraction(enable: boolean) { |
172 | 174 | // No change detection |
173 | 175 | if (enable === this._interactionEnabled) { |
|
509 | 511 | ii.findFirstOnly = false; |
510 | 512 | this.intersect(ii); |
511 | 513 |
|
512 | | - if (ii.isIntersected) { |
513 | | - let iprim = ii.topMostIntersectedPrimitive.prim; |
514 | | - if (iprim.actionManager) { |
| 514 | + if (ii.isPrimIntersected(prim) !== null) { |
| 515 | + if (prim.actionManager) { |
515 | 516 | if (this._pickStartingTime !== 0 && ((new Date().getTime() - this._pickStartingTime) > ActionManager.LongPressDelay) && (Math.abs(this._pickStartingPosition.x - ii.pickPosition.x) < ActionManager.DragMovementThreshold && Math.abs(this._pickStartingPosition.y - ii.pickPosition.y) < ActionManager.DragMovementThreshold)) { |
516 | 517 | this._pickStartingTime = 0; |
517 | | - iprim.actionManager.processTrigger(ActionManager.OnLongPressTrigger, ActionEvent.CreateNewFromPrimitive(prim, ppi.primitivePointerPos, eventData)); |
| 518 | + prim.actionManager.processTrigger(ActionManager.OnLongPressTrigger, ActionEvent.CreateNewFromPrimitive(prim, ppi.primitivePointerPos, eventData)); |
518 | 519 | } |
519 | 520 | } |
520 | 521 | } |
|
740 | 741 | } |
741 | 742 | } |
742 | 743 |
|
743 | | - /** |
744 | | - * Read-only property that return the Z delta to apply for each sibling primitives inside of a given one. |
745 | | - * Sibling Primitives are defined in a specific order, the first ones will be draw below the next ones. |
746 | | - * This property define the Z value to apply between each sibling Primitive. Current implementation allows 1000 Siblings Primitives per level. |
747 | | - * @returns The Z Delta |
748 | | - */ |
749 | | - public get hierarchySiblingZDelta(): number { |
750 | | - return this._hierarchySiblingZDelta; |
751 | | - } |
752 | | - |
753 | | - /** |
754 | | - * Return the Z Factor that will be applied for each new hierarchy level. |
755 | | - * @returns The Z Factor |
756 | | - */ |
757 | | - public get hierarchyLevelZFactor(): number { |
758 | | - return this._hierarchyLevelZFactor; |
759 | | - } |
760 | 744 |
|
761 | 745 | private __engineData: Canvas2DEngineBoundData; |
762 | 746 | private _interactionEnabled: boolean; |
|
782 | 766 | private _isScreeSpace: boolean; |
783 | 767 | private _cachedCanvasGroup: Group2D; |
784 | 768 | private _cachingStrategy: number; |
785 | | - private _hierarchyMaxDepth: number; |
786 | | - private _hierarchyLevelZFactor: number; |
787 | 769 | private _hierarchyLevelMaxSiblingCount: number; |
788 | | - private _hierarchySiblingZDelta: number; |
789 | 770 | private _groupCacheMaps: MapTexture[]; |
790 | 771 | private _beforeRenderObserver: Observer<Scene>; |
791 | 772 | private _afterRenderObserver: Observer<Scene>; |
|
0 commit comments