code: def mousePressEvent(self, ev):
      pos = self.transformPos(ev.pos())
      if ev.button() == Qt.LeftButton:
          if self.drawing():
              # self.handleDrawing(pos) # OLD
              if self.current:
                  if self.fourpoint:  # ADD IF
                      # Add point to existing shape.
                      # print('Adding points in mousePressEvent is ', self.line[1])
                      self.current.addPoint(self.line[1])
                      self.line[0] = self.current[-1]
                      if self.current.isClosed():
                          # print('1111')
                          self.finalise()
                  elif self.drawSquare:
                      assert len(self.current.points) == 1
                      self.current.points = self.line.points
                      self.finalise()
              elif not self.outOfPixmap(pos):
                  # Create new shape.
                  self.current = Shape()
                  self.current.addPoint(pos)
                  self.line.points = [pos, pos]
                  self.setHiding()
                  self.drawingPolygon.emit(True)
                  self.update()
  
          else:
              group_mode = int(ev.modifiers()) == Qt.ControlModifier
              self.selectShapePoint(
                  pos, multiple_selection_mode=group_mode
              )
              self.prevPoint = pos
              self.pan_initial_pos = pos
  
      elif ev.button() == Qt.RightButton and self.editing():
          group_mode = int(ev.modifiers()) == Qt.ControlModifier
          self.selectShapePoint(pos, multiple_selection_mode=group_mode)
          self.prevPoint = pos
      self.update()
  
imports: import copy
  from PyQt5.QtCore import Qt, pyqtSignal, QPointF, QPoint
  from PyQt5.QtGui import QPainter, QBrush, QColor, QPixmap
  from PyQt5.QtWidgets import QWidget, QMenu, QApplication
  from libs.shape import Shape
  from libs.utils import distance
label_desc: Use image node_id 13 for calling the Canvas obj's underlying member method code with example usage: obj.mousePressEvent(ev) without return types