0. Cover

1. Constrain movement by DynamicCoordinates command

To constrain the movement of the free point P on gird only, the following [b]DynamicCoordinates[/b] command is used to define P.[br][b]P = [/b][b]DynamicCoordinates(B, round(x(B)), round(y(B)))[br][/b]where B is a hidden free point.

Demo: draggable bar (for barchart etc)

Define the polygon like this:[br][code]Polygon(P, Q, (0, y(Q)), (0, y(P)))[/code][br][br]and then add this as its On Update script to make sure it stays at the same height and can't go negative:[br][code]SetCoords(P, If(x(P) < 0, 0, x(P)), 1)[br]SetValue(Q, P + (0, 1))[br][/code][br]and then make sure "Selection Allowed" is unchecked for 3 of the segments. Also set Algebra -> Increment to eg 1 for Points P and Q (for keyboard control)[br][br]Try changing the "snap to grid" settings in the style bar.[br][br]Thanks to [url=https://www.geogebra.org/u/orchiming]Anthony Or[/url] for the idea, as shown at #ggbconf2019. Here's a full example to show how it can be used [url=https://www.geogebra.org/m/vmbuztsg]geogebra.org/m/vmbuztsg[/url][br][br]

Information