maths / moodle-qtype_stack

Stack question type for Moodle
GNU General Public License v3.0
141 stars 150 forks source link

Updated JSXGraph.md #1078

Closed LukeLongworth closed 10 months ago

LukeLongworth commented 10 months ago

Changed comment format from // to /*/ and added two examples to the bottom of the page on custom binding. Also removed the suggestions to do stateInput.style.display = 'none'; because a) the (in my opinion) much better method of <p hidden="">[[input]]</p> is already given earlier in the page, and b) I'm not convinced this method still even works with STACK-JS.

*I think it's better because if you use style.display = 'none' then the input box is visible on page load and then disappears once everything else has loaded.

aharjula commented 10 months ago

Yes STACK-JS did indeed make it impossible to simply modify the visibility of an input like that. And elimination of // comments in any JavaScript inside Moodle will always be welcome.

The sector shading example is interesting and would probably map to normal custom_bind with a "handle object", like the hidden padding point in this upcoming documentation (requires 4.4.7 for the register_object-calls to work in that example). The custom_bind does not need to relate to the actual objects it has been given to track, those are just the objects that when updating trigger the binding logic.

Handle objects are also handy if you attach additional event handlers to your graph, and it becomes unclear in which order those might get executed. In an example on the Zulip side we use the actual bound objects like handle objects to ensure that the event hander logic happens after things have been done.

In any case, I support merging this in this form. Probably will be rearranged more when we start having more examples.

sangwinc commented 10 months ago

Thanks Luke, a much appreciated contribution.