def METHOD_NAME(self, a0: QtGui.QMouseEvent):
    if a0.buttons() == QtCore.Qt.MouseButton.RightButton:
        a0.ignore()
        return
    x = a0.position().x()
    y = a0.position().y()
    absx = x - (self.width() - self.dim.width) / 2
    absy = y - (self.height() - self.dim.height) / 2
    if (
        absx < 0
        or absx > self.dim.width
        or absy < 0
        or absy > self.dim.height
        or (not self.data and not self.reference)
    ):
        a0.ignore()
        return
    a0.accept()
    target = self.data or self.reference
    positions = []
    dim_x_2 = self.dim.width / 2
    dim_y_2 = self.dim.height / 2
    width_2 = self.width() / 2
    height_2 = self.height() / 2
    positions = [
        math.sqrt(
            (x - (width_2 + d.re * dim_x_2)) ** 2
            + (y - (height_2 - d.im * dim_y_2)) ** 2
        )
        for d in target
    ]
    minimum_position = positions.index(min(positions))
    if m := self.getActiveMarker():
        m.setFrequency(str(round(target[minimum_position].freq)))