pyramation / LaTeX2HTML5

LaTeX and PSTricks rendering for the Web
62 stars 12 forks source link

User interaction #25

Open david-topham opened 4 years ago

david-topham commented 4 years ago

I love this project! Very well thought out and implemented. While working with the interactive samples, I could not tell if uservariable and slider are available for any pstricks code, or if they are hard-coded to only work with mouse ( for psline ) or psplot. i.e. Could I get users choice via html/javascript input to control location of psline?

pyramation commented 4 years ago

currently it's tied to mouse... but this is a great point! I will document the code here in this issue best I can in attempt to help create a feature for this.

uservariable and userline

in the pspicture environment definition, here are the touch/mouse movements in the source, producing userEvents: https://github.com/pyramation/LaTeX2JS/blob/master/packages/latex2js-pstricks/src/lib/psgraph.js#L513-L530

It basically just re-renders everything on each userEvent (touch/mouse movement)

slider

slider is really it's own component that gets injected:

state variables as a potential solution

so seems that we may want to move the variables out of these individual contexts, and into state, which is decoupled from the actual rendering environments.

david-topham commented 4 years ago

One application of having access to points in the pspicture could be that the user could modify it through the DOM interface. Another could be to create an animation where the variable changes based on a timer.