code: def boundedMoveVertex(self, pos):
      index, shape = self.hVertex, self.hShape
      point = shape[index]
      if self.outOfPixmap(pos):
          size = self.pixmap.size()
          clipped_x = min(max(0, pos.x()), size.width())
          clipped_y = min(max(0, pos.y()), size.height())
          pos = QPointF(clipped_x, clipped_y)
  
      if self.drawSquare:
          opposite_point_index = (index + 2) % 4
          opposite_point = shape[opposite_point_index]
  
          min_size = min(
              abs(pos.x() - opposite_point.x()),
              abs(pos.y() - opposite_point.y()),
          )
          directionX = -1 if pos.x() - opposite_point.x() < 0 else 1
          directionY = -1 if pos.y() - opposite_point.y() < 0 else 1
          shiftPos = QPointF(
              opposite_point.x() + directionX * min_size - point.x(),
              opposite_point.y() + directionY * min_size - point.y(),
          )
      else:
          shiftPos = pos - point
  
      if [shape[0].x(), shape[0].y(), shape[2].x(), shape[2].y()] == [
          shape[3].x(),
          shape[1].y(),
          shape[1].x(),
          shape[3].y(),
      ]:
          shape.moveVertexBy(index, shiftPos)
          lindex = (index + 1) % 4
          rindex = (index + 3) % 4
          lshift = None
          rshift = None
          if index % 2 == 0:
              rshift = QPointF(shiftPos.x(), 0)
              lshift = QPointF(0, shiftPos.y())
          else:
              lshift = QPointF(shiftPos.x(), 0)
              rshift = QPointF(0, shiftPos.y())
          shape.moveVertexBy(rindex, rshift)
          shape.moveVertexBy(lindex, lshift)
  
      else:
          shape.moveVertexBy(index, shiftPos)
  
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 25 for calling the Canvas obj's underlying member method code with example usage: obj.boundedMoveVertex(pos) without return types