refactor(ags): prioritise getters when using astal libs

This commit is contained in:
matt1432 2024-12-29 17:22:55 -05:00
parent 10b70583e0
commit 179e402504
30 changed files with 176 additions and 164 deletions
modules/ags/config/widgets/on-screen-keyboard

View file

@ -42,20 +42,20 @@ export default (window: OskWindow) => {
if (tablet.oskState) {
window.setSlideDown();
window.get_child().css = `
window.get_child().set_css(`
transition: margin-bottom ${ANIM_DURATION}ms cubic-bezier(0.36, 0, 0.66, -0.56);
margin-bottom: 0px;
`;
`);
}
else {
releaseAllKeys();
window.setSlideUp();
window.get_child().css = `
window.get_child().set_css(`
transition: margin-bottom ${ANIM_DURATION}ms cubic-bezier(0.36, 0, 0.66, -0.56);
margin-bottom: -${calculatedHeight}px;
`;
`);
}
});
@ -91,23 +91,23 @@ export default (window: OskWindow) => {
const offset = window.startY - currentY;
if (offset < 0) {
window.get_child().css = `
window.get_child().set_css(`
transition: margin-bottom 0.5s ease-in-out;
margin-bottom: -${calculatedHeight}px;
`;
`);
return;
}
if (offset > calculatedHeight) {
window.get_child().css = `
window.get_child().set_css(`
margin-bottom: 0px;
`;
`);
}
else {
window.get_child().css = `
window.get_child().set_css(`
margin-bottom: ${offset - calculatedHeight}px;
`;
`);
}
});
}),
@ -125,17 +125,17 @@ export default (window: OskWindow) => {
const offset = window.startY - currentY;
if (offset > calculatedHeight) {
window.get_child().css = `
window.get_child().set_css(`
transition: margin-bottom 0.5s ease-in-out;
margin-bottom: 0px;
`;
`);
tablet.oskState = true;
}
else {
window.get_child().css = `
window.get_child().set_css(`
transition: margin-bottom 0.5s ease-in-out;
margin-bottom: -${calculatedHeight}px;
`;
`);
}
window.startY = null;
@ -172,17 +172,17 @@ export default (window: OskWindow) => {
const offset = window.startY - currentY;
if (offset > 0) {
window.get_child().css = `
window.get_child().set_css(`
transition: margin-bottom 0.5s ease-in-out;
margin-bottom: 0px;
`;
`);
return;
}
window.get_child().css = `
window.get_child().set_css(`
margin-bottom: ${offset}px;
`;
`);
});
}),
);
@ -199,18 +199,18 @@ export default (window: OskWindow) => {
const offset = window.startY - currentY;
if (offset < -(calculatedHeight * 2 / 3)) {
window.get_child().css = `
window.get_child().set_css(`
transition: margin-bottom 0.5s ease-in-out;
margin-bottom: -${calculatedHeight}px;
`;
`);
tablet.oskState = false;
}
else {
window.get_child().css = `
window.get_child().set_css(`
transition: margin-bottom 0.5s ease-in-out;
margin-bottom: 0px;
`;
`);
}
window.startY = null;

View file

@ -148,9 +148,9 @@ const RegularKey = (key: Key) => {
self
.hook(Shift, () => {
if (key.labelShift) {
self.label = Shift.get() ?
self.set_label(Shift.get() ?
key.labelShift :
key.label;
key.label);
}
})
.hook(Caps, () => {
@ -161,18 +161,18 @@ const RegularKey = (key: Key) => {
}
if (key.labelShift && key.label.match(/[A-Za-z]/)) {
self.label = Caps.get() ?
self.set_label(Caps.get() ?
key.labelShift :
key.label;
key.label);
}
})
.hook(AltGr, () => {
if (key.labelAltGr) {
self.toggleClassName('altgr', AltGr.get());
self.label = AltGr.get() ?
self.set_label(AltGr.get() ?
key.labelAltGr :
key.label;
key.label);
}
});
}}