Git Product home page Git Product logo

documentation's People

Contributors

amineau avatar amoki avatar kevinfabre avatar kurtil avatar lrxgaelle avatar nicolasrichel avatar pvilalta avatar romainmou avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

documentation's Issues

Add an example of a 'Button Plugin' on the main window (3D Viewer)

Add a section or a paragraph to show how to add a "Button Plugin" on the 3D Viewer window by mean of the addToWindows option.

Example:

const viewer = makeBIMDataViewer({ /* viewer config */ });

viewer.registerPlugin({
  name: 'buttonPlugin',
  component: {
    name: 'ButtonPluginComponent',
    template: '<div>Hello World !</div>'
  },
  button: {
    position: 'right',
    content: 'simple',
  },
  addToWindows: [ '3d' ] // <-- Here is the trick :)
});

viewer.mount('#viewerId', '3d');

Add & Explain 'unsubscription' from Hubs event in tutorial

Explain that it is important to call hub.off("sub ID") method when a component is "destroyed".

Example:

const viewer = makeBIMDataViewer({ /* viewer config */ });

viewer.registerPlugin({
  name: 'windowPlugin',
  component: {
    name: 'WindowPluginComponent',
    template: `
    <div style="
      height: 100%;
      display: flex;
      justify-content:center;
      align-items:center;
      overflow-y: scroll;
    ">
      <ul>
        <li v-for="obj in objects" :key="obj.id">{{ obj.uuid }}</li>
      </ul>
    </div>`,
    data() {
      return {
        objects: []
      };
    },
    created() {
      this.subSelect = this.$viewer.state.hub.on('objects-selected', () => {
        this.objects = this.$viewer.state.selectedObjects;
      });
      this.subUnselect = this.$viewer.state.hub.on('objects-deselected', () => {
        this.objects = this.$viewer.state.selectedObjects;
      });
    },
    // THIS IS IMPORTANT
    destroyed() {
      this.$viewer.state.hub.off(this.subSelect);
      this.$viewer.state.hub.off(this.subUnselect);
    }
    // ================
  }
});

viewer.registerWindow({
  name: 'my-window',
  plugins: [
    'windowPlugin',
  ],
});

viewer.mount('#viewerId', {
  ratios: [ 50, 50 ],
  children: [
    '3d',
    'my-window'
  ],
});

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.