Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix label squeezed bug #1816

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

TurkeyBilly
Copy link
Contributor

Motivation

When using get_axis_label, label.shift_onto_screen(buff=MED_SMALL_BUFF) will squeeze labels into the original pre-set frame radius. This is very inconvenient when working with a zooming camera frame.
Therefore proposed to add a parameter set to False on default, since users who do not realize this function exists will cause buggy issues.
ac43573bbf3f2eff83a20450adc30cf

Proposed changes

  • added a parameter ensure_on_screen to activate shift_onto_screen method for label

Test

Code:

        fr: CameraFrame = self.camera.frame
        fr.scale(2).shift(4*UP+6*RIGHT)
        common_plane_config = dict(
            x_range=[0, titrated, titrated/10],
            height=FRAME_HEIGHT*1.6, width=FRAME_WIDTH*1.6
        )

        plane = NumberPlane(
            **common_plane_config, y_range=[0, 14.0, 2.0],
        ).scale(0.5).shift(0.5*LEFT)
        plane.add_coordinate_labels()
        self.add(
            plane.get_x_axis_label("mL", direction=RIGHT),
            plane.get_y_axis_label("pH", direction=UP)
        )

        a_conentration_plane = NumberPlane(
            **common_plane_config, y_range=[0, 14.0, 2.0],
        ).scale(0.5).shift(0.5*LEFT + 7.5*UP)
        a_conentration_plane.add_coordinate_labels()
        a_conentration_plane.add(
            a_conentration_plane.get_x_axis_label("mL", direction=RIGHT),
            a_conentration_plane.get_y_axis_label("M", direction=UP)
        )

        ha_concentration_plane = NumberPlane(
            **common_plane_config, y_range=[0, 14.0, 2.0],
        ).scale(0.5).shift(13.*RIGHT + 7.5* UP)
        ha_concentration_plane.add_coordinate_labels()
        self.add(
            ha_concentration_plane.get_x_axis_label("mL", direction=UP),
            ha_concentration_plane.get_y_axis_label("M", direction=UP)
        )

        oh_concentration_plane = NumberPlane(
            **common_plane_config, y_range=[0, 14.0, 2.0],
        ).scale(0.5).shift(13.*RIGHT)
        oh_concentration_plane.add_coordinate_labels()
        self.add(
            oh_concentration_plane.get_x_axis_label("mL", direction=RIGHT),
            oh_concentration_plane.get_y_axis_label("M", direction=UP)
        )

        self.add(plane, a_conentration_plane, ha_concentration_plane, oh_concentration_plane)

Result:
image

@TurkeyBilly TurkeyBilly changed the title Update coordinate_systems.py fix label squeezed bug May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant