class_docstr: A simple test canvas for drawing demo 
class_docstr_tok: ["A","simple","test","canvas","for","drawing","demo"]
code: def on_mouse_press(self, event):
      tr = self.scene.node_transform(self.view.scene)
      pos = tr.map(event.pos)
      self.view.interactive = False
      selected = self.visual_at(event.pos)
      self.view.interactive = True
      if self.selected_object is not None:
          self.selected_object.select(False)
          self.selected_object = None
  
      if event.button == 1:
          if selected is not None:
              self.selected_object = selected.parent
              # update transform to selected object
              tr = self.scene.node_transform(self.selected_object)
              pos = tr.map(event.pos)
  
              self.selected_object.select(True, obj=selected)
              self.selected_object.start_move(pos)
              self.mouse_start_pos = event.pos
  
          # create new object:
          if (
              self.selected_object is None
              and self.creation_mode is not None
          ):
              # new_object = EditRectVisual(parent=self.view.scene)
              new_object = self.creation_mode(parent=self.view.scene)
              self.objects.append(new_object)
              new_object.select_creation_controlpoint()
              new_object.set_center(pos[0:2])
              self.selected_object = new_object.control_points
  
      if event.button == 2:  # right button deletes object
          if selected is not None and selected.parent in self.objects:
              self.objects.remove(selected.parent)
              selected.parent.parent = None
              self.selected_object = None
  
imports: import numpy
  from vispy import app, scene
  from vispy.color import Color
label_desc: Use image node_id 3 for calling the Canvas obj's underlying member method code with example usage: obj.on_mouse_press(event) without return types