event: rewrite drag handling without jquery 🎆
This commit is contained in:
parent
ed2f35d649
commit
c896b38b43
25 changed files with 822 additions and 741 deletions
27
src/browser/js/app/dom.js
Normal file
27
src/browser/js/app/dom.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
module.exports = {
|
||||
|
||||
dispatchEvent: function(element, name, data) {
|
||||
|
||||
var event = new CustomEvent(name, {
|
||||
detail: data,
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
|
||||
element.dispatchEvent(event)
|
||||
|
||||
},
|
||||
|
||||
addEventListener: function(element, events, listener, capture) {
|
||||
|
||||
var eventsAsObject = typeof events == 'string' ? events.split(' ') : events
|
||||
|
||||
for (var i in eventsAsObject) {
|
||||
|
||||
element.addEventListener(eventsAsObject[i], listener, capture)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,12 +4,6 @@ var Editor = class Editor {
|
|||
|
||||
constructor() {
|
||||
|
||||
$(document).ready(()=>{
|
||||
|
||||
init()
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
enable() {
|
||||
|
|
|
|||
|
|
@ -8,159 +8,157 @@ var {updateWidget, incrementWidget} = require('./data-workers'),
|
|||
|
||||
var menu = new ContextMenu()
|
||||
|
||||
var init = function(){
|
||||
var handleClick = function(event) {
|
||||
|
||||
$('body').off('.editor').on('fake-click fake-right-click',function(e,d){
|
||||
if (!EDITING) return
|
||||
|
||||
if (!EDITING) return
|
||||
menu.close()
|
||||
|
||||
menu.close()
|
||||
var eventData = event.detail,
|
||||
widget = widgetManager.getWidgetByElement(eventData.target, ':not(.not-editable)')
|
||||
|
||||
var widget = widgetManager.getWidgetByElement(e.target, ':not(.not-editable)')
|
||||
if (!widget) return
|
||||
|
||||
if (!widget) return
|
||||
var container = widget.container,
|
||||
parent = widget.parentNode,
|
||||
index = container.index(),
|
||||
data = widget.props,
|
||||
type = widget.props.type == 'tab' ? 'tab' : 'widget'
|
||||
|
||||
var container = widget.container,
|
||||
parent = widget.parentNode,
|
||||
index = container.index(),
|
||||
data = widget.props,
|
||||
type = widget.props.type == 'tab' ? 'tab' : 'widget'
|
||||
editObject(widget)
|
||||
|
||||
editObject(widget)
|
||||
if (event.type!='fake-right-click') return
|
||||
|
||||
if (e.type!='fake-right-click') return
|
||||
|
||||
if (container.hasClass('root-container')) {
|
||||
menu.open(d,{
|
||||
'<i class="fa fa-plus"></i> Add tab': function(){
|
||||
data.tabs.push({})
|
||||
updateWidget(widget)
|
||||
}
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var actions = {},
|
||||
clickX = Math.round((d.offsetX + d.target.scrollLeft) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH,
|
||||
clickY = Math.round((d.offsetY + d.target.scrollTop) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH
|
||||
|
||||
if (parent.hasClass('panel')) {
|
||||
actions['<i class="fa fa-object-group"></i> Edit parent'] = function(){parent.trigger('fake-click')}
|
||||
}
|
||||
|
||||
if (type=='widget') actions['<i class="fa fa-copy"></i> Copy'] = function(){CLIPBOARD=JSON.stringify(data)}
|
||||
|
||||
if (type=='widget') actions['<i class="fa fa-cut"></i> Cut'] = function(){
|
||||
CLIPBOARD=JSON.stringify(data)
|
||||
var parent = widget.parent,
|
||||
parentData = parent.props
|
||||
|
||||
parentData.widgets.splice(index,1)
|
||||
updateWidget(parent)
|
||||
}
|
||||
|
||||
if (((type=='widget' && widgets[data.type].defaults().widgets) || (type=='tab')) && (!data.tabs||!data.tabs.length)) {
|
||||
|
||||
if (CLIPBOARD!=null) {
|
||||
actions['<i class="fa fa-paste"></i> Paste'] = {
|
||||
'<i class="fa fa-plus-circle"></i> ID + 1':function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = incrementWidget(JSON.parse(CLIPBOARD))
|
||||
|
||||
|
||||
if (!$(e.target).hasClass('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
} else {
|
||||
delete newData.top
|
||||
delete newData.left
|
||||
}
|
||||
|
||||
data.widgets.push(newData)
|
||||
updateWidget(widget)
|
||||
},
|
||||
'<i class="fa fa-clone"></i> Clone':function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = JSON.parse(CLIPBOARD)
|
||||
if (!$(e.target).hasClass('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
} else {
|
||||
delete newData.top
|
||||
delete newData.left
|
||||
}
|
||||
data.widgets.push(newData)
|
||||
updateWidget(widget)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions['<i class="fa fa-plus"></i> Add widget'] = {}
|
||||
for (let category in categories) {
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][category] = {}
|
||||
for (let t in categories[category]) {
|
||||
let wtype = categories[category][t]
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][category][wtype] = function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = {type:wtype}
|
||||
if (!$(e.target).hasClass('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
}
|
||||
data.widgets.push(newData)
|
||||
updateWidget(widget)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (((type=='widget' && widgets[data.type].defaults().tabs) || (type=='tab')) && (!data.widgets||!data.widgets.length)) {
|
||||
|
||||
actions['<i class="fa fa-plus"></i> Add tab'] = function(){
|
||||
data.tabs = data.tabs || []
|
||||
if (container.hasClass('root-container')) {
|
||||
menu.open(eventData,{
|
||||
'<i class="fa fa-plus"></i> Add tab': function(){
|
||||
data.tabs.push({})
|
||||
updateWidget(widget)
|
||||
}
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var actions = {},
|
||||
clickX = Math.round((eventData.offsetX + eventData.target.scrollLeft) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH,
|
||||
clickY = Math.round((eventData.offsetY + eventData.target.scrollTop) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH
|
||||
|
||||
if (parent.hasClass('panel')) {
|
||||
actions['<i class="fa fa-object-group"></i> Edit parent'] = function(){parent.trigger('fake-click')}
|
||||
}
|
||||
|
||||
if (type=='widget') actions['<i class="fa fa-copy"></i> Copy'] = function(){CLIPBOARD=JSON.stringify(data)}
|
||||
|
||||
if (type=='widget') actions['<i class="fa fa-cut"></i> Cut'] = function(){
|
||||
CLIPBOARD=JSON.stringify(data)
|
||||
var parent = widget.parent,
|
||||
parentData = parent.props
|
||||
|
||||
parentData.widgets.splice(index,1)
|
||||
updateWidget(parent)
|
||||
}
|
||||
|
||||
if (((type=='widget' && widgets[data.type].defaults().widgets) || (type=='tab')) && (!data.tabs||!data.tabs.length)) {
|
||||
|
||||
if (CLIPBOARD!=null) {
|
||||
actions['<i class="fa fa-paste"></i> Paste'] = {
|
||||
'<i class="fa fa-plus-circle"></i> ID + 1':function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = incrementWidget(JSON.parse(CLIPBOARD))
|
||||
|
||||
|
||||
if (!$(eventData.target).hasClass('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
} else {
|
||||
delete newData.top
|
||||
delete newData.left
|
||||
}
|
||||
|
||||
data.widgets.push(newData)
|
||||
updateWidget(widget)
|
||||
},
|
||||
'<i class="fa fa-clone"></i> Clone':function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = JSON.parse(CLIPBOARD)
|
||||
if (!$(eventData.target).hasClass('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
} else {
|
||||
delete newData.top
|
||||
delete newData.left
|
||||
}
|
||||
data.widgets.push(newData)
|
||||
updateWidget(widget)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions['<i class="fa fa-trash"></i> Delete'] = function(){
|
||||
var popup = createPopup('Are you sure ?',`
|
||||
<div class="actions">
|
||||
<a class="btn warning confirm-delete">DELETE</a>
|
||||
<a class="btn cancel-delete">CANCEL</a>
|
||||
</div>
|
||||
`)
|
||||
$('.confirm-delete').click(function(){
|
||||
popup.close()
|
||||
var parent = widget.parent,
|
||||
parentData = parent.props
|
||||
|
||||
|
||||
if (widget.props.type != 'tab') {
|
||||
parentData.widgets.splice(index,1)
|
||||
} else {
|
||||
parentData.tabs.splice(index,1)
|
||||
actions['<i class="fa fa-plus"></i> Add widget'] = {}
|
||||
for (let category in categories) {
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][category] = {}
|
||||
for (let t in categories[category]) {
|
||||
let wtype = categories[category][t]
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][category][wtype] = function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = {type:wtype}
|
||||
if (!$(eventData.target).hasClass('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
}
|
||||
data.widgets.push(newData)
|
||||
updateWidget(widget)
|
||||
}
|
||||
|
||||
updateWidget(parent)
|
||||
})
|
||||
$('.cancel-delete').click(function(){
|
||||
popup.close()
|
||||
})
|
||||
$(document).on('keydown.popup', function(e){
|
||||
if (e.keyCode==13) $('.confirm-delete').click()
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
menu.open(d,actions)
|
||||
}
|
||||
if (((type=='widget' && widgets[data.type].defaults().tabs) || (type=='tab')) && (!data.widgets||!data.widgets.length)) {
|
||||
|
||||
})
|
||||
actions['<i class="fa fa-plus"></i> Add tab'] = function(){
|
||||
data.tabs = data.tabs || []
|
||||
data.tabs.push({})
|
||||
updateWidget(widget)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
actions['<i class="fa fa-trash"></i> Delete'] = function(){
|
||||
var popup = createPopup('Are you sure ?',`
|
||||
<div class="actions">
|
||||
<a class="btn warning confirm-delete">DELETE</a>
|
||||
<a class="btn cancel-delete">CANCEL</a>
|
||||
</div>
|
||||
`)
|
||||
$('.confirm-delete').click(function(){
|
||||
popup.close()
|
||||
var parent = widget.parent,
|
||||
parentData = parent.props
|
||||
|
||||
|
||||
if (widget.props.type != 'tab') {
|
||||
parentData.widgets.splice(index,1)
|
||||
} else {
|
||||
parentData.tabs.splice(index,1)
|
||||
}
|
||||
|
||||
updateWidget(parent)
|
||||
})
|
||||
$('.cancel-delete').click(function(){
|
||||
popup.close()
|
||||
})
|
||||
$(document).on('keydown.popup', function(e){
|
||||
if (e.keyCode==13) $('.confirm-delete').click()
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
menu.open(eventData, actions)
|
||||
|
||||
}
|
||||
|
||||
module.exports = init
|
||||
document.addEventListener('fake-right-click', handleClick)
|
||||
document.addEventListener('fake-click', handleClick)
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
var WolfyEventEmitter = require('wolfy87-eventemitter')
|
||||
|
||||
module.exports = class EventEmitter extends WolfyEventEmitter {
|
||||
|
||||
emitEvent(evt, args) {
|
||||
|
||||
super.emitEvent(evt, args)
|
||||
|
||||
if (args[0] && !args[0].stopPropagation) {
|
||||
if (this.parent) this.parent.emitEvent(evt, args)
|
||||
}
|
||||
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
49
src/browser/js/app/events/click.js
Normal file
49
src/browser/js/app/events/click.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
var {fix, getElementOffset} = require('./utils')
|
||||
|
||||
var longTouchTimer = false,
|
||||
clearLongTouchTimer = function() {
|
||||
if (longTouchTimer) {
|
||||
clearTimeout(longTouchTimer)
|
||||
longTouchTimer = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('contextmenu', ()=>{return false})
|
||||
|
||||
document.addEventListener('mousedown', (event)=>{
|
||||
|
||||
if (event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents) return
|
||||
if (event.button == 2) event.preventDefault()
|
||||
|
||||
var e = fix(event)
|
||||
|
||||
var name = event.button == 2 ? 'fake-right-click' : 'fake-click'
|
||||
|
||||
DOM.dispatchEvent(e.target, name, e)
|
||||
|
||||
})
|
||||
|
||||
document.addEventListener('touchstart', (event)=>{
|
||||
|
||||
var e = fix(event)
|
||||
|
||||
DOM.dispatchEvent(e.target, 'fake-click', e)
|
||||
|
||||
longTouchTimer = setTimeout(()=>{
|
||||
|
||||
var off = getElementOffset(e.target)
|
||||
|
||||
e.offsetX = e.pageX - off.left
|
||||
e.offsetY = e.pageY - off.top
|
||||
|
||||
DOM.dispatchEvent(e.target, 'fake-right-click', e)
|
||||
|
||||
clearLongTouchTimer()
|
||||
|
||||
}, 600)
|
||||
|
||||
})
|
||||
|
||||
|
||||
DOM.addEventListener(document, 'touchend touchmove', clearLongTouchTimer)
|
||||
256
src/browser/js/app/events/drag.js
Normal file
256
src/browser/js/app/events/drag.js
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
const {fix, normalizeEvent, resetEventOffset} = require('./utils')
|
||||
|
||||
var targets = {},
|
||||
previousPointers = {}
|
||||
|
||||
function pointerDownHandler(event) {
|
||||
|
||||
if (!event.multitouch) {
|
||||
for (var i in targets) {
|
||||
if (targets[i] == event.target) return
|
||||
}
|
||||
}
|
||||
|
||||
targets[event.pointerId] = event.target
|
||||
|
||||
normalizeEvent(event)
|
||||
|
||||
previousPointers[event.pointerId] = event
|
||||
|
||||
triggerWidgetEvent(targets[event.pointerId], 'draginit', event)
|
||||
|
||||
}
|
||||
|
||||
function pointerMoveHandler(event) {
|
||||
|
||||
normalizeEvent(event, previousPointers[event.pointerId])
|
||||
|
||||
if (event.traversing) {
|
||||
|
||||
var previousTarget = targets[event.pointerId],
|
||||
target = event instanceof Touch ?
|
||||
document.elementFromPoint(event.clientX, event.clientY)
|
||||
: event.target
|
||||
|
||||
if (target) target = target.closest('.drag-event')
|
||||
|
||||
if (target && event instanceof Touch) {
|
||||
resetEventOffset(event, target)
|
||||
}
|
||||
|
||||
if (previousTarget !== -1 && previousTarget !== target) {
|
||||
triggerWidgetEvent(previousTarget, 'dragend', event)
|
||||
}
|
||||
|
||||
targets[event.pointerId] = target
|
||||
|
||||
if (target) {
|
||||
if (event.traversingContainer.contains(target)) {
|
||||
triggerWidgetEvent(targets[event.pointerId], 'draginit', event)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
triggerWidgetEvent(targets[event.pointerId], 'drag', event)
|
||||
}
|
||||
|
||||
previousPointers[event.pointerId] = event
|
||||
|
||||
}
|
||||
|
||||
function pointerUpHandler(event) {
|
||||
|
||||
normalizeEvent(event, previousPointers[event.pointerId])
|
||||
|
||||
triggerWidgetEvent(targets[event.pointerId], 'dragend', event)
|
||||
|
||||
delete targets[event.pointerId]
|
||||
delete previousPointers[event.pointerId]
|
||||
|
||||
}
|
||||
|
||||
|
||||
function triggerWidgetEvent(target, name, event) {
|
||||
if (target !== null && target._widget) {
|
||||
target._widget.trigger(name, [event])
|
||||
} else if (target !== null) {
|
||||
triggerWidgetEvent(target.closest('.drag-event'), name, event)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Move / Up handlers
|
||||
|
||||
function capturedMoveHandler(event) {
|
||||
|
||||
if (targets[event.pointerId] !== undefined) {
|
||||
pointerMoveHandler.call(targets[event.pointerId], event)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function capturedUpHandler(event) {
|
||||
|
||||
if (targets[event.pointerId] !== undefined) {
|
||||
pointerUpHandler.call(targets[event.pointerId], event)
|
||||
delete targets[event.pointerId]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Mouse events wrappers
|
||||
|
||||
function mouseDownHandler(event) {
|
||||
if ((event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents) || event.button == 2) return
|
||||
event.pointerId = 'mouse'
|
||||
pointerDownHandler(event)
|
||||
}
|
||||
|
||||
function mouseMultiWrapper(event) {
|
||||
event.multitouch = true
|
||||
mouseDownHandler(event)
|
||||
}
|
||||
|
||||
document.addEventListener('mousemove', (event)=>{
|
||||
event.pointerId = 'mouse'
|
||||
event.inertia = event.ctrlKey ? 10 : 1
|
||||
capturedMoveHandler(event)
|
||||
}, true)
|
||||
|
||||
document.addEventListener('mouseup', (event)=>{
|
||||
if ((event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents) || event.button == 2) return
|
||||
event.pointerId = 'mouse'
|
||||
capturedUpHandler(event)
|
||||
}, true)
|
||||
|
||||
|
||||
// Touch events wrappers
|
||||
|
||||
function touchDownHandler(event) {
|
||||
for (var i in event.changedTouches) {
|
||||
if (isNaN(i) || !event.changedTouches[i]) continue
|
||||
var touchEvent = event.changedTouches[i]
|
||||
|
||||
if (event.traversing) {
|
||||
touchEvent.traversing = event.traversing
|
||||
touchEvent.traversingContainer = event.traversingContainer
|
||||
}
|
||||
|
||||
touchEvent.pointerId = touchEvent.identifier
|
||||
pointerDownHandler(touchEvent)
|
||||
}
|
||||
}
|
||||
|
||||
function touchMultiWrapper(event) {
|
||||
event.multitouch = true
|
||||
touchDownHandler(event)
|
||||
}
|
||||
|
||||
document.addEventListener('touchmove', (event)=>{
|
||||
for (var i in event.changedTouches) {
|
||||
if (isNaN(i) || !event.changedTouches[i]) continue
|
||||
var touchEvent = event.changedTouches[i]
|
||||
|
||||
var fingers = 0
|
||||
for (var j in event.touches) {
|
||||
if (event.touches[j].target && event.touches[j].target.isSameNode(touchEvent.target)) {
|
||||
fingers += 1
|
||||
if (fingers == 2) {
|
||||
touchEvent.inertia = 10
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
touchEvent.pointerId = touchEvent.identifier
|
||||
capturedMoveHandler(touchEvent)
|
||||
}
|
||||
}, true)
|
||||
|
||||
document.addEventListener('touchend', (event)=>{
|
||||
for (var i in event.changedTouches) {
|
||||
if (isNaN(i) || !event.changedTouches[i]) continue
|
||||
var touchEvent = event.changedTouches[i]
|
||||
touchEvent.pointerId = touchEvent.identifier
|
||||
capturedUpHandler(touchEvent)
|
||||
}
|
||||
}, true)
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
setup: function(options) {
|
||||
|
||||
if (
|
||||
this._customBindings['drag'].bindings !== 0 ||
|
||||
this._customBindings['draginit'].bindings !== 0 ||
|
||||
this._customBindings['dragend'].bindings !== 0 ||
|
||||
!options
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
var {element, multitouch} = options
|
||||
|
||||
element._widget = this
|
||||
element.style.touchAction = 'none'
|
||||
element.classList.add('drag-event')
|
||||
|
||||
if (multitouch) {
|
||||
element.addEventListener('touchstart', touchMultiWrapper)
|
||||
element.addEventListener('mousedown', mouseMultiWrapper)
|
||||
} else {
|
||||
element.addEventListener('touchstart', touchDownHandler)
|
||||
element.addEventListener('mousedown', mouseDownHandler)
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
teardown: function(options) {
|
||||
|
||||
if (
|
||||
this._customBindings['drag'].bindings !== 0 ||
|
||||
this._customBindings['draginit'].bindings !== 0 ||
|
||||
this._customBindings['dragend'].bindings !== 0 ||
|
||||
!options
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$.fn.enableTraversingGestures = function(options={}) {
|
||||
|
||||
var self = this[0]
|
||||
|
||||
var makeEventTraversing = function(e){
|
||||
if (e.ctrlKey && options.ctrlKeyCancel) return
|
||||
e.traversing=true
|
||||
if (!e.traversingContainer) e.traversingContainer = self
|
||||
}
|
||||
|
||||
self.addEventListener("mousedown", makeEventTraversing, true)
|
||||
self.addEventListener("touchstart", makeEventTraversing, true)
|
||||
|
||||
this.on('disableTraversingGestures',()=>{
|
||||
self.removeEventListener("mousedown", makeEventTraversing, true)
|
||||
self.removeEventListener("touchstart", makeEventTraversing, true)
|
||||
})
|
||||
|
||||
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
$.fn.disableTraversingGestures = function() {
|
||||
|
||||
this.trigger('disableTraversingGestures')
|
||||
|
||||
}
|
||||
94
src/browser/js/app/events/event-emitter.js
Normal file
94
src/browser/js/app/events/event-emitter.js
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
var WolfyEventEmitter = require('wolfy87-eventemitter'),
|
||||
customEvents = {}
|
||||
|
||||
customEvents['draginit'] = customEvents['drag'] = customEvents['dragend'] = require('./drag')
|
||||
|
||||
module.exports = class EventEmitter extends WolfyEventEmitter {
|
||||
|
||||
constructor() {
|
||||
|
||||
super()
|
||||
|
||||
this._customBindings = {}
|
||||
|
||||
for (var evt in customEvents) {
|
||||
this._customBindings[evt] = {
|
||||
bindings: 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
emitEvent(evt, args) {
|
||||
|
||||
// Event bubbling
|
||||
|
||||
super.emitEvent(evt, args)
|
||||
|
||||
if (args[0] && !args[0].stopPropagation) {
|
||||
if (this.parent) this.parent.emitEvent(evt, args)
|
||||
}
|
||||
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
addListener(evt, listener, options) {
|
||||
|
||||
// Custom event setup
|
||||
|
||||
var eventName = typeof evt == 'string' ? evt.split('.')[0] : ''
|
||||
|
||||
if (
|
||||
customEvents.hasOwnProperty(eventName) &&
|
||||
typeof customEvents[eventName].setup === 'function'
|
||||
) {
|
||||
if (this._customBindings[eventName].bindings === 0) {
|
||||
this._customBindings[eventName].options = options
|
||||
customEvents[eventName].setup.call(this, options)
|
||||
}
|
||||
this._customBindings[eventName].bindings += 1
|
||||
}
|
||||
|
||||
super.addListener(evt, listener)
|
||||
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
removeListener(evt, listener) {
|
||||
|
||||
// Custom event teardown
|
||||
|
||||
var eventName = typeof evt == 'string' ? evt.split('.')[0] : ''
|
||||
|
||||
if (
|
||||
customEvents.hasOwnProperty(eventName) &&
|
||||
typeof customEvents[eventName].teardown === 'function' &&
|
||||
this._customBindings[eventName].bindings !== 0
|
||||
) {
|
||||
this._customBindings[eventName].bindings -= 1
|
||||
if (this._customBindings[eventName].bindings === 0 || !listener) {
|
||||
var options = this._customBindings[eventName].options
|
||||
customEvents[eventName].teardown.call(this, options)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all listeners is none specified
|
||||
|
||||
if (listener) {
|
||||
|
||||
super.removeListener(evt, listener)
|
||||
|
||||
} else {
|
||||
|
||||
this.removeEvent(evt)
|
||||
|
||||
}
|
||||
|
||||
return this
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
93
src/browser/js/app/events/utils.js
Normal file
93
src/browser/js/app/events/utils.js
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
module.exports = {
|
||||
|
||||
fix: function(e) {
|
||||
|
||||
return {
|
||||
|
||||
target: e.target,
|
||||
offsetX: e.offsetX,
|
||||
offsetY: e.offsetY,
|
||||
pageX: e.pageX,
|
||||
pageY: e.pageY,
|
||||
movementX: e.movementX,
|
||||
movementY: e.movementY,
|
||||
pointerId: e.pointerId,
|
||||
pointerType: e.pointerType,
|
||||
button: e.button,
|
||||
ctrlKey: e.ctrlKey,
|
||||
shiftKey: e.shiftKey
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
normalizeEvent: function(event, previousEvent) {
|
||||
|
||||
if (event.movementX === undefined) {
|
||||
|
||||
event.movementX = previousEvent ? event.pageX - previousEvent.pageX : 0
|
||||
event.movementY = previousEvent ? event.pageY - previousEvent.pageY : 0
|
||||
|
||||
}
|
||||
|
||||
if (event instanceof Touch && !previousEvent) {
|
||||
|
||||
module.exports.resetEventOffset(event, event.target)
|
||||
|
||||
} else if (event instanceof Touch && previousEvent) {
|
||||
|
||||
event.offsetX = previousEvent.offsetX + event.movementX
|
||||
event.offsetY = previousEvent.offsetY + event.movementY
|
||||
|
||||
}
|
||||
|
||||
if (event.inertia === undefined) {
|
||||
|
||||
event.inertia = 1
|
||||
|
||||
}
|
||||
|
||||
if (previousEvent && previousEvent.traversing) {
|
||||
|
||||
event.traversing = previousEvent.traversing
|
||||
event.traversingContainer = previousEvent.traversingContainer
|
||||
|
||||
}
|
||||
|
||||
event.stopPropagation = true
|
||||
|
||||
},
|
||||
|
||||
resetEventOffset: function(event, target) {
|
||||
|
||||
var off = module.exports.getElementOffset(target)
|
||||
|
||||
event.offsetX = event.pageX - off.left
|
||||
event.offsetY = event.pageY - off.top
|
||||
|
||||
},
|
||||
|
||||
getElementOffset: function(element) {
|
||||
|
||||
var offsetLeft = 0,
|
||||
offsetTop = 0
|
||||
|
||||
if (element) {
|
||||
do {
|
||||
if (!isNaN(element.offsetLeft)) {
|
||||
offsetLeft += element.offsetLeft - element.scrollLeft
|
||||
}
|
||||
if (!isNaN(element.offsetTop)) {
|
||||
offsetTop += element.offsetTop - element.scrollTop
|
||||
}
|
||||
} while (element = element.offsetParent)
|
||||
}
|
||||
|
||||
return {
|
||||
left: offsetLeft,
|
||||
top: offsetTop
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -26,10 +26,13 @@ window.DOUBLE_TAP_TIME = ARGV.doubletap ? ARGV.doubletap : 375
|
|||
|
||||
window.JSON.parseFlex = require('json5').parse
|
||||
|
||||
window.DOM = require('./dom')
|
||||
|
||||
window.$ = require('jquery/dist/jquery.slim.min.js')
|
||||
|
||||
require('./events/click')
|
||||
|
||||
require('../libs/jquery.ui')
|
||||
require('../libs/jquery.drag')
|
||||
require('../libs/jquery.resize')
|
||||
|
||||
require('cardinal-spline-js/curve.js')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
var EventEmitter = require('../event-emitter'),
|
||||
var EventEmitter = require('../events/event-emitter'),
|
||||
ipc = require('../ipc/')
|
||||
|
||||
var WidgetManager = class WidgetManager extends EventEmitter {
|
||||
|
|
|
|||
|
|
@ -47,11 +47,15 @@ module.exports = class Push extends _widgets_base {
|
|||
this.active = 0
|
||||
this.lastChanged = 'state'
|
||||
|
||||
this.widget.on('drag',function(e){e.stopPropagation()})
|
||||
this.widget.on('draginit.push',()=>{
|
||||
this.widget.off('draginit.push')
|
||||
this.fakeclick()
|
||||
})
|
||||
this.on('draginit',()=>{
|
||||
if (this.active) return
|
||||
this.setValuePrivate(this.getProp('on'),{send:true,sync:true})
|
||||
}, {element: this.widget[0]})
|
||||
|
||||
this.on('dragend',()=>{
|
||||
this.setValuePrivate(this.getProp('off'),{send:true,sync:true})
|
||||
}, {element: this.widget[0]})
|
||||
|
||||
this.classHolders = this.widget.add(this.container)
|
||||
|
||||
this.value = this.getProp('off')
|
||||
|
|
@ -68,20 +72,6 @@ module.exports = class Push extends _widgets_base {
|
|||
|
||||
}
|
||||
|
||||
fakeclick(){
|
||||
|
||||
if (!this.active) this.setValuePrivate(this.getProp('on'),{send:true,sync:true})
|
||||
this.widget.on('dragend.push',()=>{
|
||||
this.setValuePrivate(this.getProp('off'),{send:true,sync:true})
|
||||
this.widget.off('dragend.push')
|
||||
this.widget.on('draginit.push',()=>{
|
||||
this.widget.off('draginit.push')
|
||||
this.fakeclick()
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
setValuePrivate(v,options={}) {
|
||||
|
||||
if (typeof v == 'object' && v !== null) v = v.value
|
||||
|
|
|
|||
|
|
@ -66,9 +66,10 @@ module.exports = class Switch extends _widgets_base {
|
|||
|
||||
this.value = undefined
|
||||
|
||||
this.widget.find('.value').on('draginit',(e,dd)=>{
|
||||
this.on('draginit',(e)=>{
|
||||
|
||||
var index = 0,
|
||||
node = e.target
|
||||
node = e.changedTarget || e.target
|
||||
|
||||
while ( (node = node.previousSibling) ) {
|
||||
if (node.nodeType != 3 || !/^\s*$/.test(node.data)) {
|
||||
|
|
@ -79,7 +80,8 @@ module.exports = class Switch extends _widgets_base {
|
|||
var value = this.values[index]
|
||||
|
||||
if (value!=this.value || this.value===undefined) this.setValue(value,{sync:true,send:true})
|
||||
})
|
||||
|
||||
}, {element: this.widget[0]})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,24 +46,30 @@ module.exports = class Toggle extends _widgets_base {
|
|||
|
||||
super({...options, html: '<div class="toggle"></div>'})
|
||||
|
||||
this.widget.value = this.widget.find('span')
|
||||
this.widget.state = 0
|
||||
this.state = 0
|
||||
this.active = false
|
||||
|
||||
if (this.getProp('led')) this.container.addClass('led')
|
||||
|
||||
if (this.getProp('doubleTap')) {
|
||||
|
||||
doubletab(this.widget, ()=>{
|
||||
var newVal = this.widget.state?this.getProp('off'):this.getProp('on')
|
||||
var newVal = this.state?this.getProp('off'):this.getProp('on')
|
||||
this.setValue(newVal,{sync:true,send:true})
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
this.widget.on('draginit.toggle',()=>{
|
||||
this.widget.off('draginit.toggle')
|
||||
this.fakeclick()
|
||||
})
|
||||
this.on('draginit',()=>{
|
||||
if (this.active) return
|
||||
this.active = true
|
||||
var newVal = this.state?this.getProp('off'):this.getProp('on')
|
||||
this.setValue(newVal,{sync:true,send:true})
|
||||
}, {element: this.widget[0]})
|
||||
|
||||
this.on('dragend',()=>{
|
||||
this.active = false
|
||||
}, {element: this.widget[0]})
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -73,31 +79,16 @@ module.exports = class Toggle extends _widgets_base {
|
|||
|
||||
}
|
||||
|
||||
fakeclick() {
|
||||
|
||||
var newVal = this.widget.state?this.getProp('off'):this.getProp('on')
|
||||
this.setValue(newVal,{sync:true,send:true})
|
||||
this.widget.on('dragend.toggle',()=>{
|
||||
this.widget.off('dragend.toggle')
|
||||
this.widget.on('draginit.toggle',()=>{
|
||||
this.widget.off('draginit.toggle')
|
||||
this.fakeclick()
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
setValue(v,options={}) {
|
||||
|
||||
if (v===this.getProp('on') || (this.getProp('on') != null && v.value === this.getProp('on').value && v.value !== undefined)) {
|
||||
this.classHolders.addClass('on')
|
||||
this.widget.state = 1
|
||||
this.state = 1
|
||||
this.value = this.getProp('on')
|
||||
if (options.send) this.sendValue()
|
||||
} else if (v===this.getProp('off') || (this.getProp('off') != null && v.value === this.getProp('off').value && v.value !== undefined)) {
|
||||
this.classHolders.removeClass('on')
|
||||
this.widget.state = 0
|
||||
this.state = 0
|
||||
this.value = this.getProp('off')
|
||||
if (options.send) this.sendValue()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
var EventEmitter = require('../../event-emitter'),
|
||||
var EventEmitter = require('../../events/event-emitter'),
|
||||
osc = require('../../osc'),
|
||||
shortid = require('shortid'),
|
||||
widgetManager = require('../../managers/widgets'),
|
||||
|
|
|
|||
|
|
@ -5,16 +5,18 @@ module.exports = (element, callback)=>{
|
|||
lastTapY,
|
||||
touchId
|
||||
|
||||
element.on('fake-click',(e, d)=>{
|
||||
element[0].addEventListener('fake-click', (event)=>{
|
||||
|
||||
var tapTime = new Date().getTime(),
|
||||
tapLength = tapTime - lastTapTime,
|
||||
eventData = event.detail
|
||||
|
||||
var tapTime = new Date().getTime()
|
||||
var tapLength = tapTime - lastTapTime
|
||||
|
||||
if (
|
||||
|
||||
tapLength < DOUBLE_TAP_TIME && touchId == d.identifier &&
|
||||
Math.abs(lastTapX - d.pageX) < 20 &&
|
||||
Math.abs(lastTapY - d.pageY) < 20
|
||||
|
||||
tapLength < DOUBLE_TAP_TIME && touchId == eventData.pointerId &&
|
||||
Math.abs(lastTapX - eventData.pageX) < 20 &&
|
||||
Math.abs(lastTapY - eventData.pageY) < 20
|
||||
|
||||
) {
|
||||
|
||||
|
|
@ -24,9 +26,9 @@ module.exports = (element, callback)=>{
|
|||
} else {
|
||||
|
||||
lastTapTime = tapTime
|
||||
touchId = d.identifier
|
||||
lastTapX = d.pageX
|
||||
lastTapY = d.pageY
|
||||
touchId = eventData.pointerId
|
||||
lastTapX = eventData.pageX
|
||||
lastTapY = eventData.pageY
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,9 +75,6 @@ module.exports = class MultiXy extends _pads_base {
|
|||
})()
|
||||
: false
|
||||
|
||||
this.handles = []
|
||||
this.handlesPositions = []
|
||||
this.handlesToPads = []
|
||||
|
||||
this.pads = []
|
||||
|
||||
|
|
@ -99,57 +96,66 @@ module.exports = class MultiXy extends _pads_base {
|
|||
this.pads[i].sendValue = ()=>{}
|
||||
this.wrapper.append(this.pads[i].widget)
|
||||
|
||||
this.handles[i] = $(`<div class="handle"></div>`)
|
||||
|
||||
this.wrapper.append(this.handles[i])
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.value = []
|
||||
|
||||
this.handles.forEach((handle, index)=>{
|
||||
this.padsCoords = []
|
||||
this.touchMap = {}
|
||||
|
||||
handle.on('draginit',(e, data, traversing)=>{
|
||||
this.on('draginit',(e)=>{
|
||||
|
||||
if (!traversing) {
|
||||
handle.addClass('active')
|
||||
}
|
||||
var id
|
||||
|
||||
var id, ndiff, diff = -1
|
||||
if (!this.touchMap[e.pointerId]) {
|
||||
|
||||
var ndiff, diff = -1
|
||||
|
||||
for (var i in this.pads) {
|
||||
|
||||
if (Object.values(this.touchMap).indexOf(i) != -1) continue
|
||||
|
||||
ndiff = Math.abs(e.offsetX - this.padsCoords[i][0]) + Math.abs(e.offsetY - (this.padsCoords[i][1] + this.height))
|
||||
|
||||
for (var i in this.handles) {
|
||||
if (this.handlesToPads.indexOf(i) != -1) continue
|
||||
ndiff = Math.abs(data.offsetX - this.handlesPositions[i][0]) + Math.abs(data.offsetY - (this.handlesPositions[i][1] + this.height))
|
||||
if (diff == -1 || ndiff < diff) {
|
||||
id = i
|
||||
diff = ndiff
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.handlesToPads[index] = id
|
||||
this.touchMap[e.pointerId] = id
|
||||
|
||||
if (this.pads[id]) this.pads[id].wrapper.trigger(e.type, [data, traversing])
|
||||
|
||||
})
|
||||
} else if (e.traversing) {
|
||||
|
||||
handle.on('drag',(e, data, traversing)=>{
|
||||
id = this.touchMap[e.pointerId]
|
||||
|
||||
var id = this.handlesToPads[index]
|
||||
if (this.pads[id]) this.pads[id].wrapper.trigger(e.type, [data, traversing])
|
||||
}
|
||||
|
||||
})
|
||||
if (!id) return
|
||||
|
||||
handle.on('dragend',(e, data, traversing)=>{
|
||||
this.pads[id].trigger('draginit', [e])
|
||||
|
||||
var id = this.handlesToPads[index]
|
||||
if (this.pads[id]) this.pads[id].wrapper.trigger(e.type, [data, traversing])
|
||||
handle.removeClass('active')
|
||||
this.handlesToPads[index] = false
|
||||
}, {element: this.wrapper[0], multitouch: true})
|
||||
|
||||
this.on('drag',(e)=>{
|
||||
|
||||
var i = this.touchMap[e.pointerId]
|
||||
this.pads[i].trigger('drag', [e])
|
||||
|
||||
}, {element: this.wrapper[0], multitouch: true})
|
||||
|
||||
this.on('dragend',(e)=>{
|
||||
|
||||
var i = this.touchMap[e.pointerId]
|
||||
this.pads[i].trigger('dragend', [e])
|
||||
delete this.touchMap[e.pointerId]
|
||||
|
||||
}, {element: this.wrapper[0], multitouch: true})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
this.on('change',(e)=>{
|
||||
if (e.widget == this) return
|
||||
|
|
@ -178,7 +184,7 @@ module.exports = class MultiXy extends _pads_base {
|
|||
|
||||
for (var i=0;i<this.npoints;i++) {
|
||||
|
||||
this.handlesPositions[i] = [clip(this.pads[i].faders.x.percent,[0,100]) / 100 * (this.width - (this.pointSize * 2 + 2) * PXSCALE) + (this.pointSize + 1) * PXSCALE
|
||||
this.padsCoords[i] = [clip(this.pads[i].faders.x.percent,[0,100]) / 100 * (this.width - (this.pointSize * 2 + 2) * PXSCALE) + (this.pointSize + 1) * PXSCALE
|
||||
,- clip(this.pads[i].faders.y.percent,[0,100]) / 100 * (this.height - (this.pointSize * 2 + 2) * PXSCALE) - (this.pointSize + 1) * PXSCALE]
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,22 +114,25 @@ module.exports = class Xy extends _pads_base {
|
|||
e.stopPropagation = true
|
||||
})
|
||||
|
||||
this.wrapper.on('draginit',(e, data, traversing)=>{
|
||||
this.faders.x.draginitHandleProxy(e, data, traversing)
|
||||
this.faders.y.draginitHandleProxy(e, data, traversing)
|
||||
this.on('draginit',(e)=>{
|
||||
this.faders.x.trigger('draginit', [e])
|
||||
this.faders.y.trigger('draginit', [e])
|
||||
this.dragHandle()
|
||||
})
|
||||
this.wrapper.on('drag',(e, data, traversing)=>{
|
||||
this.faders.x.dragHandleProxy(e, data, traversing)
|
||||
this.faders.y.dragHandleProxy(e, data, traversing)
|
||||
this.dragHandle()
|
||||
})
|
||||
}, {element: this.wrapper[0]})
|
||||
|
||||
if (this.getProp('spring')) {
|
||||
this.wrapper.on('dragend', ()=>{
|
||||
this.on('drag',(e)=>{
|
||||
this.faders.x.trigger('drag', [e])
|
||||
this.faders.y.trigger('drag', [e])
|
||||
this.dragHandle()
|
||||
}, {element: this.wrapper[0]})
|
||||
|
||||
this.on('dragend', (e)=>{
|
||||
this.faders.x.trigger('dragend', [e])
|
||||
this.faders.y.trigger('dragend', [e])
|
||||
if (this.getProp('spring')) {
|
||||
this.setValue([this.faders.x.springValue,this.faders.y.springValue],{sync:true,send:true,fromLocal:true})
|
||||
})
|
||||
}
|
||||
}
|
||||
}, {element: this.wrapper[0]})
|
||||
|
||||
if (this.getProp('doubleTap')) {
|
||||
doubletab(this.wrapper, ()=>{
|
||||
|
|
|
|||
|
|
@ -63,9 +63,10 @@ module.exports = class _sliders_base extends _canvas_base {
|
|||
touchstate(this, this.wrapper)
|
||||
|
||||
this.wrapper.on('mousewheel',this.mousewheelHandleProxy.bind(this))
|
||||
this.wrapper.on('draginit',this.draginitHandleProxy.bind(this))
|
||||
this.wrapper.on('drag',this.dragHandleProxy.bind(this))
|
||||
this.wrapper.on('dragend',this.dragendHandleProxy.bind(this))
|
||||
|
||||
this.on('draginit', this.draginitHandleProxy.bind(this), {element:this.wrapper[0]})
|
||||
this.on('drag', this.dragHandleProxy.bind(this), {element:this.wrapper[0]})
|
||||
this.on('dragend', this.dragendHandleProxy.bind(this), {element:this.wrapper[0]})
|
||||
|
||||
|
||||
if (this.getProp('input')) {
|
||||
|
|
|
|||
|
|
@ -6,18 +6,18 @@ var {clip, mapToScale} = require('../utils'),
|
|||
|
||||
|
||||
var EncoderKnob = class extends Knob {
|
||||
draginitHandle(e, data, traversing) {
|
||||
draginitHandle(e) {
|
||||
|
||||
this.percent = clip(this.percent,[0,100])
|
||||
|
||||
this.lastOffsetX = data.offsetX
|
||||
this.lastOffsetY = data.offsetY
|
||||
this.lastOffsetX = e.offsetX
|
||||
this.lastOffsetY = e.offsetY
|
||||
|
||||
if (!(traversing || this.getProp('snap'))) return
|
||||
if (!(e.traversing || this.getProp('snap'))) return
|
||||
|
||||
this.percent = this.angleToPercent(this.coordsToAngle(data.offsetX, data.offsetY))
|
||||
this.percent = this.angleToPercent(this.coordsToAngle(e.offsetX, e.offsetY))
|
||||
|
||||
this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true, draginit:true})
|
||||
this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true, draginit:!e.traversing})
|
||||
|
||||
}
|
||||
mousewheelHandle(){}
|
||||
|
|
@ -87,7 +87,7 @@ module.exports = class Encoder extends _widgets_base {
|
|||
snap:true,
|
||||
range:{min:0,max:this.ticks},
|
||||
pips:false,
|
||||
}})
|
||||
}, parent: this})
|
||||
|
||||
this.knob.noDraw = true
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ module.exports = class Encoder extends _widgets_base {
|
|||
range:{min:0,max:this.ticks},
|
||||
origin:this.ticks/2,
|
||||
pips:false,
|
||||
}})
|
||||
}, parent: this})
|
||||
|
||||
this.wrapper.append(this.knob.widget.addClass('drag-knob'))
|
||||
this.wrapper.append(this.display.widget.addClass('display-knob'))
|
||||
|
|
@ -133,7 +133,7 @@ module.exports = class Encoder extends _widgets_base {
|
|||
|
||||
})
|
||||
|
||||
this.wrapper.on('draginit', (e)=>{
|
||||
this.knob.on('draginit', (e)=>{
|
||||
if (this.getProp('touchAddress') && this.getProp('touchAddress').length
|
||||
&& e.target == this.wrapper[0])
|
||||
this.sendValue({
|
||||
|
|
@ -142,25 +142,28 @@ module.exports = class Encoder extends _widgets_base {
|
|||
})
|
||||
})
|
||||
|
||||
this.wrapper.on('dragend', (e)=>{
|
||||
this.knob.on('dragend', (e)=>{
|
||||
if (this.getProp('release') !== '' && this.value !== this.getProp('release')) {
|
||||
this.knob.setValue(this.ticks/2)
|
||||
this.display.setValue(this.ticks/2)
|
||||
this.setValue(this.getProp('release'), {sync:true, send:true, dragged:false})
|
||||
}
|
||||
if (this.getProp('touchAddress') && this.getProp('touchAddress').length
|
||||
&& e.target == this.wrapper[0])
|
||||
if (
|
||||
this.getProp('touchAddress') && this.getProp('touchAddress').length
|
||||
&& e.target == this.wrapper[0]
|
||||
) {
|
||||
this.sendValue({
|
||||
address:this.getProp('touchAddress'),
|
||||
v:0
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
if (this.getProp('doubleTap')) {
|
||||
|
||||
doubletab(this.wrapper, ()=>{
|
||||
this.knob.setValue(this.ticks/2)
|
||||
this.display.setValue(this.ticks/2)
|
||||
this.knob.setValue(this.ticks/2)
|
||||
this.display.setValue(this.ticks/2)
|
||||
if (this.getProp('release') !== '' && this.value !== this.getProp('release')) {
|
||||
this.setValue(this.getProp('release'), {sync:true, send:true, dragged:false})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,17 +125,17 @@ module.exports = class Fader extends _sliders_base {
|
|||
|
||||
}
|
||||
|
||||
draginitHandle(e, data, traversing) {
|
||||
draginitHandle(e) {
|
||||
|
||||
super.draginitHandle(...arguments)
|
||||
|
||||
this.percent = clip(this.percent,[0,100])
|
||||
|
||||
if (!(traversing || this.getProp('snap')) || data.ctrlKey) return
|
||||
if (!(e.traversing || this.getProp('snap')) || e.ctrlKey) return
|
||||
|
||||
this.percent = this.getProp('horizontal')?
|
||||
(data.offsetX - this.margin * PXSCALE) / (this.width - (this.margin * PXSCALE * 2)) * 100:
|
||||
(this.height - data.offsetY - this.margin * PXSCALE) / (this.height - (this.margin * PXSCALE * 2)) * 100
|
||||
(e.offsetX - this.margin * PXSCALE) / (this.width - (this.margin * PXSCALE * 2)) * 100:
|
||||
(this.height - e.offsetY - this.margin * PXSCALE) / (this.height - (this.margin * PXSCALE * 2)) * 100
|
||||
|
||||
// this.percent = clip(this.percent,[0,100])
|
||||
|
||||
|
|
@ -148,8 +148,8 @@ module.exports = class Fader extends _sliders_base {
|
|||
super.dragHandle(...arguments)
|
||||
|
||||
this.percent = this.getProp('horizontal')?
|
||||
this.percent + ( data.speedX/(this.width - this.margin * PXSCALE * 2)) * 100:
|
||||
this.percent + (-data.speedY/(this.height - this.margin * PXSCALE * 2)) * 100
|
||||
this.percent + ( e.movementX/(this.width - this.margin * PXSCALE * 2)) * 100 / e.inertia:
|
||||
this.percent + (-e.movementY/(this.height - this.margin * PXSCALE * 2)) * 100 / e.inertia
|
||||
|
||||
this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true})
|
||||
|
||||
|
|
|
|||
|
|
@ -69,31 +69,31 @@ module.exports = class Knob extends _sliders_base {
|
|||
|
||||
}
|
||||
|
||||
draginitHandle(e, data, traversing) {
|
||||
draginitHandle(e) {
|
||||
|
||||
this.percent = clip(this.percent,[0,100])
|
||||
|
||||
this.lastOffsetX = data.offsetX
|
||||
this.lastOffsetY = data.offsetY
|
||||
this.lastOffsetX = e.offsetX
|
||||
this.lastOffsetY = e.offsetY
|
||||
|
||||
if (!(traversing || this.getProp('snap')) || data.ctrlKey) return
|
||||
if (!(e.traversing || this.getProp('snap')) || e.ctrlKey) return
|
||||
|
||||
this.percent = this.angleToPercent(this.coordsToAngle(data.offsetX, data.offsetY))
|
||||
this.percent = this.angleToPercent(this.coordsToAngle(e.offsetX, e.offsetY))
|
||||
|
||||
this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true})
|
||||
|
||||
}
|
||||
|
||||
dragHandle(e, data, traversing) {
|
||||
dragHandle(e) {
|
||||
|
||||
if (!(traversing || this.getProp('snap')) || data.ctrlKey) {
|
||||
if (!(e.traversing || this.getProp('snap')) || e.ctrlKey) {
|
||||
|
||||
this.percent = -100*data.speedY/this.height + this.percent
|
||||
this.percent = -100 * (e.movementY / e.inertia) / this.height + this.percent
|
||||
|
||||
} else {
|
||||
|
||||
this.lastOffsetX = this.lastOffsetX + data.speedX
|
||||
this.lastOffsetY = this.lastOffsetY + data.speedY
|
||||
this.lastOffsetX = this.lastOffsetX + e.movementX / e.inertia
|
||||
this.lastOffsetY = this.lastOffsetY + e.movementY / e.inertia
|
||||
this.percent = this.angleToPercent(this.coordsToAngle(this.lastOffsetX, this.lastOffsetY))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -289,61 +289,63 @@ module.exports = class Range extends _widgets_base {
|
|||
|
||||
})
|
||||
|
||||
this.handles = [
|
||||
$(`<div class="handle"></div>`),
|
||||
$(`<div class="handle"></div>`)
|
||||
]
|
||||
this.wrapper.append(this.handles)
|
||||
this.touchMap = {}
|
||||
|
||||
this.handlesToFaders = []
|
||||
this.on('draginit',(e)=>{
|
||||
|
||||
this.handles.forEach((handle, index)=>{
|
||||
var id
|
||||
|
||||
handle.on('draginit',(e, data, traversing)=>{
|
||||
if (!this.touchMap[e.pointerId]) {
|
||||
|
||||
if (!traversing) {
|
||||
handle.addClass('active')
|
||||
}
|
||||
var ndiff, diff = -1
|
||||
|
||||
var id, ndiff, diff = -1
|
||||
for (var i in this.faders) {
|
||||
|
||||
for (var i in this.handles) {
|
||||
if (this.handlesToFaders.indexOf(i) != -1) continue
|
||||
if (Object.values(this.touchMap).indexOf(i) != -1) continue
|
||||
|
||||
var coord = this.faders[i].percentToCoord(this.faders[i].valueToPercent(this.faders[i].value)) - (this.getProp('horizontal') ? -1 : 1) * (i == 0 ? -20 : 20)
|
||||
|
||||
ndiff = this.getProp('horizontal')?
|
||||
Math.abs(data.offsetX - coord) :
|
||||
Math.abs(data.offsetY - coord)
|
||||
Math.abs(e.offsetX - coord) :
|
||||
Math.abs(e.offsetY - coord)
|
||||
|
||||
if (diff == -1 || ndiff < diff) {
|
||||
id = i
|
||||
diff = ndiff
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.handlesToFaders[index] = id
|
||||
this.touchMap[e.pointerId] = id
|
||||
|
||||
if (this.faders[id]) this.faders[id].wrapper.trigger(e.type, [data, traversing])
|
||||
|
||||
})
|
||||
} else if (e.traversing) {
|
||||
|
||||
handle.on('drag',(e, data, traversing)=>{
|
||||
id = this.touchMap[e.pointerId]
|
||||
|
||||
var id = this.handlesToFaders[index]
|
||||
if (this.faders[id]) this.faders[id].wrapper.trigger(e.type, [data, traversing])
|
||||
}
|
||||
|
||||
})
|
||||
if (!id) return
|
||||
|
||||
handle.on('dragend',(e, data, traversing)=>{
|
||||
this.faders[id].trigger('draginit', [e])
|
||||
|
||||
var id = this.handlesToFaders[index]
|
||||
if (this.faders[id]) this.faders[id].wrapper.trigger(e.type, [data, traversing])
|
||||
handle.removeClass('active')
|
||||
this.handlesToFaders[index] = false
|
||||
}, {element: this.wrapper[0], multitouch: true})
|
||||
|
||||
})
|
||||
this.on('drag',(e)=>{
|
||||
|
||||
var i = this.touchMap[e.pointerId]
|
||||
this.faders[i].trigger('drag', [e])
|
||||
|
||||
}, {element: this.wrapper[0], multitouch: true})
|
||||
|
||||
this.on('dragend',(e)=>{
|
||||
|
||||
var i = this.touchMap[e.pointerId]
|
||||
this.faders[i].trigger('dragend', [e])
|
||||
delete this.touchMap[e.pointerId]
|
||||
|
||||
}, {element: this.wrapper[0], multitouch: true})
|
||||
|
||||
})
|
||||
|
||||
if (this.getProp('input')) {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,396 +0,0 @@
|
|||
// jQuery drag event handler
|
||||
// note: triggerHandler() is used instead of trigger() when event bubblig is not
|
||||
// necessary, this increases performances a lot.
|
||||
;(function($){
|
||||
var events = {
|
||||
touch:{start:'touchstart',stop:'touchend touchcancel',move:'touchmove',touch:true},
|
||||
mouse:{start:'mousedown',stop:'mouseup',move:'mousemove',out:'mouseout',touch:false}
|
||||
},
|
||||
|
||||
|
||||
$document = $(document),
|
||||
getOffset = function(obj) {
|
||||
var offsetLeft = 0
|
||||
var offsetTop = 0
|
||||
if (obj) {
|
||||
do {
|
||||
if (!isNaN(obj.offsetLeft)) {
|
||||
offsetLeft += obj.offsetLeft - obj.scrollLeft
|
||||
}
|
||||
if (!isNaN(obj.offsetTop)) {
|
||||
offsetTop += obj.offsetTop - obj.scrollTop
|
||||
}
|
||||
} while(obj = obj.offsetParent )
|
||||
}
|
||||
|
||||
return {left: offsetLeft, top: offsetTop}
|
||||
}
|
||||
|
||||
|
||||
$.event.special.draginit = $.event.special.drag = {
|
||||
setup:function(){
|
||||
|
||||
var $this = $(this)
|
||||
|
||||
if ($this.data('dragSetup') == 'true') return
|
||||
$this.data('dragSetup','true')
|
||||
|
||||
|
||||
// mouse single touch handler
|
||||
var previousEvent = null,
|
||||
target = null,
|
||||
traversing = false,
|
||||
mouseStartHandler = function(e){
|
||||
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if ((e.originalEvent.sourceCapabilities && e.originalEvent.sourceCapabilities.firesTouchEvents) || e.button == 2) return
|
||||
|
||||
target = $this
|
||||
previousEvent = e
|
||||
|
||||
e.speedX = 0
|
||||
e.speedY = 0
|
||||
e.deltaX = 0
|
||||
e.deltaY = 0
|
||||
|
||||
target.triggerHandler('draginit',[e,e.originalEvent.traversing])
|
||||
|
||||
$document.on(events.mouse.move,mouseMoveHandler)
|
||||
$document.on(events.mouse.stop,mouseStopHandler)
|
||||
$document.on(events.mouse.out,mouseOutHandler)
|
||||
|
||||
},
|
||||
mouseMoveHandler = function(e){
|
||||
e.stopPropagation()
|
||||
|
||||
e.speedX = (e.pageX - previousEvent.pageX) / (e.ctrlKey ? 8 : 1)
|
||||
e.speedY = (e.pageY - previousEvent.pageY) / (e.ctrlKey ? 8 : 1)
|
||||
e.deltaX = e.speedX + previousEvent.deltaX
|
||||
e.deltaY = e.speedY + previousEvent.deltaY
|
||||
|
||||
|
||||
if (e.originalEvent.traversing) {
|
||||
target = $(e.target)
|
||||
e.preventDefault()
|
||||
target.triggerHandler('draginit',[e,e.originalEvent.traversing])
|
||||
} else {
|
||||
target.triggerHandler('drag',[e,e.originalEvent.traversing])
|
||||
}
|
||||
|
||||
previousEvent = e
|
||||
},
|
||||
mouseStopHandler = function(e){
|
||||
e.stopPropagation()
|
||||
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if (e.originalEvent.sourceCapabilities && e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
e.speedX = e.pageX - previousEvent.pageX
|
||||
e.speedY = e.pageY - previousEvent.pageY
|
||||
e.deltaX = e.deltaX + previousEvent.deltaX
|
||||
e.deltaY = e.deltaY + previousEvent.deltaY
|
||||
|
||||
|
||||
target.trigger('dragend',[e,e.originalEvent.traversing])
|
||||
|
||||
$document.off(events.mouse.move,mouseMoveHandler)
|
||||
$document.off(events.mouse.stop,mouseStopHandler)
|
||||
$document.off(events.mouse.out,mouseOutHandler)
|
||||
},
|
||||
mouseOutHandler = function(e){
|
||||
if (e.originalEvent.traversing) {
|
||||
e.stopPropagation()
|
||||
|
||||
e.speedX = e.pageX - previousEvent.pageX
|
||||
e.speedY = e.pageY - previousEvent.pageY
|
||||
e.deltaX = e.deltaX + previousEvent.deltaX
|
||||
e.deltaY = e.deltaY + previousEvent.deltaY
|
||||
|
||||
target.trigger('dragend',[e,e.originalEvent.traversing])
|
||||
|
||||
previousEvent = e
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this.on(events.mouse.start + '.drag-osc',mouseStartHandler)
|
||||
|
||||
|
||||
// multi touch hanlder
|
||||
window.targets = window.targets || {}
|
||||
window.previousTouches = window.previousTouches || {}
|
||||
window.touchActive = window.touchActive || false
|
||||
|
||||
var self = this,
|
||||
touchStartHandler = function(e){
|
||||
e.preventDefault()
|
||||
|
||||
var oE = e.originalEvent
|
||||
|
||||
for (let i in oE.changedTouches) {
|
||||
if (isNaN(i) || !oE.changedTouches[i]) continue
|
||||
|
||||
var touch = oE.changedTouches[i],
|
||||
id = touch.identifier,
|
||||
emit = true
|
||||
|
||||
for (let j in targets) {
|
||||
if (targets[j][0].isSameNode(touch.target)) {
|
||||
emit = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
targets[id] = $(touch.target)
|
||||
previousTouches[id] = {
|
||||
deltaX:touch.deltaX,
|
||||
deltaY:touch.deltaY,
|
||||
offsetX:touch.offsetX,
|
||||
offsetY:touch.offsetY,
|
||||
speedX:touch.speedX,
|
||||
speedY:touch.speedY,
|
||||
pageX:touch.pageX,
|
||||
pageY:touch.pageY,
|
||||
clientX:touch.clientX,
|
||||
clientY:touch.clientY
|
||||
}
|
||||
|
||||
touch.speedX = 0
|
||||
touch.speedY = 0
|
||||
|
||||
touch.deltaX = 0
|
||||
touch.deltaY = 0
|
||||
|
||||
var off = getOffset(touch.target)
|
||||
touch.offsetX = touch.pageX-off.left
|
||||
touch.offsetY = touch.pageY-off.top
|
||||
|
||||
|
||||
if (emit) targets[id].triggerHandler('draginit',[touch,e.originalEvent.traversing])
|
||||
|
||||
}
|
||||
|
||||
if (!touchActive) {
|
||||
$document.on(events.touch.move,touchMoveHandler)
|
||||
$document.on(events.touch.stop,touchStopHandler)
|
||||
touchActive = true
|
||||
}
|
||||
|
||||
},
|
||||
touchMoveHandler = function(e){
|
||||
|
||||
var oE = e.originalEvent
|
||||
|
||||
for (let i in oE.changedTouches) {
|
||||
if (isNaN(i) || !oE.changedTouches[i]) continue
|
||||
|
||||
var nFingers = 0
|
||||
for (let j in oE.touches) {
|
||||
if (oE.touches[j].target && oE.touches[j].target.isSameNode(oE.changedTouches[i].target)) {
|
||||
nFingers += 1
|
||||
}
|
||||
}
|
||||
|
||||
var touch = oE.changedTouches[i],
|
||||
id = touch.identifier,
|
||||
speedFactor = nFingers * nFingers
|
||||
|
||||
if (e.originalEvent.traversing) {
|
||||
targets[id] = $(document.elementFromPoint(touch.clientX, touch.clientY))
|
||||
}
|
||||
|
||||
if (!targets[id]) continue
|
||||
|
||||
touch.speedX = (touch.pageX - previousTouches[id].pageX) / speedFactor
|
||||
touch.speedY = (touch.pageY - previousTouches[id].pageY) / speedFactor
|
||||
|
||||
touch.deltaX = touch.speedX + previousTouches[id].deltaX
|
||||
touch.deltaY = touch.speedY + previousTouches[id].deltaY
|
||||
|
||||
touch.offsetX = previousTouches[id].offsetX+touch.speedX
|
||||
touch.offsetY = previousTouches[id].offsetY+touch.speedY
|
||||
|
||||
if (e.originalEvent.traversing) {
|
||||
touch.traversing = true
|
||||
var previousTarget = document.elementFromPoint(previousTouches[id].clientX, previousTouches[id].clientY)
|
||||
if (targets[id][0]!=previousTarget) {
|
||||
var off = getOffset(targets[id][0])
|
||||
touch.offsetX = touch.pageX-off.left
|
||||
touch.offsetY = touch.pageY-off.top
|
||||
$(previousTarget).trigger('dragend',[touch,e.originalEvent.traversing])
|
||||
}
|
||||
e.preventDefault()
|
||||
if (oE.traversingContainer.contains(targets[id][0])) targets[id].triggerHandler('draginit',[touch,e.originalEvent.traversing])
|
||||
|
||||
} else {
|
||||
|
||||
targets[id].triggerHandler('drag',[touch,e.originalEvent.traversing])
|
||||
|
||||
}
|
||||
|
||||
previousTouches[id] = {
|
||||
deltaX:touch.deltaX,
|
||||
deltaY:touch.deltaY,
|
||||
offsetX:touch.offsetX,
|
||||
offsetY:touch.offsetY,
|
||||
speedX:touch.speedX,
|
||||
speedY:touch.speedY,
|
||||
pageX:touch.pageX,
|
||||
pageY:touch.pageY,
|
||||
clientX:touch.clientX,
|
||||
clientY:touch.clientY
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
touchStopHandler = function(e){
|
||||
|
||||
var oE = e.originalEvent
|
||||
|
||||
for (let i in oE.changedTouches) {
|
||||
|
||||
if (isNaN(i) || !oE.changedTouches[i]) continue
|
||||
|
||||
var touch = oE.changedTouches[i],
|
||||
id = touch.identifier
|
||||
|
||||
$(targets[id]).trigger('dragend',[touch,e.originalEvent.traversing])
|
||||
|
||||
delete previousTouches[id]
|
||||
delete targets[id]
|
||||
|
||||
}
|
||||
|
||||
if (oE.touches.length==0) {
|
||||
$document.off(events.touch.move,touchMoveHandler)
|
||||
$document.off(events.touch.stop,touchStopHandler)
|
||||
touchActive = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this.on(events.touch.start + '.drag-osc',touchStartHandler)
|
||||
|
||||
|
||||
},
|
||||
teardown: function(){
|
||||
var $this = $(this)
|
||||
$this.off(events.touch.start + '.drag-osc')
|
||||
$this.off(events.mouse.start + '.drag-osc')
|
||||
$this.data('dragSetup','false')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var makeEventTraversing = function(e){
|
||||
e.traversing=true
|
||||
if (!e.traversingContainer) e.traversingContainer=this
|
||||
}
|
||||
|
||||
|
||||
$.fn.enableTraversingGestures = function(options={}) {
|
||||
|
||||
var self = this[0]
|
||||
|
||||
var down = function(e){
|
||||
if (e.ctrlKey && options.ctrlKeyCancel) return
|
||||
makeEventTraversing(e)
|
||||
self.addEventListener("mousemove", makeEventTraversing, true)
|
||||
self.addEventListener("touchmove", makeEventTraversing, true)
|
||||
self.addEventListener("mouseout", makeEventTraversing, true)
|
||||
document.addEventListener("mouseup",up,true)
|
||||
document.addEventListener("touchend",up,true)
|
||||
},
|
||||
up = function(e){
|
||||
makeEventTraversing(e)
|
||||
self.removeEventListener("mousemove", makeEventTraversing, true)
|
||||
self.removeEventListener("touchmove", makeEventTraversing, true)
|
||||
self.removeEventListener("mouseout", makeEventTraversing, true)
|
||||
document.removeEventListener("mouseup",up,true)
|
||||
document.removeEventListener("touchend",up,true)
|
||||
}
|
||||
|
||||
self.addEventListener("mousedown", down, true)
|
||||
self.addEventListener("touchstart", down, true)
|
||||
|
||||
this.on('draginit.traversing',()=>{})
|
||||
|
||||
this.on('disableTraversingGestures',()=>{
|
||||
this.off('draginit.traversing')
|
||||
self.removeEventListener("mousedown", down, true)
|
||||
self.removeEventListener("touchstart", down, true)
|
||||
})
|
||||
|
||||
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
$.fn.disableTraversingGestures = function() {
|
||||
|
||||
this.trigger('disableTraversingGestures')
|
||||
|
||||
}
|
||||
|
||||
|
||||
var longTapTimer = false,
|
||||
clearLongTapTimer = function() {
|
||||
clearTimeout(longTapTimer)
|
||||
longTapTimer = false
|
||||
}
|
||||
|
||||
$document.on('mousedown',function(e){
|
||||
|
||||
if (e.originalEvent.sourceCapabilities && e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
|
||||
if (e.button==2) {
|
||||
|
||||
e.preventDefault()
|
||||
$(e.target).trigger('fake-right-click', e)
|
||||
|
||||
} else {
|
||||
|
||||
$(e.target).trigger('fake-click', e)
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$document.on(events.touch.start,function(e){
|
||||
var touch = e.originalEvent.changedTouches[0]
|
||||
|
||||
$(e.target).trigger('fake-click', touch)
|
||||
|
||||
if (!longTapTimer&&e.originalEvent.touches.length==1) {
|
||||
longTapTimer = setTimeout(function(){
|
||||
if (longTapTimer) {
|
||||
var off = getOffset(touch.target)
|
||||
|
||||
touch.offsetX = touch.pageX-off.left
|
||||
touch.offsetY = touch.pageY-off.top
|
||||
$(e.originalEvent.changedTouches[0].target).trigger('fake-right-click',touch)
|
||||
}
|
||||
longTapTimer = false
|
||||
},600)
|
||||
} else {
|
||||
clearLongTapTimer()
|
||||
}
|
||||
})
|
||||
|
||||
$document.on(events.touch.stop + ' ' + events.touch.move,function(e){
|
||||
clearLongTapTimer()
|
||||
})
|
||||
|
||||
$document.on('contextmenu',function(){return false})
|
||||
|
||||
})($)
|
||||
|
|
@ -401,23 +401,13 @@
|
|||
display: flex;
|
||||
justify-content: center;
|
||||
border-radius: inherit;
|
||||
.handle {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom:0;
|
||||
z-index: 1;
|
||||
&.active {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
.fader {
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
pointer-events: none;
|
||||
.wrapper {
|
||||
// border: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,17 +157,7 @@
|
|||
top:0;
|
||||
left:0;
|
||||
}
|
||||
.handle {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom:0;
|
||||
z-index: 1;
|
||||
&.active {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .pad {
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue