Coder Social home page Coder Social logo

potree's Introduction

Introduction

Suite à un challenge, j'ai fork le projet opensource Potree et j'ai pour mission d'ajouter la fonctionnalité de redimensionner en largeur le panel gauche (le menu)

Réflexion

  1. Je vais probablement utiliser quelques constantes, comme une maxWidth qui ne pourra pas être dépassée lors du redimensionnement.

  2. J'ai remarqué dans les fichiers sources, que le <div id="potree_sidebar_container"></div> n'avait pas de contenu, j'en ai conclus que le contenu était généré dynamiquement en JS côté client.

  3. En utilisant "potree_sidebar_container" dans la recherche sur VSCode, j'ai trouvé un fichier JS qui correspondait, nommé viewer.js. Je découvre qu'il y a une fonction load utilisée, j'en déduis que c'est à cet endroit qu'est chargé le menu côté client.

  4. Je vois un sidebarContainer.css("width", "300px"); déjà défini par Potree, c'est ici que sont définis les différentes fonctionnalités du menu et c'est bien ici où je peux en ajouter d'autres.

  5. Je remarque ensuite que ce projet (Potree) utilise jQueryUI (grâce au $()). Je connais cette librairie que de nom, donc je décide de regarder si elle propose une fonctionnalité de redimensionnement et c'est disponible via le .resizable(). Je parcours les arguments et options dans la documentation et en quelques lignes je peux contrôler totalement la largeur du menu.

Code ajouté (dans viewer.js)

sidebarContainer.css("z-index", "100000000");

sidebarContainer.resizable({
  handles: "e",
  minWidth: 300,
  maxWidth: 500,
});

potree's People

Contributors

m-schuetz avatar potree avatar mschuetzcg avatar connormanning avatar firnor avatar dkastl avatar midnight-dev avatar martinheidegger avatar jo-chemla avatar chrislcs avatar ceciliaconsta3 avatar bmichalowski avatar danielsmon avatar tars4815 avatar oscarmartinezrubi avatar roy-mdr avatar jameslmilner avatar maartenvm avatar rob-waring avatar gribbet avatar sqmasep avatar yuhangch avatar lightheaded avatar rburgstaler avatar pierotofy avatar mikepianka avatar mulfvik avatar ozvale avatar ghgr avatar timodwhit avatar

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.