Open GoogleCodeExporter opened 8 years ago
Are you working on a scene editor? To implement this, you need to write
callback functions to detect pointer events.
Jsc3d provides a series of pointer event handlers with meaningful names, which
can be overriden to process pointer events. These inlude:
viewer.onmousedown
viewer.onmousemove
viewer.onmouseup
viewer.onmousewheel
They have the same signature as:
viewer.onmousexxx(x, y, button, depth, mesh)
the last parameter of which is the mesh the pointer is currently on, or null if
none. These can be utilized to implement interactive effects. For example, to
print the pointed mesh on a mouse-down event, we just write codes like this:
viewer.onmousedown = function(x, y, button, depth, mesh) {
if (button == 0/* left button down */ && mesh)
console.info(mesh);
};
There's no existing handler for a click event. But it is not difficult to
simulate it by detecting a pair of consecutive mouse-down and mouse-up events.
To remove a mesh from the scene, just use scene.removeChild() method, passing
in the mesh to be deleted and it will be done. The documentation of this
function is here
http://jsc3d.googlecode.com/svn/trunk/jsc3d/docs/symbols/JSC3D.Scene.html#remove
Child.
Original comment by Humu2...@gmail.com
on 24 Jul 2014 at 12:37
Original issue reported on code.google.com by
prasen.b...@gmail.com
on 24 Jul 2014 at 11:03