Add Project entity, user routes and clipper controls

This commit is contained in:
2025-03-31 16:25:31 +02:00
parent 4c0e212650
commit ce3b17b683
24 changed files with 2989 additions and 21 deletions

View File

@@ -0,0 +1,22 @@
import { Controller } from "@hotwired/stimulus"
import * as THREE from "three"
import BIM from '../bim.js';
export default class extends Controller {
static targets = ['hex'];
color(event) {
let color = event.target.value;
this.hexTarget.querySelector('span').textContent = color;
BIM.clipper.config.color = new THREE.Color(color);
}
size(event) {
BIM.clipper.config.size = event.target.value
}
deleteAll() {
BIM.clipper.deleteAll();
}
}

View File

@@ -0,0 +1,26 @@
import { Controller } from '@hotwired/stimulus';
/**
* Activate a dropdown menu and toggle icon
* [template: data_entry.html.twig]
*/
export default class extends Controller {
static targets = ['drop', 'caret'];
toggle() {
// Show / hide dropdown
this.dropTarget.classList.toggle('is-active');
const caretTarget = this.caretTarget;
const caretState = caretTarget.className.includes('down') ? 'down' : 'up';
const caretAction = {
'down': function(target) {
target.className = target.className.replace('down', 'up');
},
'up': function(target) {
target.className = target.className.replace('up', 'down');
}
};
caretAction[caretState](this.caretTarget);
}
}