protected void cv_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) { ComponentVisualization cv = sender as ComponentVisualization; if (cv == null || e == null) { return; } if (!cv.VisState.HasFlag(NodeVisHighlight.Manipulated)) { return; } if (!cv.IsUserManipulatable) { return; } Point mPos = e.GetPosition(this); Vector offset = mPos - cv.Anchor; cv.Translate(offset); cv.TranslateConnectionsIn(offset); cv.TranslateRefConnections(offset); }
// to use after adding new children to the canvas internal void AdaptSize2Content() { if (this.canvas_expand.X == 0 && this.canvas_expand.Y == 0) { return; } this.Width += this.canvas_expand.X; this.Height += this.canvas_expand.Y; this.canvas_expand = new Vector(0, 0); this.UpdateSizeLabel(); this.UpdateTicks(); if (this.content_offset.X == 0 && this.content_offset.Y == 0) { return; } foreach (ParameterStructure.Component.Component c in this.CompFactory.ComponentRecord) { foreach (object child in this.Children) { ComponentVisualization cv = child as ComponentVisualization; if (cv == null) { continue; } if (cv.VisID == c.ID) { cv.Translate(this.content_offset); cv.TranslateConnectionsIn(this.content_offset); cv.TranslateRefConnections(this.content_offset); } } } this.content_offset = new Vector(0, 0); }