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 KeylineList default_keylines;
19 QVector<KeylineList> start_steps;
20 QVector<KeylineList> end_steps;
21 qreal start_shift_distance = 0;
22 qreal end_shift_distance = 0;
23 bool hero_lerp = false;
24 bool keep_leading_peek = false;
25 qreal viewport_size = 0;
26
27 static auto build(const KeylineList& default_keylines, qreal carousel_main_axis_size)
28 -> 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,
38 bool round_to_step = false) const -> KeylineList;
39
40 auto zoneFor(qreal scroll_offset, qreal keyline_max) const -> HeroScrollZone;
41};
42
43} // namespace qml_material