Skip to content

Commit

Permalink
Minor examples improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
willeastcott committed Dec 27, 2024
1 parent f4a1429 commit 267101c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
18 changes: 10 additions & 8 deletions examples/elements/numericinput.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@
</head>
<body>
<script type="module">
import { LabelGroup, NumericInput } from '@playcanvas/pcui';
import { InfoBox, LabelGroup, NumericInput } from '@playcanvas/pcui';
import '@playcanvas/pcui/styles'

const numericInput = new NumericInput({
step: 0.1,
min: 0,
max: 1,
value: 0.5
});
const numericInput = new NumericInput();

const labelGroup = new LabelGroup({
field: numericInput,
text: 'NumericInput'
text: 'Enter a number:'
});
labelGroup.dom.querySelector('.pcui-label').style.width = '125px';

document.body.appendChild(labelGroup.dom);

const infoBox = new InfoBox({
icon: 'E400',
text: 'NumericInput supports expressions and percentages. For example, you can enter "10 * (2 + 3)" to get a value of 50. You can also enter "50%" to calculate the percentage of the current value. You can even use percentages in expressions.'
});
document.body.appendChild(infoBox.dom);
</script>
</body>
</html>
7 changes: 4 additions & 3 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
<script type="importmap">
{
"imports": {
"@playcanvas/pcui": "https://cdn.jsdelivr.net/npm/@playcanvas/pcui/+esm",
"@playcanvas/pcui/styles": "https://cdn.jsdelivr.net/npm/@playcanvas/pcui/styles/+esm"
"@playcanvas/observer": "https://cdn.jsdelivr.net/npm/@playcanvas/observer/+esm",
"@playcanvas/pcui": "/dist/module/src/index.mjs",
"@playcanvas/pcui/styles": "/styles/dist/index.mjs"
}
}
</script>
Expand Down Expand Up @@ -60,7 +61,7 @@
const treeView = new TreeView({
allowRenaming: false,
allowReordering: false,
allowDragging: false
allowDrag: false
});

const iframe = document.createElement('iframe');
Expand Down

0 comments on commit 267101c

Please sign in to comment.