Use bootstrap-icons; refactor some JS

This commit is contained in:
2025-04-01 14:53:02 +02:00
parent aab30f48d4
commit 8945fcb73b
12 changed files with 69 additions and 78 deletions

View File

@@ -1,5 +1,4 @@
import { Controller } from "@hotwired/stimulus"
import API_CONFIG from "../config.js";
/**
* @todo Handle errors
@@ -12,7 +11,7 @@ export default class extends Controller {
'buildingForm'
];
API_BASE = API_CONFIG.dev;
API_BASE = window.API_CONFIG.dev;
async submit(event) {
event.preventDefault();

View File

@@ -1,16 +0,0 @@
import { Controller } from '@hotwired/stimulus';
/*
* This is an example Stimulus controller!
*
* Any element with a data-controller="hello" attribute will cause
* this controller to be executed. The name "hello" comes from the filename:
* hello_controller.js -> "hello"
*
* Delete this file or adapt it for your use!
*/
export default class extends Controller {
connect() {
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
}
}

View File

@@ -0,0 +1,43 @@
import { Controller } from '@hotwired/stimulus';
import UI from '../ui.js';
import BIM from '../bim.js';
/*
* This is an example Stimulus controller!
*
* Any element with a data-controller="hello" attribute will cause
* this controller to be executed. The name "hello" comes from the filename:
* hello_controller.js -> "hello"
*
* Delete this file or adapt it for your use!
*/
export default class extends Controller {
static targets = ['scene'];
connect() {
}
/**
*
* @param {Element} container
*/
sceneTargetConnected(container) {
UI.setScene(container);
const model = UI.ifcLoader(container);
container.ondblclick = () => BIM.activateClipper();
container.onkeydown = event => {
console.log(event);
if (event.code === 'Delete' || event.code === 'Backspace') {
BIM.deleteClipper();
}
}
}
/**
*
* @param {Event} event
*/
keyboard(event) {
console.log(event);
}
}