Fixed a bug that would prevent the workspace module from being scrolled. (#609)
This commit is contained in:
2
src/lib/types/bar.d.ts
vendored
2
src/lib/types/bar.d.ts
vendored
@@ -13,7 +13,7 @@ export type BarBoxChild = {
|
||||
isBox?: boolean;
|
||||
boxClass: string;
|
||||
tooltip_text?: string | Binding<string>;
|
||||
} & ({ isBox: true; props: Widget.BoxProps } | { isBox?: false; props: Widget.ButtonProps });
|
||||
} & ({ isBox: true; props: Widget.EventBoxProps } | { isBox?: false; props: Widget.ButtonProps });
|
||||
|
||||
export type SelfButton = Button<Child, Attribute>;
|
||||
|
||||
|
||||
@@ -399,7 +399,20 @@ export const isMiddleClick = (event: Astal.ClickEvent): boolean => event.button
|
||||
*
|
||||
* @returns True if the event is a scroll up, false otherwise.
|
||||
*/
|
||||
export const isScrollUp = (event: Astal.ScrollEvent): boolean => event.direction === Gdk.ScrollDirection.UP;
|
||||
export const isScrollUp = (event: Gdk.Event): boolean => {
|
||||
const [directionSuccess, direction] = event.get_scroll_direction();
|
||||
const [deltaSuccess, , yScroll] = event.get_scroll_deltas();
|
||||
|
||||
if (directionSuccess && direction === Gdk.ScrollDirection.UP) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (deltaSuccess && yScroll < 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if an event is a scroll down.
|
||||
@@ -410,4 +423,17 @@ export const isScrollUp = (event: Astal.ScrollEvent): boolean => event.direction
|
||||
*
|
||||
* @returns True if the event is a scroll down, false otherwise.
|
||||
*/
|
||||
export const isScrollDown = (event: Astal.ScrollEvent): boolean => event.direction === Gdk.ScrollDirection.DOWN;
|
||||
export const isScrollDown = (event: Gdk.Event): boolean => {
|
||||
const [directionSuccess, direction] = event.get_scroll_direction();
|
||||
const [deltaSuccess, , yScroll] = event.get_scroll_deltas();
|
||||
|
||||
if (directionSuccess && direction === Gdk.ScrollDirection.DOWN) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (deltaSuccess && yScroll > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user