ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Disable click and drag zooming
Posted by Lokesh on Jan-31-2014 14:40
Hi,
    I have a case where the click and drag zooming shouldn't be allowed and only the mouse click zooming should be allowed. I was able to disable the drag zooming functionality by tracking the mouse position and resetting the viewport if there is a change in the mouse position. But, the rectangle is still drawn and that look's a bit odd. Could you suggest me a solution to prevent drawing the rectangle?

Have a good day.

Regards,
Lokesh

  Re: Disable click and drag zooming
Posted by Peter Kwan on Feb-01-2014 05:55
Hi Lokesh,

For your case, your code do not need to set the MouseUsage to ZoomIn or ZoomOut. If the
mouse usage is not set the ZoomIn, the user cannot drag a rectangle with the mouse.

The user can of course click on the mouse. This just triggers the normal mouse click event.
In the mouse click event handler, you can update the view port to zoom in. There is an
example in the "mouse wheel" handling code. In the mouse wheel event handler, each event
causes the chart to zoom in by 1.1x. You can copy the same code but change the zoom in
ratio to 2x for each mouse click event.

Finally, you may want to add mouse cursor feedback. When the user press the "Zoom In"
button, you can change the mouse cursor to a magnifying glass icon so the user knows he
can click to zoom in.

Hope this can help.

Regards
Peter Kwan

  Re: Disable click and drag zooming
Posted by Lokesh on Feb-03-2014 14:47
Hi Peter,
Thank you for the help. That worked.

Regards,
Lokesh