Skip to content

Commit

Permalink
various minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Dec 15, 2024
1 parent 931fc75 commit a0b537e
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 4 deletions.
40 changes: 40 additions & 0 deletions examples/js/long-hide.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import GUI from '../../dist/0.x/muigui.module.js';
//import {GUI} from '../../src/muigui.js';

const gui = new GUI();

function addFolder(gui, name) {
const f = gui.addFolder(name);
for (let i = 0; i < 50; ++i) {
f.addButton(i.toString(), () => {});
}
}

const degToRad = deg => deg * Math.PI / 180;

const settings = {
translation: new Float32Array([0, 0, 0]),
rotation: new Float32Array([0, 0, 0]),
scale: new Float32Array([1, 1, 1]),
baseRotation: degToRad(-45),
};

const radToDegOptions = { min: -180, max: 180, step: 1, converters: GUI.converters.radToDeg };
const cameraRadToDegOptions = { min: -180, max: 180, step: 1, converters: GUI.converters.radToDeg };

gui.add(settings, 'baseRotation', cameraRadToDegOptions);
const nodeLabel = gui.addLabel('node:');

Check failure on line 26 in examples/js/long-hide.js

View workflow job for this annotation

GitHub Actions / build-and-deploy

'nodeLabel' is assigned a value but never used

Check failure on line 26 in examples/js/long-hide.js

View workflow job for this annotation

GitHub Actions / test

'nodeLabel' is assigned a value but never used

Check failure on line 26 in examples/js/long-hide.js

View workflow job for this annotation

GitHub Actions / build-and-deploy

'nodeLabel' is assigned a value but never used
const trsFolder = gui.addFolder('orientation');
trsFolder.add(settings.translation, '0', -50, 50, 1).name('translation x');
trsFolder.add(settings.translation, '1', -50, 50, 1).name('translation y');
trsFolder.add(settings.translation, '2', -50, 50, 1).name('translation z');
trsFolder.add(settings.rotation, '0', radToDegOptions).name('rotation x');
trsFolder.add(settings.rotation, '1', radToDegOptions).name('rotation y');
trsFolder.add(settings.rotation, '2', radToDegOptions).name('rotation z');
trsFolder.add(settings.scale, '0', 0.001, 2).name('scale x');
trsFolder.add(settings.scale, '1', 0.001, 2).name('scale y');
trsFolder.add(settings.scale, '2', 0.001, 2).name('scale z');

addFolder(gui, 'one');
addFolder(gui, 'two');
addFolder(gui, 'three');
18 changes: 18 additions & 0 deletions examples/long-hide.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,minimum-scale=1,maximum-scale=1">
<title>muigui</title>

<style>
:root {
color-scheme: light dark;
}
</style>
<body>
<h1>muigui</h1>
<div id="log"></div>
</body>
<script type="module" src="js/long-hide.js"></script>
</html>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "muigui",
"version": "0.0.17",
"version": "0.0.18",
"description": "A Simple GUI",
"main": "dist/0.x/muigui.js",
"module": "dist/0.x/muigui.module.js",
Expand Down
2 changes: 2 additions & 0 deletions src/controllers/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ export default class Button extends Controller {
}
name(name) {
this.#buttonElem.textContent = name;
return this;
}
setOptions(options) {
copyExistingProperties(this.#options, options);
const {name} = this.#options;
this.#buttonElem.textContent = name;
return this;
}
}
3 changes: 3 additions & 0 deletions src/controllers/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ export default class Canvas extends LabelController {
get canvas() {
return this.#canvasElem;
}
listen() {
return this;
}
}
6 changes: 6 additions & 0 deletions src/controllers/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,10 @@ export default class Container extends Controller {
this.#childDestController = this.#childDestController.parent;
return this;
}
listen() {
this.#controllers.forEach(c => {
c.listen();
});
return this;
}
}
2 changes: 1 addition & 1 deletion src/styles/muigui.css.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export default {
}
.muigui-closed>.muigui-open-container>* {
transition: all 0.1s ease-out;
margin-top: -100%;
margin-top: -1000%;
}
/* ---- popdown ---- */
Expand Down

0 comments on commit a0b537e

Please sign in to comment.