public void MoveDeltaStart(double dx, double dy, XLine line) { double oldx = _blockHelper.GetX1(line); double oldy = _blockHelper.GetY1(line); _blockHelper.SetX1(line, oldx + dx); _blockHelper.SetY1(line, oldy + dy); }
public void ConnectStart(XPoint point, XLine line) { Action <XElement, XPoint> update = (element, p) => { _blockHelper.SetX1(element as XLine, p.X); _blockHelper.SetY1(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); } } } } }