parent
14dd20791f
commit
8e6b9c7308
|
|
@ -34,6 +34,7 @@ o.c = Object.assign({ // constants go here.
|
||||||
drawableSlider:true,
|
drawableSlider:true,
|
||||||
dragableSlider:true,
|
dragableSlider:true,
|
||||||
currLevel:undefined,
|
currLevel:undefined,
|
||||||
|
dragRect:R,
|
||||||
},conf);
|
},conf);
|
||||||
|
|
||||||
let totalBorderSize = o.c.outerBorderSize + o.c.innerBorderSize;
|
let totalBorderSize = o.c.outerBorderSize + o.c.innerBorderSize;
|
||||||
|
|
@ -72,6 +73,11 @@ 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)=>{
|
||||||
|
"ram";
|
||||||
|
return exFirst>o.c.dragRect.x && exFirst<o.c.dragRect.x2 && eyFirst>o.c.dragRect.y && eyFirst<o.c.dragRect.y2;
|
||||||
|
};
|
||||||
|
|
||||||
o.f.wasOnIndicator = (exFirst)=>{
|
o.f.wasOnIndicator = (exFirst)=>{
|
||||||
"ram";
|
"ram";
|
||||||
if (!o.c.horizontal) return exFirst>o.c._xStart-o.c.oversizeL*o.c._width && exFirst<o.c._xStart+o.c._width+o.c.oversizeR*o.c._width;
|
if (!o.c.horizontal) return exFirst>o.c._xStart-o.c.oversizeL*o.c._width && exFirst<o.c._xStart+o.c._width+o.c.oversizeR*o.c._width;
|
||||||
|
|
@ -80,6 +86,12 @@ if (o.c.dragableSlider) {
|
||||||
|
|
||||||
o.f.dragSlider = e=>{
|
o.f.dragSlider = e=>{
|
||||||
"ram";
|
"ram";
|
||||||
|
if (o.v.ebLast==0) {
|
||||||
|
exFirst = o.c.horizontal?e.y:e.x;
|
||||||
|
eyFirst = o.c.horizontal?e.x:e.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (o.f.wasOnDragRect(exFirst, eyFirst)) {
|
||||||
o.v.dragActive = true;
|
o.v.dragActive = true;
|
||||||
if (!o.c.propagateDrag) E.stopEventPropagation&&E.stopEventPropagation();
|
if (!o.c.propagateDrag) E.stopEventPropagation&&E.stopEventPropagation();
|
||||||
|
|
||||||
|
|
@ -89,8 +101,6 @@ if (o.c.dragableSlider) {
|
||||||
let input = Math.min(o.c.horizontal?175-e.x:e.y, 170);
|
let input = Math.min(o.c.horizontal?175-e.x:e.y, 170);
|
||||||
input = Math.round(input/o.c.STEP_SIZE);
|
input = Math.round(input/o.c.STEP_SIZE);
|
||||||
|
|
||||||
if (o.v.ebLast==0) exFirst = o.c.horizontal?e.y:e.x;
|
|
||||||
|
|
||||||
if (o.c.useMap && o.f.wasOnIndicator(exFirst)) { // If draging starts on the indicator, adjust one-to-one.
|
if (o.c.useMap && o.f.wasOnIndicator(exFirst)) { // If draging starts on the indicator, adjust one-to-one.
|
||||||
|
|
||||||
o.v.level = Math.min(Math.max(o.c.steps-input,0),o.c.steps);
|
o.v.level = Math.min(Math.max(o.c.steps-input,0),o.c.steps);
|
||||||
|
|
@ -116,6 +126,7 @@ if (o.c.dragableSlider) {
|
||||||
}
|
}
|
||||||
o.v.ebLast = e.b;
|
o.v.ebLast = e.b;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
o.f.remove = ()=> {
|
o.f.remove = ()=> {
|
||||||
Bangle.removeListener('drag', o.f.dragSlider);
|
Bangle.removeListener('drag', o.f.dragSlider);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue