Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from dat.gui to lil-gui #2258

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/3dtiles_25d.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/example.css">
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv" class="viewer"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/3dtiles_basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/example.css">
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/3dtiles_batch_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/example.css">
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/3dtiles_ion.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</style>


<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="description">
Expand Down
2 changes: 1 addition & 1 deletion examples/3dtiles_pointcloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/example.css">
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="description">
Expand Down
2 changes: 1 addition & 1 deletion examples/customColorLayerEffect.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/effects_split.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/effects_stereo.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv">
Expand Down
2 changes: 1 addition & 1 deletion examples/entwine_3d_loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</style>

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="description">Specify the URL of a Entwine Point Tree to load:
Expand Down
4 changes: 2 additions & 2 deletions examples/entwine_simple_loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</style>

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="description">Specify the URL of a Entwine Point Tree to load:
Expand All @@ -31,7 +31,7 @@
<script src="js/GUI/LoadingScreen.js"></script>
<script src="../dist/debug.js"></script>
<script type="text/javascript">
var debugGui = new dat.GUI();
var debugGui = new lil.GUI();
var viewerDiv = document.getElementById('viewerDiv');
viewerDiv.style.display = 'block';
var view = new itowns.View('EPSG:3946', viewerDiv);
Expand Down
2 changes: 1 addition & 1 deletion examples/geoid_geoidLayer.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" type="text/css" href="css/example.css">
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
37 changes: 19 additions & 18 deletions examples/js/GUI/GuiTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,47 @@
* Description: Classe pour créer un menu.
*/

/* global dat, itowns */
/* global lil, itowns */

dat.GUI.prototype.removeFolder = function removeFolder(name) {
const folder = this.__folders[name];
lil.GUI.prototype.findFolderByTitle = function findFolderByTitle(name) {
return this.folders.find(f => f.$title.innerText === name);
};

lil.GUI.prototype.removeFolder = function removeFolder(name) {
const folder = this.findFolderByTitle(name);
if (!folder) {
return;
}
folder.close();
this.__ul.removeChild(folder.domElement.parentNode);
delete this.__folders[name];
this.onResize();
folder.destroy();
};

dat.GUI.prototype.colorLayerFolder = function colorLayerFolder(name, value) {
const folder = this.__folders[name];
lil.GUI.prototype.colorLayerFolder = function colorLayerFolder(name, value) {
const folder = this.findFolderByTitle(name);
if (!folder) {
return;
}
const title = folder.__ul.getElementsByClassName('title')[0];
const title = folder.$title;

if (title.style) {
title.style.background = value;
}
};

dat.GUI.prototype.hasFolder = function hasFolder(name) {
return this.__folders[name];
};

function GuiTools(domId, view, w) {
if (view) {
const width = w || 245;
const element = document.createElement('div');
element.id = 'menuDiv';
this.gui = new dat.GUI({ autoPlace: false, width: width });
this.gui = new lil.GUI({ autoPlace: false, width: width });
this.gui.close();
element.appendChild(this.gui.domElement);
document.body.appendChild(element);
this.colorGui = this.gui.addFolder('Color Layers');
this.elevationGui = this.gui.addFolder('Elevation Layers');
this.geoidGui = this.gui.addFolder('Geoid Layers');
this.elevationGui.close();
this.colorGui.close();
this.geoidGui.close();
this.elevationGui.hide();
this.colorGui.hide();
this.geoidGui.hide();
Expand Down Expand Up @@ -80,9 +81,9 @@ GuiTools.prototype.addLayersGUI = function fnAddLayersGUI() {
};

GuiTools.prototype.addImageryLayerGUI = function addImageryLayerGUI(layer) {
if (this.colorGui.hasFolder(layer.id)) { return; }
this.colorGui.show();
const folder = this.colorGui.addFolder(layer.id);
folder.close();
folder.add({ visible: layer.visible }, 'visible').onChange((function updateVisibility(value) {
layer.visible = value;
this.view.notifyChange(layer);
Expand All @@ -98,9 +99,9 @@ GuiTools.prototype.addImageryLayerGUI = function addImageryLayerGUI(layer) {
};

GuiTools.prototype.addElevationLayerGUI = function addElevationLayerGUI(layer) {
if (this.elevationGui.hasFolder(layer.id)) { return; }
this.elevationGui.show();
const folder = this.elevationGui.addFolder(layer.id);
folder.close();
folder.add({ frozen: layer.frozen }, 'frozen').onChange(function refreshFrozenGui(value) {
layer.frozen = value;
});
Expand All @@ -111,9 +112,9 @@ GuiTools.prototype.addElevationLayerGUI = function addElevationLayerGUI(layer) {
};

GuiTools.prototype.addGeoidLayerGUI = function addGeoidLayerGUI(layer) {
if (this.geoidGui.hasFolder(layer.id)) { return; }
this.geoidGui.show();
const folder = this.geoidGui.addFolder(layer.id);
folder.close();
folder.add({ frozen: layer.frozen }, 'frozen').onChange(function refreshFrozenGui(value) {
layer.frozen = value;
});
Expand Down
2 changes: 1 addition & 1 deletion examples/laz_dragndrop.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv">
Expand Down
2 changes: 1 addition & 1 deletion examples/mars.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_camera_animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" type="text/css" href="css/example.css">
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_camera_traveling.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="description">
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_clamp_ground.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/example.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_collada.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" type="text/css" href="css/example.css">
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_colorlayer_visibility.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/example.css">
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_compare_25d_3d.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_custom_controls.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="description">
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_custom_label.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</style>

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="description">
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_georeferenced_images.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
<script src="js/OrientedImageHelper.js"></script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_instancing.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="description">
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_orthographic_camera.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" type="text/css" href="css/widgets.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="description">
Expand Down
2 changes: 1 addition & 1 deletion examples/plugins_drag_n_drop.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv">
Expand Down
2 changes: 1 addition & 1 deletion examples/plugins_pyramidal_tiff.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/plugins_vrt.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.0.1/papaparse.min.js"></script>
</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions examples/potree_25d_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>

<div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
<script src="../dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script src="../dist/debug.js"></script>
Expand All @@ -52,7 +52,7 @@
viewerDiv = document.getElementById('viewerDiv');
viewerDiv.style.display = 'block';

debugGui = new dat.GUI();
debugGui = new lil.GUI();

// TODO: do we really need to disable logarithmicDepthBuffer ?
view = new itowns.View('EPSG:3946', viewerDiv);
Expand Down
4 changes: 2 additions & 2 deletions examples/potree_3d_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<body>
<div id="viewerDiv"></div>
<div id="info"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
<script src="../dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script src="../dist/debug.js"></script>
Expand All @@ -46,7 +46,7 @@
viewerDiv = document.getElementById('viewerDiv');
viewerDiv.style.display = 'block';

debugGui = new dat.GUI();
debugGui = new lil.GUI();

var placement = {
coord: new itowns.Coordinates('EPSG:4326', 4.631512, 43.675626),
Expand Down
2 changes: 1 addition & 1 deletion examples/source_file_from_fetched_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.19.1/dist/lil-gui.umd.min.js"></script>
</head>
<body>
<div id="viewerDiv" class="viewer"></div>
Expand Down
Loading