def METHOD_NAME(self, factor, zoom_to_mouse_cursor=True, cursor_pos=None):
    if factor > 1 and self.view_rect().width() / factor < self.MINIMUM_VIEW_WIDTH:
        factor = self.view_rect().width() / self.MINIMUM_VIEW_WIDTH
    if zoom_to_mouse_cursor:
        pos = self.mapFromGlobal(QCursor.pos()) if cursor_pos is None else cursor_pos
    else:
        pos = None
    old_pos = self.mapToScene(pos) if pos is not None else None
    show_full = False
    if self.view_rect().width() / factor > self.sceneRect().width():
        self.show_full_scene()
        factor = 1
        show_full = True
    self.scale(factor, 1)
    if show_full:
        self.zoomed.emit(-1)
    else:
        self.zoomed.emit(factor)
    if pos is not None:
        move = self.mapToScene(pos) - old_pos
        self.translate(move.x(), 0)