Hi All,
If I follow what you are saying, you have a different CanStart for zooming. You don’t want to ReplaceMouseTool the RubberBanding tool, you want to MouseMoveTools.Add(new CustomZooming(view)).
GoToolRubberBanding will still get in the way, you’ll need a simple GoToolRubberBanding that tests for “Ctrl” key in CanStart() and returns false.
Hi Jake,
Can you post (or email me “godiagram” at this domain) your CustomZooming class?
Hi Jake,
Here is the code:}
Also I have added this custom class using:Do you want regular drag-box selection when there is no CTRL key?
No, I don’t want drag box selection at all. I am using this code for zooming my view.
ok then. GoToolZooming is derived from GoToolRubberbanding. In the DoMouseMove, it clears the selection when the tool is activated.
so, you need to do this:
public class AmeravinZooming:GoToolZooming
{
public AmeravinZooming(GoView v)
: base(v) { }
public override bool CanStart()
{
bool pRetVal = false;
GoInputEventArgs e = this.LastInput;
pRetVal = (e.Buttons == MouseButtons.Left) && e.Control;
return pRetVal;
}
public override void DoMouseMove() {
if (!this.Active) {
if (this.Modal)
return;
else {
//Activate();
this.Active = true;
this.Box = new Rectangle(this.FirstInput.ViewPoint.X, this.FirstInput.ViewPoint.Y, 0, 0);
this.View.Refresh();
}
}
else {
base.DoMouseMove();
}
}
Activate() is a private utility routine within Go (and is where the selection is cleared), I’ve copied the needed bits into DoMouseMove.
OK, for other readers here: If you wanted to continue drag box selection and add zoom with CTRL-drag, then you would do this:
public class AmeravinRubberBanding : GoToolRubberBanding {
public AmeravinRubberBanding(GoView v)
: base(v) { }
public override bool CanStart() {
if (!base.CanStart()) return false;
bool pRetVal = false;
GoInputEventArgs e = this.LastInput;
pRetVal = (e.Buttons == MouseButtons.Left) && e.Control;
return !pRetVal;
}
}
This class duplicates GoToolRubberBanding but doesn’t activate if CTRL is down.
and, to add these two tools to the view, you would:
view.ReplaceMouseTool(typeof(GoToolRubberBanding), new AmeravinRubberBanding(view));
view.MouseMoveTools.Add(new AmeravinZooming(view));
Thanks Jake…Issue is solved now.
Hi,
answered in other thread.