static void SetEventOrigin(UIEventArgs e, HitChain hitChain) { int count = hitChain.Count; if (count > 0) { var hitInfo = hitChain.GetHitInfo(count - 1); e.ExactHitObject = hitInfo.hitElement; } }
public override void ChildrenHitTestCore(HitChain hitChain) { if (this.defaultLayer != null) { defaultLayer.HitTestCore(hitChain); #if DEBUG debug_RecordLayerInfo(defaultLayer); #endif } }
static RenderElement HitTestOnPreviousChain(HitChain hitPointChain, HitChain previousChain, int x, int y) { #if DEBUG if (hitPointChain == previousChain) { throw new NotSupportedException(); } #endif if (previousChain.Count > 0) { previousChain.SetStartTestPoint(x, y); //test on prev chain top to bottom int j = previousChain.Count; for (int i = 0; i < j; ++i) { HitInfo hitInfo = previousChain.GetHitInfo(i); RenderElement elem = hitInfo.hitElement; if (elem != null && elem.VisibleAndHasParent) { if (elem.Contains(hitInfo.point)) { RenderElement found = elem.FindUnderlyingSiblingAtPoint(hitInfo.point); if (found == null) { Point leftTop = elem.Location; hitPointChain.OffsetTestPoint(leftTop.X, leftTop.Y); hitPointChain.AddHitObject(elem); //add to chain } else { break; } } } else { break; } } } //--------------------------------- if (hitPointChain.Count > 0) { var commonElement = hitPointChain.GetHitInfo(hitPointChain.Count - 1).hitElement; hitPointChain.RemoveCurrentHit(); return commonElement; } else { return null; } }
void SwapHitChain(HitChain hitChain) { this._previousChain = hitChain; //temp fix here this._previousChain.ClearAll(); // hitChain.ClearAll(); //if (isDragging && hitChain.Count < 2) //{ //} //hitChain.ClearAll(); //this.hitChainStack.Push(hitChain); }
public override bool HitTestCore(HitChain hitChain) { if ((_layerFlags & IS_LAYER_HIDDEN) == 0) { foreach (RenderElement renderE in this.GetHitTestIter()) { if (renderE.HitTestCore(hitChain)) { return(true); } } } return(false); }
public override bool HitTestCore(HitChain hitChain) { int testX; int testY; hitChain.GetTestPoint(out testX, out testY); GridCell cell = GetGridItemByPosition(testX, testY); if (cell != null && cell.HasContent) { hitChain.OffsetTestPoint(-cell.X, -cell.Y); var renderE = cell.ContentElement as RenderElement; if (renderE != null) { renderE.HitTestCore(hitChain); } hitChain.OffsetTestPoint(cell.X, cell.Y); return true; } return false; }
public abstract bool HitTestCore(HitChain hitChain);
static void ForEachEventListenerBubbleUp(UIEventArgs e, HitChain hitPointChain, EventListenerAction listenerAction) { HitInfo hitInfo; for (int i = hitPointChain.Count - 1; i >= 0; --i) { hitInfo = hitPointChain.GetHitInfo(i); IEventListener listener = hitInfo.hitElement.GetController() as IEventListener; if (listener != null) { if (e.SourceHitElement == null) { e.SourceHitElement = listener; } var hitPoint = hitInfo.point; e.SetLocation(hitPoint.X, hitPoint.Y); e.CurrentContextElement = listener; if (listenerAction(listener)) { return; } } } }
public override bool HitTestCore(HitChain hitChain) { if ((layerFlags & IS_LAYER_HIDDEN) == 0) { foreach (RenderElement renderE in this.GetHitTestIter()) { if (renderE.HitTestCore(hitChain)) { return true; } } } return false; }
//============================================================== //hit test public bool HitTestCore(HitChain hitChain) { if ((propFlags & RenderElementConst.HIDDEN) != 0) { return false; } int testX; int testY; hitChain.GetTestPoint(out testX, out testY); if ((testY >= b_top && testY <= (b_top + b_height) && (testX >= b_left && testX <= (b_left + b_width)))) { if (this.MayHasViewport) { hitChain.OffsetTestPoint( -b_left + this.ViewportX, -b_top + this.ViewportY); } else { hitChain.OffsetTestPoint(-b_left, -b_top); } hitChain.AddHitObject(this); if (this.MayHasChild) { this.ChildrenHitTestCore(hitChain); } if (this.MayHasViewport) { hitChain.OffsetTestPoint( b_left - this.ViewportX, b_top - this.ViewportY); } else { hitChain.OffsetTestPoint(b_left, b_top); } if ((propFlags & RenderElementConst.TRANSPARENT_FOR_ALL_EVENTS) != 0 && hitChain.TopMostElement == this) { hitChain.RemoveCurrentHit(); return false; } else { return true; } } else { return false; } }
public override void ChildrenHitTestCore(HitChain hitChain) { }
public static void UnsafeClear(HitChain hitchain) { hitchain._hitList.Clear(); }
public override bool HitTestCore(HitChain hitChain) { if ((layerFlags & IS_LAYER_HIDDEN) == 0) { if ((layerFlags & FLOWLAYER_HAS_MULTILINE) != 0) { List<EditableTextLine> lines = (List<EditableTextLine>)lineCollection; int j = lines.Count; int testYPos = hitChain.TestPoint.Y; for (int i = 0; i < j; ++i) { EditableTextLine line = lines[i]; if (line.LineBottom < testYPos) { continue; } else if (line.HitTestCore(hitChain)) { return true; } else if (line.LineTop > testYPos) { return false; } } } else { EditableTextLine onlyLine = (EditableTextLine)lineCollection; return onlyLine.HitTestCore(hitChain); } } return false; }
public virtual void ChildrenHitTestCore(HitChain hitChain) { }
static void ForEachOnlyEventPortalBubbleUp(UIEventArgs e, HitChain hitPointChain, EventPortalAction eventPortalAction) { for (int i = hitPointChain.Count - 1; i >= 0; --i) { HitInfo hitPoint = hitPointChain.GetHitInfo(i); object currentHitElement = hitPoint.hitElement.GetController(); IEventPortal eventPortal = currentHitElement as IEventPortal; if (eventPortal != null) { var ppp = hitPoint.point; e.CurrentContextElement = currentHitElement as IEventListener; e.SetLocation(ppp.X, ppp.Y); if (eventPortalAction(eventPortal)) { return; } } } }
void HitTestCoreWithPrevChainHint(HitChain hitPointChain, HitChain previousChain, int x, int y) { //--------------------------------- //test on previous chain first , find common element hitPointChain.ClearAll(); hitPointChain.SetStartTestPoint(x, y); //if (this.dbugId > 0 && isDragging && previousChain.Count > 1) //{ //} //RenderElement commonElement = HitTestOnPreviousChain(hitPointChain, previousChain, x, y); //temp fix //TODO: fix bug on HitTestOnPreviousChain() RenderElement commonElement = this.topRenderElement; ////use root //if (isDragging) //{ // if (commonElement != this.topRenderElement) // { // } //} //if (lastCommonElement != null && commonElement != null && // lastCommonElement != commonElement && isDragging) //{ // Console.WriteLine(commonElement.dbug_GetBoundInfo()); //} //if (commonElement == null) //{ // commonElement = this.topRenderElement; //} //if (commonElement != this.topRenderElement) //{ //} //lastCommonElement = commonElement; commonElement.HitTestCore(hitPointChain); //this.topRenderElement.HitTestCore(hitPointChain); }