dataarts / dat.guiVR

A flexible graphical user interface for changing variables within WebVR.
https://workshop.chromeexperiments.com/examples/guiVR/
Apache License 2.0
311 stars 50 forks source link

Fix folder dragging when parent has matrix #94

Open snickell opened 6 years ago

snickell commented 6 years ago

Current code assumes the object being grabbed has a parent in the same matrix as world. We need to transform the current folder being dragged as offset from the parent matrix (NOT the world matrix).

Prior to this change folders jumped around like crazy if they were children of elements with a matrixWorld != identity.

Tested both with folders in the world space, and with folders with parents not in the world coordinates.

xinaesthete commented 6 years ago

Hi, original devs have gone quiet but I've been reviewing your changes for my fork (which I'll probably be doing some more work on/with over the next couple of months).

Your initial bug fix looks good, and other stuff all sane etc, only thing is that it looks like MAX_FOLDER_ITEMS won't work so well with rows that aren't uniform height (including open nested folders as well as some other features that aren't in the original library). I think I'll try changing your version to a maxHeight property on folder, but haven't fully thought through what'll happen with lots of big nested folders or other edge cases.

In my laziness, I'm currently just putting any changes into my ImageButton branch - some of those involve extra features for which the API might change, so I was keeping those separate from 'normal' version, but I don't think there's anything breaking in the standard stuff (although I do plan on fixing https://github.com/dataarts/dat.guiVR/issues/91 soon, which will involve breaking changes one way or another).