internal bool HitTestCore(HitChain hitChain) { int testX; int testY; hitChain.GetTestPoint(out testX, out testY); if (this.RunCount == 0) { return(false); } else { LinkedListNode <EditableRun> cnode = this.First; int curLineTop = this.lineTop; hitChain.OffsetTestPoint(0, -curLineTop); while (cnode != null) { if (cnode.Value.HitTestCore(hitChain)) { hitChain.OffsetTestPoint(0, curLineTop); return(true); } cnode = cnode.Next; } hitChain.OffsetTestPoint(0, curLineTop); 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 bool HitTestCore(HitChain hitChain) { hitChain.GetTestPoint(out int testX, out int testY); GridCell cell = GetCellByPosition(testX, testY); if (cell != null && cell.ContentElement is RenderElement renderE) { hitChain.OffsetTestPoint(-cell.X, -cell.Y); renderE.HitTestCore(hitChain); hitChain.OffsetTestPoint(cell.X, cell.Y); return(true); } return(false); }
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); } }
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 bool HitTestCore(HitChain hitChain) { if (LineTop <= hitChain.TestPointY && (LineTop + LineHeight) > hitChain.TestPointY) { LinkedListNode <RenderElement> node = _linkList.First; hitChain.OffsetTestPoint(0, -LineTop); bool found = false; while (node != null) { if (node.Value.HitTestCore(hitChain)) { found = true; break; } node = node.Next; } hitChain.OffsetTestPoint(0, LineTop); return(found); } 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 { //not visual hit on this object.. if (this.needClipArea) { return(false); } //--- //if this RenderElement not need clip area //we should test on its child int preTestCount = hitChain.Count; if (this.MayHasViewport) { hitChain.OffsetTestPoint( -b_left + this.ViewportX, -b_top + this.ViewportY); } else { hitChain.OffsetTestPoint(-b_left, -b_top); } 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); } return(hitChain.Count > preTestCount); } }