Slider: tweaks to Slider.md documentation

master
thyttan 2023-10-03 00:43:32 +02:00
parent a238086266
commit 17f72c680e
1 changed files with 29 additions and 29 deletions

View File

@ -16,11 +16,11 @@ Bangle.on("drag", slider.f.dragSlider);
// Bangle.prependListener("drag", slider.f.dragSlider); // Bangle.prependListener("drag", slider.f.dragSlider);
``` ```
`callbackFunction` (first argument) determines what `slider` is used for. Should take two arguments, `mode` and `feedback`. The different modes/feedback combinations to expect are: `callbackFunction` (first argument) determines what `slider` is used for. `slider` will pass two arguments, `mode` and `feedback` into `callbackFunction` (if `slider` is interactive). The different `mode`/`feedback` combinations to expect are:
- "map", o.v.level | current level when interacting by mapping interface. - `"map", o.v.level` | current level when interacting by mapping interface.
- "incr", incr | where incr = +-1, when interacting by incrementing interface. - `"incr", incr` | where incr = +-1, when interacting by incrementing interface.
- "remove", o.v.level | last level when the slider times out. - `"remove", o.v.level` | last level when the slider times out.
- "auto" | on its own, when auto progressing. - `"auto"` | on its own, when auto progressing.
`configObject` (second argument, optional) has the following defaults: `configObject` (second argument, optional) has the following defaults:
@ -31,15 +31,15 @@ R = Bangle.appRect; // For use when determining defaults below.
useMap: false, // Use the mapping feature? useMap: false, // Use the mapping feature?
useIncr: true, // Use the incementing feature? useIncr: true, // Use the incementing feature?
horizontal: false, // Slider should be horizontal? horizontal: false, // Slider should be horizontal?
xStart:R.x2-R.w/4-4, // Leftmost x-coordinate. (Uppermost y-coordingat if horizontal) xStart: R.x2-R.w/4-4, // Leftmost x-coordinate. (Uppermost y-coordinate if horizontal)
width: R.w/4, // Width of the slider. (Height if horizontal) width: R.w/4, // Width of the slider. (Height if horizontal)
yStart: R.y+4, // Uppermost y-coordinate. (Rightmost x-coordinate if horizontal) yStart: R.y+4, // Uppermost y-coordinate. (Rightmost x-coordinate if horizontal)
height: R.h-10, // Height of the slider. (Width if horizontal) height: R.h-10, // Height of the slider. (Width if horizontal)
steps: 30, // Number of discrete steps of the slider. steps: 30, // Number of discrete steps of the slider.
oversizeR: 0, // Determines if the mapping area should be extend outside the indicator (Right/Up). oversizeR: 0, // Determines if the mapping area should be extend outside the indicator (Right/Up).
oversizeL: 0, // Determines if the mapping area should be extend outside the indicator (Left/Down). oversizeL: 0, // Determines if the mapping area should be extend outside the indicator (Left/Down).
timeout:1, // Second untill the slider times out. timeout: 1, // Seconds untill the slider times out.
colorFG:g.theme.fg2, // Forground color. colorFG: g.theme.fg2, // Foreground color.
colorBG: g.theme.bg2, // Background color. colorBG: g.theme.bg2, // Background color.
rounded: true, // Slider should have rounded corners? rounded: true, // Slider should have rounded corners?
propagateDrag: false, // Pass the drag event on down the handler chain? propagateDrag: false, // Pass the drag event on down the handler chain?
@ -49,11 +49,11 @@ innerBorderSize:2, // The distance between visual border and the slider.
drawableSlider: true, // Should supply the sliders standard drawing mechanism? drawableSlider: true, // Should supply the sliders standard drawing mechanism?
dragableSlider: true, // Should supply the sliders standard interaction mechanisms? dragableSlider: true, // Should supply the sliders standard interaction mechanisms?
currLevel: undefined, // The level to initate the slider with. currLevel: undefined, // The level to initate the slider with.
dragRect:R, // Accept input withing this rectangle. dragRect: R, // Accept input within this rectangle.
} }
``` ```
A slider initiated in the Web IDE terminal reveals its internals to a degree: A slider initiated in the Web IDE terminal window reveals its internals to a degree:
``` ```
>slider = require("Slider").create(()=>{}, {autoProgress:true}) >slider = require("Slider").create(()=>{}, {autoProgress:true})
={ ={