Traversing gestures switch added to sidepanel
This commit is contained in:
parent
d08706e892
commit
03ba93f16f
8 changed files with 38 additions and 30 deletions
|
|
@ -4,9 +4,12 @@ WIDGETS = {}
|
|||
WIDGETS_LINKED = {}
|
||||
WIDGETS_ID_BY_PATH = {}
|
||||
SESSION = []
|
||||
|
||||
CLIPBOARD = null
|
||||
EDITING = false
|
||||
|
||||
TRAVERSING = false
|
||||
|
||||
MISC = {
|
||||
iterators: {
|
||||
widget:{},
|
||||
|
|
|
|||
|
|
@ -168,6 +168,17 @@ module.exports = {
|
|||
$('.enable-editor').removeClass('on')
|
||||
|
||||
EDITING = false
|
||||
},
|
||||
|
||||
traversingDisable: function(){
|
||||
$('body').delegateDrag('disable')
|
||||
$('.traversingEnable, .traversingDisable').toggleClass('on')
|
||||
TRAVERSING = false
|
||||
},
|
||||
traversingEnable: function(){
|
||||
$('body').delegateDrag()
|
||||
$('.traversingEnable, .traversingDisable').toggleClass('on')
|
||||
TRAVERSING = true
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,21 @@ var data = [
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: icon('magic') + ' Traversing gestures',
|
||||
actions: [
|
||||
{
|
||||
title:'On',
|
||||
action:actions.traversingEnable,
|
||||
class:'traversingEnable'
|
||||
},
|
||||
{
|
||||
title:'Off',
|
||||
action:actions.traversingDisable,
|
||||
class:'traversingDisable on'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: icon('edit') + ' Editor',
|
||||
class:'editor',
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ module.exports.create = function(widgetData,container) {
|
|||
|
||||
var off = 0
|
||||
wrapper.on('draginit',function(e,data){
|
||||
if (absolute || data.ctrlKey || data.shiftKey) {
|
||||
if (absolute || TRAVERSING) {
|
||||
var d = (dimension=='height')?
|
||||
((fader.size-data.offsetY+(wrapper.size-fader.size)/2) * 100 / fader.size):
|
||||
(data.offsetX - (wrapper.size-fader.size)/2) * 100 / fader.size
|
||||
|
|
@ -143,7 +143,7 @@ module.exports.create = function(widgetData,container) {
|
|||
wrapper.on('drag',function(e,data){
|
||||
e.stopPropagation()
|
||||
|
||||
if (data.shiftKey) return
|
||||
if (TRAVERSING) return
|
||||
|
||||
var d = (dimension=='height')?-data.deltaY:data.deltaX
|
||||
d = clip(d*100/fader.size+off,[0,100])
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ module.exports.create = function(widgetData,container) {
|
|||
offY = 0
|
||||
wrapper.on('draginit',function(e,data){
|
||||
|
||||
if (absolute || data.ctrlKey || data.shiftKey) {
|
||||
if (absolute || TRAVERSING) {
|
||||
var w = data.target.clientWidth,
|
||||
h = data.target.clientHeight,
|
||||
x = data.offsetX-w/2,
|
||||
|
|
@ -130,7 +130,7 @@ module.exports.create = function(widgetData,container) {
|
|||
wrapper.on('drag',function(e,data){
|
||||
e.stopPropagation()
|
||||
|
||||
if (data.shiftKey) return
|
||||
if (TRAVERSING) return
|
||||
|
||||
var r = clip(-data.deltaY*2+offR,[0,270])
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ module.exports.create = function(widgetData,container) {
|
|||
|
||||
var rgbOff = {x:0,y:0}
|
||||
pad.on('draginit',function(e,data){
|
||||
if (absolute || data.ctrlKey || data.shiftKey) {
|
||||
if (absolute || TRAVERSING) {
|
||||
var h = ((pad.height-data.offsetY) * 100 / pad.height),
|
||||
w = (data.offsetX * 100 / pad.width)
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ module.exports.create = function(widgetData,container) {
|
|||
pad.on('drag',function(e,data){
|
||||
e.stopPropagation()
|
||||
|
||||
if (data.shiftKey) return
|
||||
if (TRAVERSING) return
|
||||
|
||||
var h = clip((-data.deltaY)*100/pad.height+rgbOff.y,[0,100]),
|
||||
w = clip(data.deltaX*100/pad.width+rgbOff.x,[0,100])
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ module.exports.create = function(widgetData,container) {
|
|||
|
||||
var off = {x:0,y:0}
|
||||
pad.on('draginit',function(e,data){
|
||||
if (absolute || data.ctrlKey || data.shiftKey) {
|
||||
if (absolute || TRAVERSING) {
|
||||
var h = ((pad.height-data.offsetY) * 100 / pad.height),
|
||||
w = (data.offsetX * 100 / pad.width)
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ module.exports.create = function(widgetData,container) {
|
|||
pad.on('drag',function(e,data){
|
||||
e.stopPropagation()
|
||||
|
||||
if (data.shiftKey) return
|
||||
if (TRAVERSING) return
|
||||
|
||||
var h = clip((-data.deltaY)*100/pad.height+off.y,[0,100]),
|
||||
w = clip((data.deltaX)*100/pad.width+off.x,[0,100])
|
||||
|
|
|
|||
|
|
@ -9,10 +9,6 @@
|
|||
var mousemove = function(e) {
|
||||
e.speedX = e.pageX - previousEvent.pageX
|
||||
e.speedY = e.pageY - previousEvent.pageY
|
||||
if (e.button==2) {
|
||||
e.speedX = e.speedX/10
|
||||
e.speedY = e.speedY/10
|
||||
}
|
||||
e.deltaX = e.speedX + previousEvent.deltaX
|
||||
e.deltaY = e.speedY + previousEvent.deltaY
|
||||
|
||||
|
|
@ -117,12 +113,7 @@
|
|||
},
|
||||
teardown: function() {
|
||||
var element = $(this)
|
||||
element.off("touchstart.drag")
|
||||
element.off("touchmove.drag")
|
||||
element.off("touchend.drag")
|
||||
element.off("touchcancel.drag")
|
||||
element.off("mousedown.drag")
|
||||
element.off("mouseup.drag")
|
||||
element.off(".drag")
|
||||
}
|
||||
}
|
||||
$.fn.delegateDrag = function(action) {
|
||||
|
|
@ -150,17 +141,5 @@
|
|||
}
|
||||
return this
|
||||
}
|
||||
// MASTER DRAGGING (while shift key pressed)
|
||||
var target
|
||||
$(document).keydown(function (e) {
|
||||
if (e.keyCode == 16) {
|
||||
$('body').delegateDrag()
|
||||
}
|
||||
});
|
||||
$(document).keyup(function (e) {
|
||||
if (e.keyCode == 16) {
|
||||
$('body').delegateDrag('disable')
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue