multixy: make non-snap mode work like other widget (you don't need to grab the handle directly); fix logscaleX|Y options
This commit is contained in:
parent
33e4e3f3c6
commit
6caa4d73c6
4 changed files with 7 additions and 23 deletions
|
|
@ -5,7 +5,7 @@
|
|||
- widgets
|
||||
- fader: display pips to `compact` mode when `range` has multiple breakpoints
|
||||
- pads: display pips when `range` has multiple breakpoints
|
||||
- multixy: style update (stroked dots, bold number font); `snap` option added.
|
||||
- multixy: style update (stroked dots, bold number font); `snap` option added; points are automtically assigned to touches as they come; fix `logScale(X|Y)` options.
|
||||
|
||||
## 0.11.1
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ Pads are multidimensional widgets that output multiple values.
|
|||
#### `snap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: by default, the points must be touched directy to be dragged; if set to `true`, touching anywhere on the widget's surface will assign the points to the touching fingers one by one.
|
||||
- usage: by default, the points are dragged from their initial position; if set to `true`, touching anywhere on the widget's surface will make them snap to the touching coordinates (one per touch).
|
||||
|
||||
----
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module.exports.options = {
|
|||
separator1:'multi xy',
|
||||
|
||||
points: 2,
|
||||
pointSize: 15,
|
||||
pointSize: 20,
|
||||
snap:false,
|
||||
|
||||
separator2:'style',
|
||||
|
|
@ -65,7 +65,8 @@ var MultiXy = module.exports.MultiXy = function(widgetData) {
|
|||
rangeX:widgetData.rangeX,
|
||||
rangeY:widgetData.rangeY,
|
||||
precision:widgetData.precision,
|
||||
logScale:widgetData.logScaleY
|
||||
logScaleX:widgetData.logScaleX,
|
||||
logScaleY:widgetData.logScaleY
|
||||
})
|
||||
this.pads[i].sendValue = ()=>{}
|
||||
this.pads[i].draw = ()=>{}
|
||||
|
|
@ -74,7 +75,6 @@ var MultiXy = module.exports.MultiXy = function(widgetData) {
|
|||
this.handles[i] = $(`<div class="handle">${i}</div>`)
|
||||
this.wrapper.append(this.handles[i])
|
||||
|
||||
if (this.widgetData.snap) {
|
||||
let pad = this.pads[i]
|
||||
pad.wrapper.on('draginit',(e)=>{
|
||||
pad.widget.addClass('active')
|
||||
|
|
@ -82,13 +82,9 @@ var MultiXy = module.exports.MultiXy = function(widgetData) {
|
|||
pad.wrapper.on('dragend',(e)=>{
|
||||
pad.widget.removeClass('active')
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (this.widgetData.snap) {
|
||||
this.wrapper.addClass('snap')
|
||||
}
|
||||
|
||||
this.value = []
|
||||
|
||||
|
|
@ -100,20 +96,12 @@ var MultiXy = module.exports.MultiXy = function(widgetData) {
|
|||
this.pads[i].widget.addClass('active')
|
||||
}
|
||||
this.pads[i].wrapper.trigger(e.type, [data, traversing])
|
||||
var v = this.pads[i].widget.getValue()
|
||||
if (v < [this.value[i*2], this.value[i*2+1]] || v > [this.value[i*2], this.value[i*2+1]]) {
|
||||
var n = this.widget.getValue()
|
||||
n[i] = v
|
||||
this.setValue(n, {sync:true,send:true, dragged:true})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
this.wrapper.on('sync',(e)=>{
|
||||
e.stopPropagation()
|
||||
if (this.widgetData.snap) {
|
||||
this.setValue(this.widget.getValue(), e.options)
|
||||
}
|
||||
this.setValue(this.widget.getValue(), e.options)
|
||||
})
|
||||
|
||||
this.widget.getValue = () => {
|
||||
|
|
|
|||
|
|
@ -121,9 +121,8 @@
|
|||
position: absolute;
|
||||
width:calc(100% - calc(var(--point-size) * 2 + 2rem));
|
||||
height:calc(100% - calc(var(--point-size) * 2 + 2rem));
|
||||
pointer-events: none;
|
||||
&.active {
|
||||
pointer-events: none!important;
|
||||
pointer-events: none;
|
||||
}
|
||||
.wrapper {
|
||||
background: transparent;
|
||||
|
|
@ -149,9 +148,6 @@
|
|||
opacity: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
&.snap > .pad {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue