public override void MouseDrag(int x, int y) { switch (this.EditMode) { case Samples.EditMode.Select: { if (this.currentSelectedPath != null) { //find xdiff,ydiff int xdiff = x - this.lastMousePosX; int ydiff = y - this.lastMousePosY; this.lastMousePosX = x; this.lastMousePosY = y; //move currentSelectedPath.MoveBy(xdiff, ydiff); } } break; case Samples.EditMode.Draw: { //find diff Vector newPoint = new Vector(x, y); //find distance currentBrushPath.AddPointAtLast((int)newPoint.X, (int)newPoint.Y); latestMousePoint = new PixelFarm.Drawing.Point(x, y); // // currentBrushPath.MakeSmoothPath(); } break; } }
public override void MouseDrag(int x, int y) { switch (this.EditMode) { case Samples.EditMode.Select: { if (this.currentSelectedPath != null) { //find xdiff,ydiff int xdiff = x - this.lastMousePosX; int ydiff = y - this.lastMousePosY; this.lastMousePosX = x; this.lastMousePosY = y; //move currentSelectedPath.MoveBy(xdiff, ydiff); } } break; case Samples.EditMode.Draw: { //find diff Vector newPoint = new Vector(x, y); //find distance Vector oldPoint = new Vector(latestMousePoint.x, latestMousePoint.y); Vector delta = (newPoint - oldPoint) / 2; // 2,4 etc //midpoint Vector midPoint = (newPoint + oldPoint) / 2; delta = delta.NewLength(5); delta.Rotate(90); Vector newTopPoint = midPoint + delta; Vector newBottomPoint = midPoint - delta; //bottom point currentBrushPath.AddPointAtFirst((int)newBottomPoint.X, (int)newBottomPoint.Y); currentBrushPath.AddPointAtLast((int)newTopPoint.X, (int)newTopPoint.Y); latestMousePoint = new PixelFarm.Drawing.Point(x, y); // // currentBrushPath.MakeSmoothPath(); } break; } }
public override void MouseDown(int x, int y, bool isRightButton) { this.lastMousePosX = x; this.lastMousePosY = y; switch (this.EditMode) { case Samples.EditMode.Select: { //hit test find path object HandleMouseDownOnSelectMode(x, y); } break; case Samples.EditMode.Draw: { latestMousePoint = new PixelFarm.Drawing.Point(x, y); currentBrushPath = new MyBrushPath(); switch (BrushMode) { case SmoothBrushMode.SolidBrush: currentBrushPath.FillColor = Drawing.Color.Black; currentBrushPath.StrokeColor = Drawing.Color.Red; break; case SmoothBrushMode.EraseBrush: currentBrushPath.FillColor = Drawing.Color.White; currentBrushPath.StrokeColor = Drawing.Color.Transparent; break; case SmoothBrushMode.CutBrush: break; } currentBrushPath.BrushMode = this.BrushMode; this.myBrushPathList.Add(currentBrushPath); currentBrushPath.AddPointAtFirst(x, y); } break; } base.MouseDown(x, y, isRightButton); }
RenderElement IParentLink.FindOverlapedChildElementAtPoint(RenderElement afterThisChild, Point point) { //called from child node if (this._MayHasOverlapChild()) { var child_internalLinkedNode = afterThisChild.internalLinkedNode; if (child_internalLinkedNode == null) { return null; } var curnode = child_internalLinkedNode.Previous; while (curnode != null) { var element = curnode.Value; if (element.Contains(point)) { return element; } curnode = curnode.Previous; } } return null; }
void IParentLink.AdjustLocation(ref Point p) { //nothing }
protected override void OnMouseUp(UIMouseEventArgs e) { //create commadn history and add? var newBeginPoint = new Point(this.TargetBox.Left, this.TargetBox.Top); this.DesignBoardModule.HistoryRecordDzElementNewPosition( this.TargetBox, new Point(this.beginRect.Left, this.beginRect.Top), newBeginPoint); this.beginRect = new Rectangle(newBeginPoint.X, newBeginPoint.Y, this.TargetBox.Width, this.TargetBox.Height); base.OnMouseUp(e); }
public HitInfo(RenderElement hitObject, Point point) { this.point = point; this.hitElement = hitObject; }
public bool Contains(Point testPoint) { return ((propFlags & RenderElementConst.HIDDEN) != 0) ? false : ContainPoint(testPoint.X, testPoint.Y); }
public override RenderElement FindUnderlyingSiblingAtPoint(Point point) { if (this.MyParentLink != null) { return this.MyParentLink.FindOverlapedChildElementAtPoint(this, point); } return null; }
RenderElement RenderBoxes.IParentLink.FindOverlapedChildElementAtPoint(RenderElement afterThisChild, Point point) { return null; }
void RenderBoxes.IParentLink.AdjustLocation(ref Point p) { p.Y += this.LineTop; }
public DzSetLocationAction(UIBox box, Point oldPoint, Point newPoint) { this.dzBox = box; this.oldPoint = oldPoint; this.newPoint = newPoint; }