boxfromprefs outta the way

This commit is contained in:
STEINNI
2025-10-13 20:52:24 +00:00
parent d727679919
commit 8005e31931
4 changed files with 25 additions and 5 deletions
+1
View File
@@ -371,6 +371,7 @@ class EICController extends Controller {
static resize() {
Controller._contents.forEach(item => item.view.DOMContentResized())
}
}
app.registerClass('EICController', EICController);
+20 -1
View File
@@ -262,7 +262,26 @@ class EICDomContent extends View {
let device = limits.find(item => item.min < bounds.width);
this.el.setAttribute('device', device ? device.name: limits[0].name);
}
static boxFromPrefs(viewName, defaults){
function getPref(path) {
return path.split('.').reduce(
(acc, key) => acc?.[key],
app.User.preferences.windows
)
}
const box = getPref(viewName)
let left = box.x ? box.x : defaults.x
let top = box.y ? box.y : defaults.y
let width = box.w ? box.w : defaults.w
let height = box.x ? box.h : defaults.h
return({
width: `${width}px`,
height: `${height}px`,
left: `${left}px`,
top: `${top}px`,
})
}
}
app.registerClass('EICDomContent', EICDomContent);