Q&A - Question

Problem with zoom in and zoom out speed in TGIS_ViewerWnd

Question
Bahodir asked on February 07, 2020, keyword: Developer Kernel
I have 3 types of shp files: line, points and polygon and there are several of them in TGIS_ViewerWnd.

When I zoom in or zoom out with the mouse TGIS_ViewerWnd works slowly.

For example, if I immediately zoom in or zoom out it slows down.

This my codes

it is for zoom in

void __fastcall TForm1::GISMouseWheelUp(TObject *Sender, TShiftState Shift, TPoint &MousePos,
          bool &Handled)
{   // zoom +
GIS->Lock();
    GIS->Zoom = GIS->Zoom * 1.2 ;
GIS->Unlock();
}


and it is for zoom out

void __fastcall TForm1::GISMouseWheelDown(TObject *Sender, TShiftState Shift, TPoint &MousePos,
          bool &Handled)
{ // zoom -
GIS->Lock();
    GIS->Zoom = GIS->Zoom / 1.2 ;
GIS->Unlock();
}

Now my question is what can I do so that when I zoom in or zoom out the scale it does not slow down?
Answers
Artur Redzko (TatukGIS) replied February 07, 2020
There is a sample Zooming that demonstrates how to use mouse wheel events :
void __fastcall TForm1::GISMouseWheelDown(TObject *Sender,
      TShiftState Shift, TPoint &MousePos, bool &Handled)
{
  TPoint  pt;

  if ( GIS->IsEmpty ) return ;

  pt = GIS->ScreenToClient( MousePos ) ;

  GIS->ZoomBy( 5./4., pt.x, pt.y );
  Handled = true ;
}

void __fastcall TForm1::GISMouseWheelUp(TObject *Sender, TShiftState Shift,
      TPoint &MousePos, bool &Handled)
{
  TPoint  pt;

  if ( GIS->IsEmpty ) return ;

  pt = GIS->ScreenToClient( MousePos ) ;

  GIS->ZoomBy( 4./5., pt.x, pt.y );
  Handled = true ;
}
if you want to speed up a viewer reaction on mouse events, disable UseAnimations and decrease DelayedUpdate value in properties of a map component.
If you would like to answer the question please Sign In.
*
*
Please review our recent Privacy Policy.
If you have any questions or requests, please contact us.
Rules
The Questions and Answers (Q & A) is intended to provide a means of communication between TatukGIS customers.
 
  1. Licensed users (with active maintenance play) of TatukGIS products may contribute to the Q & A content. Read-only access is available to anyone.
  2. Keep the content positive and professional.
  3. Be courteous to others by posting information when a question or issue asked on the Q & A is answered or resolved by other means (such as with help from TatukGIS technical support). Offer others at least a hint how the posted question was answered or the issue was resolved.
  4. The Q & A is not a replacement for TatukGIS technical support. TatukGIS team may or may not regularly follow or contribute content.