boxfromprefs outta the way
This commit is contained in:
@@ -38,7 +38,7 @@ class EditorsController extends EICController {
|
|||||||
static: true,
|
static: true,
|
||||||
expanded: false,
|
expanded: false,
|
||||||
withSettings: true,
|
withSettings: true,
|
||||||
windowStyle: this._boxFromPrefs('live.spaceview.3D', { x: 50, y:100, w:600, h:400 }),
|
windowStyle: EICDomContent.boxFromPrefs('live.spaceview.3D', { x: 50, y:100, w:600, h:400 }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
models: models,
|
models: models,
|
||||||
@@ -57,7 +57,7 @@ class EditorsController extends EICController {
|
|||||||
static: true,
|
static: true,
|
||||||
expanded: false,
|
expanded: false,
|
||||||
withSettings: true,
|
withSettings: true,
|
||||||
windowStyle: this._boxFromPrefs('live.spaceview.2D', { x: 500, y:100, w:600, h:400 }),
|
windowStyle: EICDomContent.boxFromPrefs('live.spaceview.2D', { x: 500, y:100, w:600, h:400 }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
models: models,
|
models: models,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class DashboardsController extends EICController {
|
|||||||
static: true,
|
static: true,
|
||||||
expanded: false,
|
expanded: false,
|
||||||
withSettings: true,
|
withSettings: true,
|
||||||
windowStyle: this._boxFromPrefs('live.spaceview.3D', { x: 50, y:100, w:600, h:400 }),
|
windowStyle: EICDomContent.boxFromPrefs('live.spaceview.3D', { x: 50, y:100, w:600, h:400 }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
models: models,
|
models: models,
|
||||||
@@ -62,7 +62,7 @@ class DashboardsController extends EICController {
|
|||||||
static: true,
|
static: true,
|
||||||
expanded: false,
|
expanded: false,
|
||||||
withSettings: true,
|
withSettings: true,
|
||||||
windowStyle: this._boxFromPrefs('live.spaceview.2D', { x: 500, y:100, w:600, h:400 }),
|
windowStyle: EICDomContent.boxFromPrefs('live.spaceview.2D', { x: 500, y:100, w:600, h:400 }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
models: models,
|
models: models,
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ class EICController extends Controller {
|
|||||||
static resize() {
|
static resize() {
|
||||||
Controller._contents.forEach(item => item.view.DOMContentResized())
|
Controller._contents.forEach(item => item.view.DOMContentResized())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.registerClass('EICController', EICController);
|
app.registerClass('EICController', EICController);
|
||||||
@@ -263,6 +263,25 @@ class EICDomContent extends View {
|
|||||||
this.el.setAttribute('device', device ? device.name: limits[0].name);
|
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);
|
app.registerClass('EICDomContent', EICDomContent);
|
||||||
Reference in New Issue
Block a user