Thanks for you reply. Yes, I tried and can implement what I want. But the point is I am not sure this is a best way and it is stable enough. Base on some questions that asked you, I know that if user select several shapes and try to move it, then I only can customize my InteractionState object in OnMouseMove method of ModifyBehavior. So far there are three choices:
1. Without calling base.OnMouseMove and create my InteractionState object: protected override void OnMouseMove(Point mousePosition) { InteractionState state = this.Diagram.Interaction; PointF pointDoc = this.DiagramView.ClientToDoc(mousePosition); if (IsReadyToMoveMultiShapes(pointDoc, state) == true) { this.Diagram.Interaction = new InteractionState(this.trackerShape, 8, MindFusion.Diagramming.Action.Modify); this.Diagram.Interaction.MouseMoved = true; this.Diagram.Interaction.Start(pointDoc, this.Diagram); }
... // other code here } But this way cause a exception is thrown
2. Calling base.OnMouseMove and create my InteractionState object: protected override void OnMouseMove(Point mousePosition) { InteractionState state = this.Diagram.Interaction; PointF pointDoc = this.DiagramView.ClientToDoc(mousePosition);
if (IsReadyToMoveMultiShapes(pointDoc, state) == true) { base.OnMouseMove(mousePosition);
this.Diagram.Interaction = new InteractionState(this.trackerShape, 8, MindFusion.Diagramming.Action.Modify); this.Diagram.Interaction.MouseMoved = true; this.Diagram.Interaction.Start(pointDoc, this.Diagram); } ... // other code here } This way can work but when user is moving shape there are some problems, I fix all expcept one. The left problem is when user is moving trackerShape, trackerShape covers these links that connect to selected shapes. So I choose third way
3. Without calling base.OnMouseMove, create my InteractionState object and move trackerShape by myself: protected override void OnMouseMove(Point mousePosition) { InteractionState state = this.Diagram.Interaction; PointF pointDoc = this.DiagramView.ClientToDoc(mousePosition);
if (IsReadyToMoveMultiShapes(pointDoc, state) == true) { this.Diagram.Interaction = new InteractionState(this.trackerShape, 8, MindFusion.Diagramming.Action.Modify); this.Diagram.Interaction.MouseMoved = true; this.Diagram.Interaction.Start(pointDoc, this.Diagram); } else if (state != null && (state.CurrentItem is TrackerNode) == true && state.Action == MindFusion.Diagramming.Action.Modify) { TrackerNode item = (TrackerNode)state.CurrentItem;
rect.X = pointDoc.X - state.StartPoint.X + item.OriginX; rect.Y = pointDoc.Y - state.StartPoint.Y + item.OriginY; item.Move(rect.X, rect.Y); }
... // other code here } This is the way I choose and looks can work well so far. But compare with your code, your code is simple, I like it.
So could you give me a better way that is simpler and stabler to do same thing ? We will buy new version maybe include source code sooner or later. Because of: 1. This is a good production 2. we will not choose other production and spend extra time to learn new SDK.
So do not worry we are stable customers. Thanks a lot.
|