- horizontal fader

- relative sizing for all -> zoom with ctrl+scroll !
This commit is contained in:
jean-emmanuel 2015-09-13 09:13:45 +02:00 • committed by bordun
parent ae94b4bb4e
commit df73c17c3e
5 changed files with 253 additions and 259 deletions

View file

@ -53,15 +53,29 @@ init = function(callback) {
$('.tablist li:first-child a').click();
// reset zoom
$(document).on('keydown.resetzoom', function(e){
if (e.keyCode==96) $('html').css('font-size',1)
})
// horizontal scrolling with mousewheel
// horizontal scrolling & zoom with mousewheel
// if shift is pressed (native), or if there is no vertical scrollbar,
// or if mouse is on h-scrollbar
$('.tab').on('mousewheel',function(e) {
// console.log(e)
var h = $('#container').innerHeight()-10-$(this).parents('.tab').length*5;
if ($(this).get(0).scrollHeight+10 == $(this).height()) {
if (e.ctrlKey) {
e.preventDefault()
var d = -e.originalEvent.deltaY/Math.abs(e.originalEvent.deltaY)/10,
s = d+parseFloat($('html').css('font-size'))
$('html').css('font-size',s)
}
var scrollbar = Math.round(10*parseFloat($('html').css('font-size')))
var h = $('#container').innerHeight()-scrollbar-$(this).parents('.tab').length*5;
if ($(this).get(0).scrollHeight+scrollbar == $(this).height()) {
$(this).scrollLeft($(this).scrollLeft()+e.originalEvent.deltaY);
e.preventDefault();
} else if (e.pageY>=h) {

View file

@ -57,19 +57,19 @@ parsewidgets = function(widgets,parent) {
color = 'style="color:'+widgetData.color+'"'
}
var widget = $('\
var widgetContainer = $('\
<div class="widget '+type+'-container" widgetType="'+type+'" widgetId="'+id+'" path="'+path+'">\
<div class="label '+accentclass+'" '+color+'>'+label+'</div>\
</div>\
');
// create widget
var widgetInner = createWidget[type](widgetData,parent)
var widgetInner = createWidget[type](widgetData,widgetContainer)
widgetInner.type = type
widget.find('.label').data('papers',widgetData)
widgetContainer.find('.label').data('papers',widgetData)
// store widget reference for cross widget sync
widget.append(widgetInner)
widgetContainer.append(widgetInner)
if (__widgets__[id]==undefined) {
__widgets__[id] = []
}
@ -78,6 +78,6 @@ parsewidgets = function(widgets,parent) {
// store path vs widget id for faster cross-app sync
__widgetsIds__[widgetData.path ] = id
parent.append(widget);
parent.append(widgetContainer);
}
}

View file

@ -1,4 +1,9 @@
sendOsc = function(data){
// Unpack args for osc sending function
if (data[0]) {
ipc.send('sendOsc', {target:data[0],path:data[1],args:data[2]});
}
}
saveState = function () {
var data = getState()
@ -34,27 +39,6 @@ setState = function(preset){
}
// // inspector
// findNode = function(searchID, obj) {
// var result=false;
// for (i in obj) {
//
// if
//
//
//
//
// // if (id==searchID) {
// // result = searchObject[id]
// // return false
// // } else if (typeof searchObject[id] === 'object'){
// // result = findNode(searchID, searchObject[id])
// // }
// // if (result !== false) {return false}
// }
// return result
// }
icon = function(i) {
return '<i class="fa fa-fw fa-'+i+'"></i>'
}
@ -192,7 +176,4 @@ configPanel = function(){
popup.close();
})
}

View file

@ -1,10 +1,4 @@
sendOsc = function(data){
// Unpack args for osc sending function
if (data[0]) {
ipc.send('sendOsc', {target:data[0],path:data[1],args:data[2]});
}
}
createWidget= {}
@ -25,6 +19,7 @@ createWidget.strip = function(widgetData) {
<div class="strip">\
</div>\
');
if (widgetData.mode=='horizontal') widget.addClass('horizontal')
parsewidgets(widgetData.widgets,widget)
widget.getValue = function(){return}
widget.setValue = function(){return}
@ -418,7 +413,7 @@ createWidget.rgb = function(widgetData) {
createWidget.fader = function(widgetData,parent){
createWidget.fader = function(widgetData,container){
var widget = $('\
<div class="fader-wrapper-outer">\
<div class="fader-wrapper">\
@ -435,7 +430,9 @@ createWidget.fader = function(widgetData,parent){
pips = widget.find('.pips'),
input = widget.find('input'),
unit = widgetData.unit?' '+widgetData.unit.trim(): '',
dimension = parent.hasClass('stack')?'width':'height';
dimension = widgetData.mode=='horizontal'?'width':'height';
if (widgetData.mode=='horizontal') container.addClass('horizontal')
handle.size = function() {
return (dimension=='height')?handle.height():handle.width()
@ -563,7 +560,7 @@ $.fn.getRotation = function () {
};
createWidget.knob = function(widgetData,parent) {
createWidget.knob = function(widgetData) {
var widget = $('\
<div class="knob-wrapper-outer">\
<div class="knob-wrapper">\