class_docstr: Camera implementing 2D pan/zoom mouse interaction.
  
  For this camera, the ``scale_factor`` indicates the zoom level, and
  the ``center`` indicates the center position of the view.
  
  By default, this camera inverts the y axis of the scene. This usually
  results in the scene +y axis pointing upward because widgets (including
  ViewBox) have their +y axis pointing downward.
  
  Parameters
  ----------
  rect : Rect
      A Rect object or 4-element tuple that specifies the rectangular
      area to show.
  aspect : float | None
      The aspect ratio (i.e. scaling) between x and y dimension of
      the scene. E.g. to show a square image as square, the aspect
      should be 1. If None (default) the x and y dimensions are scaled
      independently.
  **kwargs : dict
      Keyword arguments to pass to `BaseCamera`.
  
  Notes
  -----
  Interaction:
  
      * LMB: pan the view
      * RMB or scroll: zooms the view
class_docstr_tok: ["Camera","implementing","2D","pan\/zoom","mouse","interaction",".","For","this","camera",",","the","``","scale_factor","``","indicates","the","zoom","level",",","and","the","``","center","``","indicates","the","center","position","of","the","view",".","By","default",",","this","camera","inverts","the","y","axis","of","the","scene",".","This","usually","results","in","the","scene","+y","axis","pointing","upward","because","widgets","(","including","ViewBox",")","have","their","+y","axis","pointing","downward",".","Parameters","--","--","--","--","--","rect",":","Rect","A","Rect","object","or","4-element","tuple","that","specifies","the","rectangular","area","to","show",".","aspect",":","float","|","None","The","aspect","ratio","(","i.e",".","scaling",")","between","x","and","y","dimension","of","the","scene",".","E.g",".","to","show","a","square","image","as","square",",","the","aspect","should","be","1",".","If","None","(","default",")","the","x","and","y","dimensions","are","scaled","independently",".","*","*","kwargs",":","dict","Keyword","arguments","to","pass","to","`","BaseCamera","`",".","Notes","--","--","-","Interaction",":","*","LMB",":","pan","the","view","*","RMB","or","scroll",":","zooms","the","view"]
docstr: The SubScene received a mouse event; update transform
  accordingly.
  
  Parameters
  ----------
  event : instance of Event
      The event.
docstr_tok: ["The","SubScene","received","a","mouse","event",";","update","transform","accordingly",".","Parameters","--","--","--","--","--","event",":","instance","of","Event","The","event","."]
code: def viewbox_mouse_event(self, event):
      """
      The SubScene received a mouse event; update transform
      accordingly.
  
      Parameters
      ----------
      event : instance of Event
          The event.
      """
      if event.handled or not self.interactive:
          return
  
      # Scrolling
      BaseCamera.viewbox_mouse_event(self, event)
  
      if event.type == "mouse_wheel":
          center = self._scene_transform.imap(event.pos)
          self.zoom(
              (1 + self.zoom_factor) ** (-event.delta[1] * 30), center
          )
          event.handled = True
      elif event.type == "gesture_zoom":
          center = self._scene_transform.imap(event.pos)
          self.zoom(1 - event.scale, center)
          event.handled = True
      elif event.type == "mouse_move":
          if event.press_event is None:
              return
  
          modifiers = event.mouse_event.modifiers
          p1 = event.mouse_event.press_event.pos
          p2 = event.mouse_event.pos
  
          if 1 in event.buttons and not modifiers:
              # Translate
              p1 = np.array(event.last_event.pos)[:2]
              p2 = np.array(event.pos)[:2]
              p1s = self._transform.imap(p1)
              p2s = self._transform.imap(p2)
              self.pan(p1s - p2s)
              event.handled = True
          elif 2 in event.buttons and not modifiers:
              # Zoom
              p1c = np.array(event.last_event.pos)[:2]
              p2c = np.array(event.pos)[:2]
              scale = (1 + self.zoom_factor) ** (
                  (p1c - p2c) * np.array([1, -1])
              )
              center = self._transform.imap(event.press_event.pos[:2])
              self.zoom(scale, center)
              event.handled = True
          else:
              event.handled = False
      elif event.type == "mouse_press":
          # accept the event if it is button 1 or 2.
          # This is required in order to receive future events
          event.handled = event.button in [1, 2]
      else:
          event.handled = False
  
imports: from __future__ import division
  import numpy
  from .base_camera import BaseCamera
  from ...geometry import Rect
  from ...visuals.transforms import STTransform, MatrixTransform
label_desc: Use image node_id 12 for calling the PanZoomCamera obj's underlying member method code with example usage: obj.viewbox_mouse_event(event) without return types