public void MoveDeltaEnd(double dx, double dy, XLine line) { double oldx = _blockHelper.GetX2(line); double oldy = _blockHelper.GetY2(line); _blockHelper.SetX2(line, oldx + dx); _blockHelper.SetY2(line, oldy + dy); }
public void ConnectEnd(XPoint point, XLine line) { Action <XElement, XPoint> update = (element, p) => { _blockHelper.SetX2(element as XLine, p.X); _blockHelper.SetY2(element as XLine, p.Y); }; point.Connected.Add(new Dependency(line, update)); }
private void InvertSelectedLineStart(ISheet contentSheet, IBlock contentBlock, IBlock selectedBlock, SheetOptions options) { // add for horizontal or vertical line start ellipse and shorten line if (_blockController.HaveSelected(selectedBlock) && selectedBlock.Lines != null && selectedBlock.Lines.Count > 0) { foreach (var line in selectedBlock.Lines) { double x1 = _blockHelper.GetX1(line); double y1 = _blockHelper.GetY1(line); double x2 = _blockHelper.GetX2(line); double y2 = _blockHelper.GetY2(line); bool sameX = Math.Round(x1, 1) == Math.Round(x2, 1); bool sameY = Math.Round(y1, 1) == Math.Round(y2, 1); // vertical line if (sameX && !sameY) { // X1, Y1 is start position if (y1 < y2) { AddInvertedLineEllipse(contentSheet, contentBlock, selectedBlock, options, x1 - invertedEllipseWidth / 2.0, y1, invertedEllipseWidth, invertedEllipseHeight); _blockHelper.SetY1(line, y1 + invertedEllipseHeight); } // X2, Y2 is start position else { AddInvertedLineEllipse(contentSheet, contentBlock, selectedBlock, options, x2 - invertedEllipseWidth / 2.0, y2, invertedEllipseWidth, invertedEllipseHeight); _blockHelper.SetY2(line, y2 + invertedEllipseHeight); } } // horizontal line else if (!sameX && sameY) { // X1, Y1 is start position if (x1 < x2) { AddInvertedLineEllipse(contentSheet, contentBlock, selectedBlock, options, x1, y1 - invertedEllipseHeight / 2.0, invertedEllipseWidth, invertedEllipseHeight); _blockHelper.SetX1(line, x1 + invertedEllipseWidth); } // X2, Y2 is start position else { AddInvertedLineEllipse(contentSheet, contentBlock, selectedBlock, options, x2, y2 - invertedEllipseHeight / 2.0, invertedEllipseWidth, invertedEllipseHeight); _blockHelper.SetX2(line, x2 + invertedEllipseWidth); } } } } }
public void Move(ImmutablePoint p) { double x = _itemController.Snap(p.X, _state.Options.SnapSize); double y = _itemController.Snap(p.Y, _state.Options.SnapSize); double x2 = _blockHelper.GetX2(TempLine); double y2 = _blockHelper.GetY2(TempLine); if (Math.Round(x, 1) != Math.Round(x2, 1) || Math.Round(y, 1) != Math.Round(y2, 1)) { _blockHelper.SetX2(TempLine, x); _blockHelper.SetY2(TempLine, y); _blockHelper.SetLeft(TempEndEllipse, x - 4.0); _blockHelper.SetTop(TempEndEllipse, y - 4.0); } }