APS Excellence in Physics Education Award
November 2019

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
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 -
Wolfgang
191 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.



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book