GithubHelp home page GithubHelp logo

xinaesthete / dat.guivr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dataarts/dat.guivr

9.0 9.0 3.0 39.99 MB

A flexible graphical user interface for changing variables within WebVR.

Home Page: https://workshop.chromeexperiments.com/examples/guiVR/

License: Apache License 2.0

JavaScript 82.63% HTML 17.37%

dat.guivr's People

Contributors

customlogic avatar kabbi avatar mflux avatar sjpt avatar snickell avatar xinaesthete avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dat.guivr's Issues

small numbers format wrong

Small numbers format as 0 in slider boxes.
Replace roundToDecimal with something like:

function roundToDecimal(value, decimals) {
    if (Math.abs(value) < 0.01 && value !== 0) return value.toExponential(3);  
    var tenTo = Math.pow(10, decimals); 
    return Math.round(value * tenTo) / tenTo;
}

n.b. do NOT use value.toExponential(decimals)

Tooltips don't work on dropdowns

Because the code for creating tooltips relies on the presence a property interaction on the object, which by convention most types of widget have but dropdowns don't.

Controllers becoming invisible while being interacted with remain 'pressing'

This is a problem that can particularly emerge when you detach a folder, close the folder it came from and then re-attach it. The controller that you use for pressing the button to reattach will now no longer be interact with anything until the folder becomes visible again.

This also applies if you're doing something like moving a slider when it gets hidden.

I think it results from interaction.update() not being called for anything that's not visible.

centre on box not working

There is already code to centre text in box if no textX specified.
imagebuttongrid around line 149.

This is wrong because w = text.computeWidth(); gives wrong answer where it is.
For simple cases, w = text.computeWidth(); is correct if moved before text.constrainBounds(BUTTON_WIDTH - _margin, BUTTON_HEIGHT - _margin);

Not sure exactly how the logic should flow to allow for long text/ wrapped text, etc.

Long option names in dropdown overflow.

Would be desirable to constrain these, somewhat similarly to what I now do in imagebuttongrid with text (at some point I should improve naming, documentation... might want to do more thorough refactor). Maybe show the full string as tooltip.

Pressing more than one mouse button upsets system

When working with a 2d GUI, holding left button then pressing and releasing right button before releasing left, will lead to the system behaving as if left has been released (stop moving folder around).

Subsequent left drag that doesn't hit GUI then erroneously drags the GUI...

Dropdowns dismissed as a result of clicking background still receive events

This does not apply to other 'modal' (wrong terminology really, but it's what I use internally) editors like color picker.

For example, in imagebutton.html

  1. click the 'scale' dropdown
  2. click elsewhere so the dropdown is no longer visible
  3. click somewhere where the invisible dropdown was

For some reason, setting folder.modalEditor.visible = false is not doing enough to prevent dropdown options being filtered by getVisibleHitscanObjects().

remove requestAnimationFrame overhead

There is a small but significant overhead in setting up and serving each update() callback by requestAnimationFrame. This can be eliminated by a flag for user control of update()

  • make update() call in datguivr/index.js optional depending on flag
  • and update() visible externally when that flag is set (eg as dat.GUIVR.update)
  • make requestAnimationFrame( update ) optional depending on flag
  • when flag set, user code calls dat.GUIVR.update() as needed, eg from its animationFrame callback

menus pushed too far back when order changed

When folders with ortho camera are reordered they are pushed to the back.
This can have issues with big depths.
It would be best to preserve the specified z-values as far as possible.
see e.g. code below

function orthographicFolderLayout() {
  var cam = topFolderStack[0].userData.isOrthographic;
  if (!cam || topFolderStack.length <= 1) return;
    //camBoxSetup(cam);

    // original code laid them out right at back,
    // so odd z-buffer effects made them white on black, and often hidden anyway
    // This respects the original z values as much as possible, but applies them in appropriate order
    // If there is a clash of x values then the originals are (slightly) modified
    var near = cam.near,
      far = cam.far,
      n = topFolderStack.length,
      zs = topFolderStack.map(f => f.position.z).sort((a,b)=>a-b);  // old z values small to big
      zs[-1] = -9999;
      zs.forEach( (z,i) => zs[i] = Math.max(zs[i], zs[i-1] + 10*Layout.PANEL_DEPTH));  // in case of equals

  topFolderStack.forEach(function (f, i) {
    // var z = -0.9 * far + i * 10 * Layout.PANEL_DEPTH;    // original code, too near back
    // var z = - (near + (n-i) * 10 * Layout.PANEL_DEPTH);  // variant code stacking from front
    var z = zs[i];                                          // use sorted (?modified) old z-values
    if (z !== f.position.z) {
      f.position.z = z;
      f.updateMatrix();
      f.fixFolderPosition();
    }
  });
  if (topFolderStack[n - 1].position.z >= near - Layout.PANEL_DEPTH) {
    console.log("GUIVR Warning: likely problem with z-order in orthographicFolderLayout");
  }
  //console.log(`[${topFolderStack.map(f=>f.folderName + '\t: ' + f.position.z).join('\n')}]`);
}


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.