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

Implement workaround for JSXGraph issue with points created off the board. #850

Merged

Conversation

drgrice1
Copy link
Member

If a point is created off the board with snapSizeGrid true, then the coordinate that is outside of the board's bounding box range is moved one snap size unit toward the bounding box range. See jsxgraph/jsxgraph#545 for issues on this bug in JSXGraph.

To fix this points need to be created with snapToGrid false (the default value), and then that attribute set to true afterward. In order for this to work the coordinates of the point need to be manually rounded to the snap size.

This is only done for initial creation of objects (answers or static objects). It does not need to be done for objects that are created dynamically (by student interaction) since those points are forced to be on the board anyway. This is also not done for 'point' graph tool objects, since the correct answer should not be a point off the board anyway.

This workaround fixes issue #849.

Copy link
Contributor

@Alex-Jordan Alex-Jordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested that it fixes the issue with the given sample problem.

Copy link
Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue.

@pstaabp
Copy link
Member

pstaabp commented Jun 12, 2023

@drgrice1 Will need to resolve conflicts. Just merged #851.

…oard.

If a point is created off the board with `snapSizeGrid` true, then the
coordinate that is outside of the board's bounding box range is moved
one snap size unit toward the bounding box range.  See
jsxgraph/jsxgraph#545 for issues on this bug
in JSXGraph.

To fix this points need to be created with `snapToGrid` false (the
default value), and then that attribute set to true afterward.  In order
for this to work the coordinates of the point need to be manually
rounded to the snap size.

This is only done for initial creation of objects (answers or static
objects).  It does not need to be done for objects that are created
dynamically (by student interaction) since those points are forced to be
on the board anyway.  This is also not done for 'point' graph tool
objects, since the correct answer should not be a point off the board
anyway.

This workaround fixes issue openwebwork#849.
@drgrice1 drgrice1 force-pushed the bugfix/graphtool-point-off-board branch from bd9025b to 8fd1f4d Compare June 12, 2023 20:32
@pstaabp pstaabp merged commit c171267 into openwebwork:PG-2.18 Jun 12, 2023
@drgrice1 drgrice1 deleted the bugfix/graphtool-point-off-board branch June 12, 2023 21:31
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.

3 participants