forked from Blendman974/faceclaw
Borderless modes have different padding inside the builtin apps
Most of the builtin apps had some padding between the window edge and their content, because they expect to be displayed with a line border on their edge. We added a customization option to remove the border, so, that padding is not always necessary. Make the layouts dynamically adjust, to omit the padding when it isn't needed.
This commit is contained in:
1 parent
e158452ba4
commit
a02b849200
115 files changed
+3600
-1583
No files matched your search
@@ -50,6 +50,7 @@ test('later opaque planes add an occlusion to a replayed selection',()=>{
|
||||
});
|
||||
|
||||
const {LayerStack,noopLayerActions}=load('app/ui/layers.ts',{
|
||||
'./viewport':require('../.test-build/app/ui/viewport.js'),
|
||||
'../graphics/image':graphics,'../graphics/plane':planes,'../native/frame-timings':{spanCurrent:(_name,fn)=>fn()},'../graphics/screen-size':{screenWidth:()=>640,screenHeight:()=>480},'./gestures':{},
|
||||
});
|
||||
test('context menu surface and selected row both use +4 without changing the app screen',()=>{
|
||||
@@ -121,7 +122,9 @@ test('unselected sidebar icons retain -2 depth through shell cropping, including
|
||||
});
|
||||
test('shell modal carries its inner menu highlight animation instead of baking its first frame',async()=>{
|
||||
const {ShellModalLayer}=load('app/ui/shell/modal-layer.ts',{
|
||||
'../viewport':require('../.test-build/app/ui/viewport.js'),
|
||||
'../../graphics/image':graphics,'../../graphics/plane':planes,'../gestures':{},'../layers':load('app/ui/layers.ts',{
|
||||
'./viewport':require('../.test-build/app/ui/viewport.js'),
|
||||
'../graphics/image':graphics,'../graphics/plane':planes,'../native/frame-timings':{spanCurrent:(_name,fn)=>fn()},'../graphics/screen-size':{screenWidth:()=>640,screenHeight:()=>480},
|
||||
'./gestures':{isDirectionalInput:()=>false},
|
||||
}),
|
||||
@@ -147,6 +150,7 @@ test('a stack without its own size follows the screen when the glasses type chan
|
||||
// RayNeo iO must not leave its overlays painting on a 540x220 canvas.
|
||||
const screen={width:540,height:220};
|
||||
const {LayerStack}=load('app/ui/layers.ts',{
|
||||
'./viewport':require('../.test-build/app/ui/viewport.js'),
|
||||
'../graphics/image':graphics,'../graphics/plane':planes,'../native/frame-timings':{spanCurrent:(_name,fn)=>fn()},
|
||||
'../graphics/screen-size':{screenWidth:()=>screen.width,screenHeight:()=>screen.height},'./gestures':{},
|
||||
});
|
||||
@@ -156,10 +160,18 @@ test('a stack without its own size follows the screen when the glasses type chan
|
||||
const sizes=()=>JSON.parse(JSON.stringify(stack.paint().map(p=>[p.image.width,p.image.height])));
|
||||
assert.deepEqual(sizes(),[[540,220],[540,220]]);
|
||||
screen.width=640;screen.height=480;
|
||||
assert.deepEqual({...stack.getBaseSize()},{width:640,height:480});
|
||||
const plain=value=>JSON.parse(JSON.stringify(value));
|
||||
const unbordered={edges:{top:'offscreen',right:'offscreen',bottom:'offscreen',left:'offscreen'},padding:{top:0,right:0,bottom:0,left:0}};
|
||||
assert.deepEqual(plain(stack.getBaseSize()),{width:640,height:480,...unbordered});
|
||||
assert.deepEqual(sizes(),[[640,480],[640,480]]);
|
||||
// An explicit size (a window's viewport, the modal's interior) stays put.
|
||||
// An explicit size (a window's viewport, the modal's interior) stays put;
|
||||
// given bare, nothing borders it, so it suggests no padding.
|
||||
const sized=new LayerStack({paint:()=>new graphics.GrayImage(100,90,0)},noopLayerActions,{width:100,height:90});
|
||||
screen.width=540;screen.height=220;
|
||||
assert.deepEqual({...sized.getBaseSize()},{width:100,height:90});
|
||||
assert.deepEqual(plain(sized.getBaseSize()),{width:100,height:90,...unbordered});
|
||||
// A host that says what its edges touch hands layers the padding for them.
|
||||
const viewport=require('../.test-build/app/ui/viewport.js');
|
||||
const edges={top:'border',right:'offscreen',bottom:'offscreen',left:'border'};
|
||||
sized.setBaseSize(viewport.viewportWith({width:100,height:90},edges));
|
||||
assert.deepEqual(plain(sized.getBaseSize()),{width:100,height:90,edges,padding:{top:8,right:0,bottom:0,left:8}});
|
||||
});
|
||||
Reference in new issue
Block a user