Files
Unify/application/demo/application.js

183 lines
2.9 KiB
JavaScript
Raw Normal View History

2025-12-25 11:16:59 +01:00
import minimizeButton from './minimizeButton.js';
import leftSide from './leftSide/leftSide.js';
import rightSide from './rightSide/rightSide.js';
import document from '/unify/document.js';
import vector2 from '/unify/math/vector2.js';
import flexbox from '/elements/flexbox.js';
import frostedGlass from '/elements/window/frostedGlass.js';
import draggable from '/elements/window/draggable.js';
export default class application extends frostedGlass, flexbox, draggable{
// Children
minimizeButton = new minimizeButton();
leftSide = new leftSide();
rightSide = new rightSide();
// Environment
mode = "development"
os = "Windows";
device = "Pc";
tint = "Dark";
loadThemes = true;
maxClients = 1000;
cacheBuildSpeed = 4;
maxClusters = 1;
//serverAddress = "192.168.178.15";
// Styling
position = "absolute";
borderRadius = 12;
boxBackgroundSize = "1000px 1000px";
boxTransition = "background-image 0.1s ease-in-out";
boxHeight = "100vh";
position = "absolute";
#ifdef ANDROID
flexDirection = "column";
#else
flexDirection = "row";
#endif
// Pragma's
#ifdef ANDROID
lastPosition = new vector2( 0, 0 );
fontFamily = "android";
transform = "translate(0px, 0px)";
#endif
#ifdef WINDOWS
fontFamily = "SegoeUI";
#ifdef DARK
//boxBackgroundImage = "url('/assets/images/wallpapers/windows/light/2048.png')";
//backgroundImage = "url('/assets/images/wallpapers/windows/light/blur_1024.jpg')";
#endif
#ifdef LIGHT
//boxBackgroundImage = "url('/assets/images/wallpapers/windows/light/2048.jpg')";
//backgroundImage = "url('/assets/images/wallpapers/windows/light/blur_1024.jpg')";
#endif
border = "1px solid rgb(65 84 118 / 32%)";
#endif
#ifdef MACOS
fontFamily = "Inter";
#ifdef DARK
//boxBackgroundImage = "url('/assets/images/wallpapers/ventura/dark/dark.jpg')";
//backgroundImage = "url('/assets/images/wallpapers/ventura/dark/darkBlur.jpg')";
border = "1px solid #8f8f8f59";
outline = "1px solid black";
#endif
#ifdef LIGHT
//boxBackgroundImage = "url('/assets/images/wallpapers/ventura/light/light.jpg')";
//backgroundImage = "url('/assets/images/wallpapers/ventura/light/lightBlur.jpg')";
#endif
#endif
// Methods
afterLoad() {
console.log( "loaded application", this );
this.centerObject();
}
centerObject() {
var domWindow = document.defaultView;
this.windowHeight = domWindow.innerHeight;
this.windowWidth = domWindow.innerWidth;
var boundBox = this.defaultElement.getBoundingClientRect();
var width = boundBox.width;
var height = boundBox.height;
var x = this.windowWidth / 2 - ( width / 2 );
var y = this.windowHeight / 2 - ( height / 2 );
this.lastPosition = new vector2( Math.round( x ), Math.round( y ) );
}
click() {
this.boxShadow = "1px 1px 3px 0px #00000054"
}
}