mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-09-18 09:54:36 -04:00
Keep the scroll target types and wheelScroll file-private
ScrollTarget and ScrollTargets are only named inside Element.zig; callers switch on the result or call scrollBy through it. wheelScroll has one caller, wheel, in the same file.
This commit is contained in:
1 parent
2cc537fc8c
commit
c2e4d13730
2 files changed
+3
-3
No files matched your search
@@ -325,7 +325,7 @@ pub fn wheel(frame: *Frame, target: *Element, x: f64, y: f64, delta_x: f64, delt
|
||||
/// Each axis scrolls the nearest ancestor-or-self scroll container along it,
|
||||
/// else the viewport. Relative deltas may land on different scrollers per
|
||||
/// axis, unlike an absolute position.
|
||||
pub fn wheelScroll(target: *Element, delta_x: i32, delta_y: i32, frame: *Frame) !void {
|
||||
fn wheelScroll(target: *Element, delta_x: i32, delta_y: i32, frame: *Frame) !void {
|
||||
const targets = target.scrollContainers(.{ .x = delta_x != 0, .y = delta_y != 0 }, frame);
|
||||
// A zero delta resolves to .viewport and scrolls it by nothing.
|
||||
try targets.x.scrollBy(delta_x, 0, frame);
|
||||
|
||||
@@ -1611,7 +1611,7 @@ pub const ScrollAxes = struct { x: bool = false, y: bool = false };
|
||||
|
||||
/// What a scroll along one axis lands on. html and body scroll the viewport,
|
||||
/// and so does a detached element.
|
||||
pub const ScrollTarget = union(enum) {
|
||||
const ScrollTarget = union(enum) {
|
||||
viewport,
|
||||
container: *Element,
|
||||
|
||||
@@ -1624,7 +1624,7 @@ pub const ScrollTarget = union(enum) {
|
||||
}
|
||||
};
|
||||
|
||||
pub const ScrollTargets = struct {
|
||||
const ScrollTargets = struct {
|
||||
x: ScrollTarget = .viewport,
|
||||
y: ScrollTarget = .viewport,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user