thyttan
0a1e3a6590
Slider: add initial comments
2023-10-17 22:49:32 +02:00
thyttan
186832faa4
Slider:make rounded mode dynamic, depend on width
...
Fixes graphics for different size sliders.
2023-10-17 22:49:32 +02:00
thyttan
b2a72dccc7
Slider: move let statement out of function scope
2023-10-17 22:49:32 +02:00
thyttan
9d532a82d9
Slider: fix callback running prematurely
2023-10-17 22:49:32 +02:00
thyttan
962d87442e
Slider: add `FIXME:` comment re error in callback
2023-10-17 22:49:32 +02:00
thyttan
ee5e08d8fe
Slider: add level to auto callback
2023-10-17 22:49:32 +02:00
thyttan
bbb2907a54
Slider:update `currLevel`->`initLevel`, and tweaks
2023-10-17 22:49:32 +02:00
thyttan
ac568fb332
Slider: change `currLevel` -> `initLevel`
2023-10-17 22:49:32 +02:00
thyttan
8cf9cd77bb
Slider: add tip to Slider.md, and tweaks
2023-10-17 22:49:32 +02:00
thyttan
070d3d4f1d
Slider: update Slider.md re mode:"incr"/"map"
2023-10-17 22:49:32 +02:00
thyttan
fae1025494
Slider: fix Slider.md code blocks
2023-10-17 22:49:32 +02:00
thyttan
9b882c24bd
Slider: refactor useIncr/Map -> mode:"incr"/"map"/
...
/"mapincr"
Thanks @bobrippling
2023-10-17 22:49:32 +02:00
thyttan
3afd9ac126
Slider: remove unnecessary var initialization
...
Co-authored-by: Rob Pilling <robpilling@gmail.com>
2023-10-17 22:49:32 +02:00
thyttan
3adb21d035
Slider: shorten conditional assignment logic
...
Co-authored-by: Rob Pilling <robpilling@gmail.com>
2023-10-17 22:49:32 +02:00
thyttan
40c205c042
Slider: callback first, then draw
...
as per: https://github.com/espruino/BangleApps/pull/2953#discussion_r1350097601
To still be able to draw on top of the slider, in the callback wrap the extra drawing inside a `setTimeout(extraDraw,0)` or similar.
Thanks @bobrippling!
2023-10-17 22:49:32 +02:00
thyttan
93112f40df
Slider: fix cbObj undefined
2023-10-17 22:49:32 +02:00
thyttan
01cf0fb202
Slider: disregard laziness on max/min levels
2023-10-17 22:49:32 +02:00
thyttan
bcb6e0ca01
Slider: ask what the screens height is
...
Should make this more likely to work on different size screens.
2023-10-17 22:49:32 +02:00
thyttan
408990d919
Slider:move draw and cb to deduplicate code
2023-10-17 22:49:32 +02:00
thyttan
944da80186
Slider: reorder default config values
2023-10-17 22:49:32 +02:00
thyttan
795fec654e
Slider: tweak documentation in slider.md
2023-10-17 22:49:32 +02:00
thyttan
a9562b844f
Slider:use actual current level for auto progress
2023-10-17 22:49:32 +02:00
thyttan
9b1cfd4836
Slider: `ebLast` and `dy` only needed with draging
2023-10-17 22:49:32 +02:00
thyttan
17f72c680e
Slider: tweaks to Slider.md documentation
2023-10-17 22:49:32 +02:00
thyttan
a238086266
Slider: Add some descriptive comments
2023-10-17 22:49:32 +02:00
thyttan
9c4fd1d94c
Slider: Add some documentation
2023-10-17 22:49:32 +02:00
thyttan
573fa3806c
Slider: remove some unused vars and consts
2023-10-17 22:49:32 +02:00
thyttan
ecd4a7ee0c
Slider: Assign empty function to cb if undefined
2023-10-17 22:49:32 +02:00
thyttan
0952ad9a26
Slider: refactor logic re auto progressing sliders
2023-10-17 22:49:32 +02:00
thyttan
98a6417008
Slider: move `let incr` into `while` scope
2023-10-17 22:49:32 +02:00
thyttan
2444e75628
Slider: small refactor to shorten code
2023-10-17 22:49:32 +02:00
thyttan
b9c5245ba0
Slider:tweak code re zero level on rounded sliders
2023-10-17 22:49:32 +02:00
thyttan
5657492cb4
Slider:move laziness from draw fun to drag handler
2023-10-17 22:49:31 +02:00
thyttan
8c4ad72d1d
Slider: fix map input for horizontal sliders
2023-10-17 22:49:31 +02:00
thyttan
6f4b87666a
Slider: fix level=0 on rounded horizontal sliders
2023-10-17 22:49:31 +02:00
thyttan
c2b2620268
Slider:map input acounts for size & pos of slider
...
... and also if the slider is rounded.
2023-10-17 22:49:31 +02:00
thyttan
d2f69df3bf
Slider: fix logic re rounded or not
2023-10-17 22:49:31 +02:00
thyttan
cd4e4abee2
Slider: refine drawing rounded sliders
...
So far only tested on a standard config width slider.
2023-10-17 22:49:31 +02:00
thyttan
52fe14fb32
Slider: set timeoutID to `undefined` on remove
...
... fixing interference with other timeouts where the same id was assigned to
another timeout that would be deleted erroneously. This was tracked down
because a timeout in the `spotrem` version being developed alongside
this slider module would stop executing code.
2023-10-17 22:49:31 +02:00
thyttan
eb00e69431
Slider: fix gh workflow error
...
... and fix some warnings from Espruino Web IDE
2023-10-17 22:49:31 +02:00
thyttan
31a6de6e3f
Slider: vim auto format - no functional change
2023-10-17 22:49:31 +02:00
thyttan
8e6b9c7308
Slider: add ability to limit drag area
...
... of the sliders drag handler.
2023-10-17 22:49:31 +02:00
thyttan
14dd20791f
Slider: fix dy not initialized for increment mode
2023-10-17 22:49:31 +02:00
thyttan
ef650f5359
Slider: list currLevel among the constants
2023-10-17 22:49:31 +02:00
thyttan
9e978b2c5b
Slider: change to only add required parts
...
... depending on how the slider is configured when initializing.
Assumed to reduce ram use, have not tested to see if it actually is an
improvement in rem use or general performance in practice.
2023-10-17 22:49:31 +02:00
thyttan
94074304dc
Slider: draw directly when starting auto update
...
... if the slider should be drawn. Otherwise will just keep track of
position to draw later.
2023-10-17 22:49:31 +02:00
thyttan
d157f51b50
Slider:add var containing the app to load on error
2023-10-17 22:49:31 +02:00
thyttan
5df5f56888
Slider: hide slider while still auto incrementing
2023-10-17 22:49:31 +02:00
thyttan
5b19330fee
Slider: option to set border size
2023-10-17 22:49:31 +02:00
thyttan
9f7b65892e
Slider: make drawing borders optional
2023-10-17 22:49:31 +02:00