Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

How to make drawables (2D and/or 3D) draggable in Javascript post and replies

Return to the How to make drawables (2D and/or 3D) draggable in Javascript thread
Login to post to this thread

I would like to make an object draggable - Jan 8, 2016 at 7:59PM
Karim Diff
1 Posts

I am working on a Javascript simulation where the user would be able to move objects on the screen but I can't find the option that makes the object draggable te same way it is possible in Java. Any suggestions on how I could do that?

 


Replies to I would like to make an object draggable

Re: I would like to make an object draggable - Jan 09 2016 6:53PM
Wolfgang
113 Posts

The simple harmonic oscillator JavaScript model has a draggable mass.

http://www.compadre.org/osp/items/detail.cfm?ID=13103

I recommend you look at the simple version of this model without the graph.  Remember that you must enable the Plotting Panel so that it processes mouse events.  Mouse events are disabled by default for performance reasons.



Re: I would like to make an object draggable - Aug 10 9:35AM
Keith Fox
1 Posts

Good question. I'd like to join the discussion. And I also have a question about JS frameworks. Which one to choose? Ember, classic Angular or React? https://qubit-labs.com/comparison-of-javascript-frameworks-angular-js-vs-react-js-vs-ember-js/ The last option looks the most troublesome as it is owned by one guy.



The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics