QmlMaterial 0.1.0
Loading...
Searching...
No Matches
carousel_scroll_strategy.hpp
1#pragma once
2
3#include "qml_material/carousel/carousel_keylines.hpp"
4#include "qml_material/carousel/carousel_strategy.hpp"
5
6namespace qml_material
7{
8
9enum class HeroScrollZone
10{
11 Leading,
12 Middle,
13 TrailingLerp,
14 TrailingRest,
15};
16
17struct CarouselScrollStrategy
18{
19 KeylineList default_keylines;
20 QVector<KeylineList> start_steps;
21 QVector<KeylineList> end_steps;
22 qreal start_shift_distance = 0;
23 qreal end_shift_distance = 0;
24 bool hero_lerp = false;
25 bool keep_leading_peek = false;
26 qreal viewport_size = 0;
27
28 static auto build(const KeylineList& default_keylines, qreal carousel_main_axis_size) -> CarouselScrollStrategy;
29
30 static auto build(const CarouselLayoutInput& in, const KeylineList& default_keylines)
31 -> CarouselScrollStrategy;
32
33 static auto buildHero(const CarouselLayoutInput& in, bool keep_leading_peek,
34 const QVector<qreal>& snap_offsets, qreal max_scroll_offset)
35 -> CarouselScrollStrategy;
36
37 auto keylinesForScrollOffset(qreal scroll_offset, qreal max_scroll_offset, bool round_to_step = false) const
38 -> KeylineList;
39
40 auto zoneFor(qreal scroll_offset, qreal keyline_max) const -> HeroScrollZone;
41};
42
43} // namespace qml_material