Better windows box saving + expand-shrink back to previous
This commit is contained in:
@@ -7,6 +7,8 @@ class DashboardsController extends EICController {
|
||||
this.eventsMapping = app.Assets.Store.json.eventsMapping
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns
|
||||
@@ -30,11 +32,6 @@ class DashboardsController extends EICController {
|
||||
//TODO: eventsMapping: address child by suffix in assignations
|
||||
|
||||
|
||||
|
||||
let left = app.User.preferences?.windows?.live?.spaceview?.['3D']?.x ? app.User.preferences.windows.live.spaceview['3D'].x :100
|
||||
let top = app.User.preferences?.windows?.live?.spaceview?.['3D']?.y ? app.User.preferences.windows.live.spaceview['3D'].y :50
|
||||
let width = app.User.preferences?.windows?.live?.spaceview?.['3D']?.w ? app.User.preferences.windows.live.spaceview['3D'].w :600
|
||||
let height = app.User.preferences?.windows?.live?.spaceview?.['3D']?.h ? app.User.preferences.windows.live.spaceview['3D'].h :450
|
||||
this.loadWindow(
|
||||
'visualisers/SpaceView',
|
||||
{
|
||||
@@ -42,12 +39,7 @@ class DashboardsController extends EICController {
|
||||
static: true,
|
||||
expanded: false,
|
||||
withSettings: true,
|
||||
windowStyle:{
|
||||
width: `${width}px`,
|
||||
height: `${height}px`,
|
||||
left: `${left}px`,
|
||||
top: `${top}px`,
|
||||
}
|
||||
windowStyle: this._boxFromPrefs('live.spaceview.3D', { x: 50, y:100, w:600, h:400 }),
|
||||
},
|
||||
{
|
||||
models: models,
|
||||
@@ -58,10 +50,7 @@ class DashboardsController extends EICController {
|
||||
}
|
||||
)
|
||||
|
||||
left = app.User.preferences?.windows?.live?.spaceview?.['2D']?.x ? app.User.preferences.windows.live.spaceview['2D'].x :500
|
||||
top = app.User.preferences?.windows?.live?.spaceview?.['2D']?.y ? app.User.preferences.windows.live.spaceview['2D'].y :100
|
||||
width = app.User.preferences?.windows?.live?.spaceview?.['2D']?.w ? app.User.preferences.windows.live.spaceview['2D'].w :600
|
||||
height = app.User.preferences?.windows?.live?.spaceview?.['2D']?.h ? app.User.preferences.windows.live.spaceview['2D'].h :450
|
||||
|
||||
this.loadWindow(
|
||||
'visualisers/SpaceView',
|
||||
{
|
||||
@@ -69,12 +58,7 @@ class DashboardsController extends EICController {
|
||||
static: true,
|
||||
expanded: false,
|
||||
withSettings: true,
|
||||
windowStyle:{
|
||||
width: `${width}px`,
|
||||
height: `${height}px`,
|
||||
left: `${left}px`,
|
||||
top: `${top}px`,
|
||||
}
|
||||
windowStyle: this._boxFromPrefs('live.spaceview.2D', { x: 500, y:100, w:600, h:400 }),
|
||||
},
|
||||
{
|
||||
models: models,
|
||||
@@ -85,6 +69,27 @@ class DashboardsController extends EICController {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
_boxFromPrefs(viewName, defaults){
|
||||
function getPref(path) {
|
||||
return path.split('.').reduce(
|
||||
(acc, key) => acc?.[key],
|
||||
app.User.preferences.windows
|
||||
)
|
||||
}
|
||||
const box = getPref(viewName)
|
||||
console.log('====>',box, 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('DashboardsController', DashboardsController);
|
||||
Reference in New Issue
Block a user