parent
14dd20791f
commit
8e6b9c7308
|
|
@ -34,6 +34,7 @@ o.c = Object.assign({ // constants go here.
|
|||
drawableSlider:true,
|
||||
dragableSlider:true,
|
||||
currLevel:undefined,
|
||||
dragRect:R,
|
||||
},conf);
|
||||
|
||||
let totalBorderSize = o.c.outerBorderSize + o.c.innerBorderSize;
|
||||
|
|
@ -72,6 +73,11 @@ o.v.ebLast = 0;
|
|||
o.v.dy = 0;
|
||||
|
||||
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)=>{
|
||||
"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;
|
||||
|
|
@ -80,6 +86,12 @@ if (o.c.dragableSlider) {
|
|||
|
||||
o.f.dragSlider = e=>{
|
||||
"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;
|
||||
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);
|
||||
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.
|
||||
|
||||
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.f.remove = ()=> {
|
||||
Bangle.removeListener('drag', o.f.dragSlider);
|
||||
|
|
|
|||
Loading…
Reference in New Issue