Slider: vim auto format - no functional change

master
thyttan 2023-09-20 20:07:25 +02:00
parent 8e6b9c7308
commit 31a6de6e3f
1 changed files with 173 additions and 173 deletions

View File

@ -1,16 +1,16 @@
try { // for making it possiblie to run the test app in the following catch statement. It would complain on `exports` not being defined. try { // for making it possiblie to run the test app in the following catch statement. It would complain on `exports` not being defined.
exports.create = function(cb, conf) { exports.create = function(cb, conf) {
const R = Bangle.appRect; const R = Bangle.appRect;
let o = {}; let o = {};
o.v = {}; // variables go here. o.v = {}; // variables go here.
o.f = {}; // functions go here. o.f = {}; // functions go here.
// configuration for the indicator: // configuration for the indicator:
o.c = Object.assign({ // constants go here. o.c = Object.assign({ // constants go here.
useMap:false, useMap:false,
useIncr:true, useIncr:true,
horizontal:false, horizontal:false,
@ -35,18 +35,18 @@ o.c = Object.assign({ // constants go here.
dragableSlider:true, dragableSlider:true,
currLevel:undefined, currLevel:undefined,
dragRect:R, dragRect:R,
},conf); },conf);
let totalBorderSize = o.c.outerBorderSize + o.c.innerBorderSize; let totalBorderSize = o.c.outerBorderSize + o.c.innerBorderSize;
o.c._xStart = o.c.xStart + totalBorderSize; o.c._xStart = o.c.xStart + totalBorderSize;
o.c._width = o.c.width - 2*totalBorderSize; o.c._width = o.c.width - 2*totalBorderSize;
o.c._yStart = o.c.yStart + totalBorderSize; o.c._yStart = o.c.yStart + totalBorderSize;
o.c._height = o.c.height - 2*totalBorderSize; o.c._height = o.c.height - 2*totalBorderSize;
if (o.c.rounded) o.c.rounded = 40; if (o.c.rounded) o.c.rounded = 40;
o.c.STEP_SIZE = o.c._height/o.c.steps; o.c.STEP_SIZE = o.c._height/o.c.steps;
if (o.c.horizontal) { if (o.c.horizontal) {
let mediator = o.c._xStart; let mediator = o.c._xStart;
o.c._xStart = o.c._yStart; o.c._xStart = o.c._yStart;
o.c._yStart = mediator; o.c._yStart = mediator;
@ -61,18 +61,18 @@ if (o.c.horizontal) {
o.c.width = o.c.height; o.c.width = o.c.height;
o.c.height = mediator; o.c.height = mediator;
delete mediator; delete mediator;
} }
o.c.r = {x:o.c.xStart, y:o.c.yStart, x2:o.c.xStart+o.c.width, y2:o.c.yStart+o.c.height, w:o.c.width, h:o.c.height}; o.c.r = {x:o.c.xStart, y:o.c.yStart, x2:o.c.xStart+o.c.width, y2:o.c.yStart+o.c.height, w:o.c.width, h:o.c.height};
// Initialize the level // Initialize the level
o.v.level = (o.c.currLevel||o.c.currLevel===0)?o.c.currLevel:o.c.steps/2; o.v.level = (o.c.currLevel||o.c.currLevel===0)?o.c.currLevel:o.c.steps/2;
o.v.firstRun = true; o.v.firstRun = true;
o.v.ebLast = 0; o.v.ebLast = 0;
o.v.dy = 0; o.v.dy = 0;
if (o.c.dragableSlider) { if (o.c.dragableSlider) {
o.f.wasOnDragRect = (exFirst, eyFirst)=>{ o.f.wasOnDragRect = (exFirst, eyFirst)=>{
"ram"; "ram";
return exFirst>o.c.dragRect.x && exFirst<o.c.dragRect.x2 && eyFirst>o.c.dragRect.y && eyFirst<o.c.dragRect.y2; return exFirst>o.c.dragRect.x && exFirst<o.c.dragRect.x2 && eyFirst>o.c.dragRect.y && eyFirst<o.c.dragRect.y2;
@ -133,9 +133,9 @@ if (o.c.dragableSlider) {
o.v.dragActive = false; o.v.dragActive = false;
cb("remove", o.v.prevLevel); cb("remove", o.v.prevLevel);
}; };
} }
if (o.c.drawableSlider) { if (o.c.drawableSlider) {
o.f.updateBar = (levelHeight)=>{ o.f.updateBar = (levelHeight)=>{
"ram"; "ram";
@ -165,9 +165,9 @@ if (o.c.drawableSlider) {
//print(level); //print(level);
//print(process.memory().usage); //print(process.memory().usage);
}; };
} }
if (o.c.autoProgress) { if (o.c.autoProgress) {
o.v.shouldAutoDraw = true; o.v.shouldAutoDraw = true;
o.f.autoUpdate = ()=>{ o.f.autoUpdate = ()=>{
//if (o.v.level===undefined) o.v.level = -1; //if (o.v.level===undefined) o.v.level = -1;
@ -182,15 +182,15 @@ if (o.c.autoProgress) {
o.v.autoIntervalID = setInterval(o.f.autoUpdate,1000); o.v.autoIntervalID = setInterval(o.f.autoUpdate,1000);
}; };
o.f.stopAutoUpdate = ()=>{if (o.v.autoIntervalID) {clearInterval(o.v.autoIntervalID); o.v.autoIntervalID = undefined;}}; o.f.stopAutoUpdate = ()=>{if (o.v.autoIntervalID) {clearInterval(o.v.autoIntervalID); o.v.autoIntervalID = undefined;}};
} }
//o.f.printThis = ()=>(print(this)); //o.f.printThis = ()=>(print(this));
return o; return o;
} }
} catch (e) { } catch (e) {
print(e); print(e);
let appName = "spotrem"; let appName = "spotrem";
eval(require("Storage").read(appName+".app.js")); eval(require("Storage").read(appName+".app.js"));
} }