def constrain_axes(self, relative_to_x):
        """Constrain amount of translation to axis.

        relative_to_x
            Boolean. If True, constraining is being made
            relative to the x axis. Else, such constraining
            is relative to the y axis.
        """
        ### for each axis toggled, cover the three possible
        ### cases:
        # 1) axis in question is on,  other  is on
        # 2) axis in question is on,  other  is off
        # 3) axis in question is off, other  is on
        x, y = self.x_axis_factor, self.y_axis_factor

        if relative_to_x:

            if x and y:
                self.y_axis_factor = 0
            elif x and not y:
                self.y_axis_factor = 1
            elif not x and y:
                self.x_axis_factor, self.y_axis_factor = (
                    self.y_axis_factor,
                    self.x_axis_factor,
                )

        else:

            if y and x:
                self.x_axis_factor = 0
            elif y and not x:
                self.x_axis_factor = 1
            elif not y and x:
                self.x_axis_factor, self.y_axis_factor = (
                    self.y_axis_factor,
                    self.x_axis_factor,
                )
Constrain amount of translation to axis.

        relative_to_x
            Boolean. If True, constraining is being made
            relative to the x axis. Else, such constraining
            is relative to the y axis.
        
nodezator/editing/reposition.py