SHARE
TWEET

Untitled

a guest Jun 27th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public ZoomToCenter(point: ImagingStudyView.Point, deltaX: number, deltaY: number, evObject?: any): void
  2.         {
  3.             var factor = this.getZoomFactor(deltaX, deltaY, evObject);
  4.            
  5.             if (factor === -1)
  6.                 return;
  7.  
  8.             var mousePointTo =
  9.             {
  10.                 x: point.X / this.Context.ScaleX - this.Context.OffsetX / this.Context.ScaleX,
  11.                 y: point.Y / this.Context.ScaleY - this.Context.OffsetY / this.Context.ScaleY
  12.             };
  13.  
  14.             var scaleBy = factor;
  15.             var newScaleX = this.Context.ScaleX * scaleBy;
  16.             var newScaleY = this.Context.ScaleY * scaleBy;
  17.  
  18.             this.Context.ScaleX = newScaleX;
  19.             this.Context.ScaleY = newScaleY;
  20.  
  21.             var newPos =
  22.             {
  23.                 x: -(mousePointTo.x - point.X / newScaleX) * newScaleX,
  24.                 y: -(mousePointTo.y - point.Y / newScaleY) * newScaleY
  25.             };
  26.  
  27.             this.Context.OffsetX = newPos.x;
  28.             this.Context.OffsetY = newPos.y;
  29.  
  30.             this.Context.Renderer.Render();
  31.             this.Context.OverlayRenderer.Render();
  32.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top