xy/rgb "split" mode, dragging refinement
- xy/rgb split mode : different osc paths can be used for each parameters (the original path is still used for synchronization) - removed pseudo-element overlay hack for dragging events - drag events are launched by wrapper elements (inner elements are ignored via css's pointer-events property) - no more boundingbox calculation for rotating knobs - tiny mod in jquery.event.drag to preserve original element size in hijacked event object - preparing for upcomming feature : absolute master dragging (one dragging motion to control all widgets)
This commit is contained in:
parent
a302e40605
commit
243b84bd13
8 changed files with 228 additions and 142 deletions
11
README.md
11
README.md
|
|
@ -154,13 +154,20 @@ It can also be a self invoking function that returns an array of objects :
|
|||
x:{min:0,max:1},
|
||||
y:{min:0,max:1}
|
||||
},
|
||||
absolute:false // [bool] set to true for absolute value on touch/click instead of relative dragging
|
||||
absolute:false, // [bool] set to true for absolute value on touch/click instead of relative dragging
|
||||
split:false // [bool|object] sends separate osc messages for x and y axes
|
||||
// if true : '/x' & '/y' will be appended to the widget's path
|
||||
// or object : {x:'/osc_path_x', y:'/osc_path_y'}
|
||||
|
||||
```
|
||||
|
||||
- **rgb**
|
||||
```
|
||||
type:'rgb',
|
||||
absolute:false // [bool] set to true for absolute value on touch/click instead of relative dragging
|
||||
absolute:false, // [bool] set to true for absolute value on touch/click instead of relative dragging
|
||||
split:false // [bool|object] sends separate osc messages for x and y axes
|
||||
// if true : '/r', '/g' & '/b' will be appended to the widget's path
|
||||
// or object : {r:'/osc_path_r', g:'/osc_path_g',b:'/osc_path_b'}
|
||||
```
|
||||
Variant of xy pad, it outputs rgb values between 0 and 255.
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -154,8 +154,12 @@ init = function(session,callback) {
|
|||
$('.inspector .result').html(data)
|
||||
})
|
||||
|
||||
// MASTER DRAGGING (wip)
|
||||
// $('body').drag(function(ev,dd){
|
||||
// $(ev.target).trigger('draginit',[ev])
|
||||
// })
|
||||
|
||||
|
||||
if (callback) callback()
|
||||
if (callback) callback()
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
sendOsc = function(data){
|
||||
// Unpack args for osc sending function
|
||||
ipc.send('sendOsc', {target:data[0],path:data[1],args:data[2]})
|
||||
ipc.send('sendOsc', data)
|
||||
}
|
||||
|
||||
saveState = function () {
|
||||
|
|
|
|||
|
|
@ -104,9 +104,11 @@ createWidget.toggle = createWidget.button = function(widgetData) {
|
|||
|
||||
}
|
||||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v])
|
||||
sendOsc({
|
||||
target:widgetData.target,
|
||||
path:widgetData.path,
|
||||
args:v
|
||||
})
|
||||
}
|
||||
widget.setValue()
|
||||
return widget
|
||||
|
|
@ -147,9 +149,11 @@ createWidget.switch = function(widgetData) {
|
|||
|
||||
}
|
||||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v])
|
||||
sendOsc({
|
||||
target:widgetData.target,
|
||||
path:widgetData.path,
|
||||
args:v
|
||||
})
|
||||
}
|
||||
return widget
|
||||
}
|
||||
|
|
@ -172,7 +176,11 @@ createWidget.xy = function(widgetData) {
|
|||
pad = widget.find('.xy'),
|
||||
value = {x:widget.find('.x'),y:widget.find('.y')},
|
||||
range = widgetData.range || {x:{min:0,max:1},y:{min:0,max:1}},
|
||||
absolute = widgetData.absolute
|
||||
absolute = widgetData.absolute,
|
||||
split = widgetData.split?
|
||||
typeof widgetData.split == 'object'?
|
||||
widgetData.split:{x:widgetData.path+'/x',y:widgetData.path+'/y'}
|
||||
:false
|
||||
|
||||
|
||||
widgetData.range = range
|
||||
|
|
@ -190,9 +198,9 @@ createWidget.xy = function(widgetData) {
|
|||
|
||||
var off = {x:0,y:0}
|
||||
if (absolute) {
|
||||
handle.drag('init',function(e){
|
||||
var h = handle.height + (-e.offsetY * 100 / pad.height),
|
||||
w = (e.offsetX * 100 / pad.width)
|
||||
pad.drag('init',function(ev,dd){
|
||||
var h = ((pad.height-dd.offsetY) * 100 / pad.height),
|
||||
w = (dd.offsetX * 100 / pad.width)
|
||||
handle[0].setAttribute('style','height:'+h+'%;width:'+w+'%')
|
||||
handle.height = h
|
||||
handle.width = w
|
||||
|
|
@ -205,11 +213,11 @@ createWidget.xy = function(widgetData) {
|
|||
off = {x:handle.width,y:handle.height}
|
||||
})
|
||||
} else {
|
||||
handle.drag('init',function(){
|
||||
pad.drag('init',function(){
|
||||
off = {x:handle.width,y:handle.height}
|
||||
})
|
||||
}
|
||||
handle.drag(function( ev, dd ){
|
||||
pad.drag(function( ev, dd ){
|
||||
var h = clip((-dd.deltaY)*100/pad.height+off.y,[0,100]),
|
||||
w = clip((dd.deltaX)*100/pad.width+off.x,[0,100])
|
||||
handle[0].setAttribute('style','height:'+h+'%;width:'+w+'%')
|
||||
|
|
@ -245,9 +253,25 @@ createWidget.xy = function(widgetData) {
|
|||
if (send) widget.sendValue(v)
|
||||
}
|
||||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v])
|
||||
sendOsc({
|
||||
target:split?false:widgetData.target,
|
||||
path:widgetData.path,
|
||||
args:v
|
||||
})
|
||||
if (split) {
|
||||
sendOsc({
|
||||
target:widgetData.target,
|
||||
path:split.x,
|
||||
args:v[0],
|
||||
sync:false
|
||||
})
|
||||
sendOsc({
|
||||
target:widgetData.target,
|
||||
path:split.y,
|
||||
args:v[1],
|
||||
sync:false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
widget.showValue = function(v) {
|
||||
|
|
@ -292,8 +316,13 @@ createWidget.rgb = function(widgetData) {
|
|||
rgbHandle = widget.find('.rgb .handle'),
|
||||
hueHandle = widget.find('.hue .handle'),
|
||||
pad = widget.find('.xy'),
|
||||
value = {r:widget.find('input.r'),g:widget.find('input.g'),b:widget.find('input.b')}
|
||||
absolute = widgetData.absolute
|
||||
huePad = widget.find('.hue'),
|
||||
value = {r:widget.find('input.r'),g:widget.find('input.g'),b:widget.find('input.b')},
|
||||
absolute = widgetData.absolute,
|
||||
split = widgetData.split?
|
||||
typeof widgetData.split == 'object'?
|
||||
widgetData.split:{r:widgetData.path+'/r',g:widgetData.path+'/g',b:widgetData.path+'/b'}
|
||||
:false
|
||||
|
||||
|
||||
widgetData.range = {r:{min:0,max:255},g:{min:0,max:255},b:{min:255}}
|
||||
|
|
@ -314,9 +343,9 @@ createWidget.rgb = function(widgetData) {
|
|||
|
||||
var rgbOff = {x:0,y:0}
|
||||
if (absolute) {
|
||||
rgbHandle.drag('init',function(e){
|
||||
var h = rgbHandle.height + (-e.offsetY * 100 / pad.height),
|
||||
w = (e.offsetX * 100 / pad.width)
|
||||
pad.drag('init',function(ev,dd){
|
||||
var h = ((pad.height-dd.offsetY) * 100 / pad.height),
|
||||
w = (dd.offsetX * 100 / pad.width)
|
||||
rgbHandle[0].setAttribute('style','height:'+h+'%;width:'+w+'%')
|
||||
rgbHandle.height = h
|
||||
rgbHandle.width = w
|
||||
|
|
@ -329,11 +358,11 @@ createWidget.rgb = function(widgetData) {
|
|||
rgbOff = {x:rgbHandle.width,y:rgbHandle.height}
|
||||
})
|
||||
} else {
|
||||
rgbHandle.drag('init',function(){
|
||||
pad.drag('init',function(){
|
||||
rgbOff = {x:rgbHandle.width,y:rgbHandle.height}
|
||||
})
|
||||
}
|
||||
rgbHandle.drag(function( ev, dd ){
|
||||
pad.drag(function( ev, dd ){
|
||||
var h = clip((-dd.deltaY)*100/pad.height+rgbOff.y,[0,100]),
|
||||
w = clip(dd.deltaX*100/pad.width+rgbOff.x,[0,100])
|
||||
rgbHandle[0].setAttribute('style','height:'+h+'%;width:'+w+'%')
|
||||
|
|
@ -351,8 +380,8 @@ createWidget.rgb = function(widgetData) {
|
|||
|
||||
var hueOff = 0
|
||||
if (absolute) {
|
||||
hueHandle.drag('init',function(e){
|
||||
var d = (e.offsetX * 100 / pad.width)
|
||||
huePad.drag('init',function(ev,dd){
|
||||
var d = (dd.offsetX * 100 / pad.width)
|
||||
hueHandle[0].setAttribute('style','width:'+d+'%')
|
||||
hueHandle.width = d
|
||||
|
||||
|
|
@ -372,13 +401,13 @@ createWidget.rgb = function(widgetData) {
|
|||
hueOff = hueHandle.width
|
||||
})
|
||||
} else {
|
||||
hueHandle.drag('init',function(){
|
||||
huePad.drag('init',function(){
|
||||
hueOff = hueHandle.width
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
hueHandle.drag(function( ev, dd ){
|
||||
huePad.drag(function( ev, dd ){
|
||||
var w = clip(dd.deltaX*100/pad.width+hueOff,[0,100])
|
||||
hueHandle[0].setAttribute('style','width:'+w+'%')
|
||||
hueHandle.width = w
|
||||
|
|
@ -440,9 +469,31 @@ createWidget.rgb = function(widgetData) {
|
|||
if (send) widget.sendValue(v)
|
||||
}
|
||||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v])
|
||||
sendOsc({
|
||||
target:split?false:widgetData.target,
|
||||
path:widgetData.path,
|
||||
args:v
|
||||
})
|
||||
if (split) {
|
||||
sendOsc({
|
||||
target:widgetData.target,
|
||||
path:split.r,
|
||||
args:v[0],
|
||||
sync:false
|
||||
})
|
||||
sendOsc({
|
||||
target:widgetData.target,
|
||||
path:split.g,
|
||||
args:v[1],
|
||||
sync:false
|
||||
})
|
||||
sendOsc({
|
||||
target:widgetData.target,
|
||||
path:split.b,
|
||||
args:v[2],
|
||||
sync:false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -488,6 +539,7 @@ createWidget.fader = function(widgetData,container){
|
|||
</div>
|
||||
`),
|
||||
handle = widget.find('.handle'),
|
||||
wrapper = widget.find('.fader-wrapper'),
|
||||
fader = widget.find('.fader'),
|
||||
pips = widget.find('.pips'),
|
||||
input = widget.find('input'),
|
||||
|
|
@ -499,19 +551,21 @@ createWidget.fader = function(widgetData,container){
|
|||
if (widgetData.horizontal) container.addClass('horizontal')
|
||||
|
||||
handle.size = 0
|
||||
fader.size = dimension=='height'?fader.height():fader.width()
|
||||
fader.size = dimension=='height'?fader.outerHeight():fader.outerWidth()
|
||||
wrapper.size = dimension=='height'?wrapper.outerHeight():wrapper.outerWidth()
|
||||
|
||||
fader.resize(function(){
|
||||
fader.size=dimension=='height'?fader.height():fader.width()
|
||||
fader.size= dimension=='height'?fader.outerHeight():fader.outerWidth()
|
||||
wrapper.size = dimension=='height'?wrapper.outerHeight():wrapper.outerWidth()
|
||||
})
|
||||
|
||||
|
||||
var off = 0
|
||||
if (absolute) {
|
||||
handle.drag('init',function(e){
|
||||
wrapper.drag('init',function(ev,dd){
|
||||
var d = (dimension=='height')?
|
||||
handle.size + (-e.offsetY * 100 / fader.size):
|
||||
(e.offsetX * 100 / fader.size)
|
||||
((fader.size-dd.offsetY+(wrapper.size-fader.size)/2) * 100 / fader.size):
|
||||
(dd.offsetX - (wrapper.size-fader.size)/2) * 100 / fader.size
|
||||
handle[0].setAttribute('style',dimension+':'+d+'%')
|
||||
handle.size = d
|
||||
|
||||
|
|
@ -524,13 +578,13 @@ createWidget.fader = function(widgetData,container){
|
|||
off = handle.size
|
||||
})
|
||||
} else {
|
||||
handle.drag('init',function(){
|
||||
wrapper.drag('init',function(){
|
||||
off = handle.size
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
handle.drag(function( ev, dd ){
|
||||
wrapper.drag(function( ev, dd ){
|
||||
var d = (dimension=='height')?-dd.deltaY:dd.deltaX
|
||||
|
||||
d = clip(d*100/fader.size+off,[0,100])
|
||||
|
|
@ -609,9 +663,11 @@ createWidget.fader = function(widgetData,container){
|
|||
}
|
||||
|
||||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v])
|
||||
sendOsc({
|
||||
target:widgetData.target,
|
||||
path:widgetData.path,
|
||||
args:v
|
||||
})
|
||||
}
|
||||
|
||||
widget.showValue = function(v) {
|
||||
|
|
@ -641,6 +697,7 @@ createWidget.knob = function(widgetData) {
|
|||
<input></input>
|
||||
</div>
|
||||
`),
|
||||
wrapper = widget.find('.knob-wrapper'),
|
||||
knob = widget.find('.knob'),
|
||||
input = widget.find('input'),
|
||||
range = widgetData.range || {min:0,max:1},
|
||||
|
|
@ -659,23 +716,26 @@ createWidget.knob = function(widgetData) {
|
|||
|
||||
knob.rotation = 0
|
||||
|
||||
var offR = 0
|
||||
var offR = 0,
|
||||
offX = 0,
|
||||
offY = 0
|
||||
knob[0].setAttribute('style','transform:rotate(45deg)')
|
||||
knob.drag('init',function(ev,dd){
|
||||
wrapper.drag('init',function(ev,dd){
|
||||
|
||||
if (absolute) {
|
||||
|
||||
var rect= knob[0].getBoundingClientRect(),
|
||||
rad = knob.rotation*Math.PI/180,
|
||||
w = dd.target.clientWidth * Math.abs( Math.sin( rad) ) + dd.target.clientWidth * Math.abs( Math.cos( rad ) ),
|
||||
h = dd.target.clientHeight * Math.abs( Math.cos( rad ) ) + dd.target.clientHeight * Math.abs( Math.sin( rad ) )
|
||||
x = dd.startX-rect.left-w/2,
|
||||
y = dd.startY-rect.top-h/2
|
||||
angle = Math.atan2(-y, -x) * 180 / Math.PI +45
|
||||
var w = dd.target.clientWidth,
|
||||
h = dd.target.clientHeight,
|
||||
x = dd.offsetX-w/2,
|
||||
y = dd.offsetY-h/2,
|
||||
angle = Math.atan2(-y, -x) * 180 / Math.PI +45,
|
||||
r = angle<-90?angle+360:angle
|
||||
r = (angle>-90 && angle<-45)?270:r
|
||||
r = clip(r,[0,270])
|
||||
|
||||
offX = x
|
||||
offY = y
|
||||
|
||||
knob[0].setAttribute('style','transform:rotateZ('+r+'deg)')
|
||||
knob.rotation = r
|
||||
|
||||
|
|
@ -694,19 +754,17 @@ createWidget.knob = function(widgetData) {
|
|||
offR = knob.rotation
|
||||
})
|
||||
|
||||
knob.drag(function( ev, dd ){
|
||||
wrapper.drag(function( ev, dd ){
|
||||
|
||||
var r = clip(-dd.deltaY*2+offR,[0,270])
|
||||
|
||||
if (absolute) {
|
||||
|
||||
var rect= knob[0].getBoundingClientRect(),
|
||||
rad = knob.rotation*Math.PI/180,
|
||||
w = dd.target.clientWidth * Math.abs( Math.sin( rad) ) + dd.target.clientWidth * Math.abs( Math.cos( rad ) ),
|
||||
h = dd.target.clientHeight * Math.abs( Math.cos( rad ) ) + dd.target.clientHeight * Math.abs( Math.sin( rad ) )
|
||||
x = ev.pageX-rect.left-w/2,
|
||||
y = ev.pageY-rect.top-h/2
|
||||
angle = Math.atan2(-y, -x) * 180 / Math.PI +45
|
||||
var w = dd.target.clientWidth,
|
||||
h = dd.target.clientHeight,
|
||||
x = dd.deltaX + offX,
|
||||
y = dd.deltaY + offY,
|
||||
angle = Math.atan2(-y, -x) * 180 / Math.PI +45,
|
||||
r = angle<-90?angle+360:angle
|
||||
r = (angle>-90 && angle<-45)?270:r
|
||||
r = clip(r,[0,270])
|
||||
|
|
@ -738,9 +796,11 @@ createWidget.knob = function(widgetData) {
|
|||
input.val(v+unit)
|
||||
}
|
||||
widget.sendValue = function(v) {
|
||||
var t = widgetData.target,
|
||||
p = widgetData.path
|
||||
sendOsc([t,p,v])
|
||||
sendOsc({
|
||||
target:widgetData.target,
|
||||
path:widgetData.path,
|
||||
args:v
|
||||
})
|
||||
}
|
||||
widget.setValue = function(v,send,sync) {
|
||||
var r = mapToScale(v,[range.min,range.max],[0,270])
|
||||
|
|
|
|||
|
|
@ -313,9 +313,14 @@ drag = $special.drag = {
|
|||
// original element position
|
||||
obj.originalX = ia.offset.left;
|
||||
obj.originalY = ia.offset.top;
|
||||
// adjusted element position
|
||||
obj.offsetX = obj.originalX + obj.deltaX;
|
||||
obj.offsetY = obj.originalY + obj.deltaY;
|
||||
|
||||
// NOT adjusted element position
|
||||
obj.offsetX = event.offsetX;
|
||||
obj.offsetY = event.offsetY;
|
||||
// adjusted element position
|
||||
// obj.offsetX = obj.originalX + obj.deltaX;
|
||||
// obj.offsetY = obj.originalY + obj.deltaY;
|
||||
|
||||
// assign the drop targets information
|
||||
obj.drop = drag.flatten( ( ia.drop || [] ).slice() );
|
||||
obj.available = drag.flatten( ( ia.droppable || [] ).slice() );
|
||||
|
|
|
|||
|
|
@ -855,9 +855,14 @@ form {
|
|||
position:relative;
|
||||
width:100%;
|
||||
padding-bottom: 90%;
|
||||
// border:1px solid $color-border;
|
||||
//background: $color-bg;
|
||||
overflow: hidden;
|
||||
cursor: -webkit-grab;
|
||||
&:active {
|
||||
cursor: -webkit-grabbing;
|
||||
.handle:after {
|
||||
transform: scale(1.5);
|
||||
}
|
||||
}
|
||||
.handle {
|
||||
position:absolute;
|
||||
height:0rem;
|
||||
|
|
@ -867,13 +872,7 @@ form {
|
|||
max-height:100%;
|
||||
max-width:100%;
|
||||
z-index:2;
|
||||
cursor: -webkit-grab;
|
||||
&:active {
|
||||
cursor: -webkit-grabbing;
|
||||
&:after {
|
||||
transform: scale(1.5);
|
||||
}
|
||||
}
|
||||
pointer-events: none;
|
||||
&:after {
|
||||
content:"";
|
||||
position:absolute;
|
||||
|
|
@ -888,15 +887,6 @@ form {
|
|||
box-shadow: 0 0 0 1000rem rgba($color-base,.5), 0 0 0 1px rgba(white,.2);
|
||||
}
|
||||
|
||||
&::before {
|
||||
content:"";
|
||||
position:absolute;
|
||||
top:-.5rem;
|
||||
left:-1px;
|
||||
width:2000rem;
|
||||
height:2000rem;
|
||||
margin:-1000rem 0 0 -1000rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -936,6 +926,13 @@ form {
|
|||
background:transparent linear-gradient(to left, #F00, #FF0080, #F0F, #8000FF, #00F, #0080FF, #0FF, #00FF80, #0F0, #80FF00, #FF0, #FF8000, #F00) repeat scroll 0% 0%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
cursor: -webkit-grab;
|
||||
&:active {
|
||||
cursor: -webkit-grabbing;
|
||||
.handle:after {
|
||||
transform: scale(1.5);
|
||||
}
|
||||
}
|
||||
.handle {
|
||||
position:absolute;
|
||||
height:100%;
|
||||
|
|
@ -944,13 +941,7 @@ form {
|
|||
z-index:2;
|
||||
left:0;
|
||||
bottom:0;
|
||||
cursor: -webkit-grab;
|
||||
&:active {
|
||||
cursor: -webkit-grabbing;
|
||||
&:after {
|
||||
transform: scale(1.5);
|
||||
}
|
||||
}
|
||||
pointer-events: none;
|
||||
&:after {
|
||||
content:"";
|
||||
position:absolute;
|
||||
|
|
@ -962,16 +953,6 @@ form {
|
|||
height: 11rem;
|
||||
margin:-5rem -4rem 0 0;
|
||||
}
|
||||
&:before {
|
||||
content:"";
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
width:2000rem;
|
||||
height:100%;
|
||||
margin-left:-1000rem;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1011,7 +992,10 @@ form {
|
|||
overflow:hidden;
|
||||
height:100%;
|
||||
position: relative;
|
||||
|
||||
cursor: -webkit-grab;
|
||||
&:active {
|
||||
cursor: -webkit-grabbing;
|
||||
}
|
||||
.fader {
|
||||
height:100%;
|
||||
width:4rem;
|
||||
|
|
@ -1019,6 +1003,7 @@ form {
|
|||
position: relative;
|
||||
margin:0 auto;
|
||||
left:-25rem;
|
||||
pointer-events: none;
|
||||
&.nogauge {
|
||||
.handle {
|
||||
background:none;
|
||||
|
|
@ -1032,12 +1017,9 @@ form {
|
|||
height:0rem;
|
||||
max-height:100%;
|
||||
max-width:100%;
|
||||
cursor: -webkit-grab;
|
||||
background:$color-accent;
|
||||
z-index: 1;
|
||||
&:active {
|
||||
cursor: -webkit-grabbing;
|
||||
}
|
||||
|
||||
&:before {
|
||||
content:"";
|
||||
position: absolute;
|
||||
|
|
@ -1050,14 +1032,6 @@ form {
|
|||
border-radius: 100%!important;
|
||||
box-shadow: 0 0 0 5rem transparentize($color-accent,.8),0 0 2px 0 mix($color-text,$color-fg,2);
|
||||
}
|
||||
&:after {
|
||||
content:"";
|
||||
position: absolute;
|
||||
height:2000rem;
|
||||
width:2000rem;
|
||||
margin:-1000rem 0 0 -1000rem;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1110,6 +1084,11 @@ form {
|
|||
.handle {
|
||||
height:100%!important;
|
||||
width:0;
|
||||
&:before {
|
||||
top:-2rem;
|
||||
right:-6rem;
|
||||
left:auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
.pips {
|
||||
|
|
@ -1147,19 +1126,21 @@ form {
|
|||
// min-width: 100rem;
|
||||
min-height: 135rem;
|
||||
flex-shrink: 0;
|
||||
padding-top:15rem;
|
||||
&.nolabel .knob-wrapper-outer{
|
||||
padding-top:15rem;
|
||||
top:0;
|
||||
}
|
||||
.knob-wrapper-outer {
|
||||
width: 100%;
|
||||
top: 0;
|
||||
top: 30rem;
|
||||
bottom: 0;
|
||||
padding-bottom:15rem;
|
||||
padding-bottom:30rem;
|
||||
overflow: hidden;
|
||||
// position: absolute;
|
||||
|
||||
input {
|
||||
bottom:-15rem;
|
||||
position: relative;
|
||||
bottom:0;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
|
|
@ -1183,15 +1164,22 @@ form {
|
|||
}
|
||||
|
||||
.knob-wrapper {
|
||||
padding:5rem 20rem;
|
||||
padding:20rem;
|
||||
margin:0 auto;
|
||||
|
||||
width:95rem;
|
||||
|
||||
position: relative;
|
||||
|
||||
cursor: -webkit-grab;
|
||||
&:active {
|
||||
cursor: -webkit-grabbing;
|
||||
}
|
||||
|
||||
.knob-mask {
|
||||
width:100%;
|
||||
padding-bottom:100%;
|
||||
border-radius:100%;
|
||||
pointer-events: none;
|
||||
position: relative;
|
||||
&:before {
|
||||
content:"";
|
||||
|
|
@ -1221,10 +1209,8 @@ form {
|
|||
top:0;left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
cursor: -webkit-grab;
|
||||
&:active {
|
||||
cursor: -webkit-grabbing;
|
||||
}
|
||||
pointer-events: none;
|
||||
|
||||
|
||||
&:after {
|
||||
content:"";
|
||||
|
|
@ -1267,14 +1253,7 @@ form {
|
|||
left: 50%;
|
||||
bottom: -3rem;
|
||||
}
|
||||
&:after {
|
||||
content:"";
|
||||
position: absolute;
|
||||
height:2000rem;
|
||||
width:2000rem;
|
||||
margin:-1000rem 0 0 -1000rem;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1284,14 +1263,14 @@ form {
|
|||
color:$color-text;
|
||||
pointer-events: none;
|
||||
&.min {
|
||||
bottom:-5rem;
|
||||
bottom:7.5rem;
|
||||
left:0;
|
||||
right:50%;
|
||||
width:50%;
|
||||
text-align:center;
|
||||
}
|
||||
&.max {
|
||||
bottom:-5rem;
|
||||
bottom:7.5rem;
|
||||
left:50%;
|
||||
width:50%;
|
||||
right:0;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ var app = require('app')
|
|||
'h':{alias:'host',type:'array',describe:'synchronized hosts (ip:port pairs)'},
|
||||
'c':{alias:'compile',type:'boolean',describe:'recompile stylesheets (increases startup time)'},
|
||||
'l':{alias:'load',type:'string',describe:'session file to load'},
|
||||
'p':{alias:'port',describe:'osc input port (for synchronization)'}
|
||||
'p':{alias:'port',describe:'osc input port (for synchronization)'},
|
||||
'f':{alias:'floats',type:'boolean',describe:'force numbers to be sent as floats only'}
|
||||
})
|
||||
.check(function(a,x){if(a.port==undefined || !isNaN(a.p)&&a.p>1023&&parseInt(a.p)===a.p){return true}else{throw 'Error: Port must be an integer >= 1024'}})
|
||||
.check(function(a,x){if(a.host==undefined || a.h.join(' ').match('^([^:\s]*:[0-9]{4,5}[\s]*)*$')!=null){return true}else{throw 'Error: Hosts must ne ip:port pairs & port must be >= 1024'}})
|
||||
|
|
@ -24,8 +25,8 @@ var app = require('app')
|
|||
.argv
|
||||
|
||||
, settings = {
|
||||
presetPath : __dirname,
|
||||
sessionPath: __dirname,
|
||||
presetPath : process.cwd(),
|
||||
sessionPath: process.cwd(),
|
||||
recentSessions: [],
|
||||
|
||||
appName: argv.n || 'Controller',
|
||||
|
|
@ -33,6 +34,7 @@ var app = require('app')
|
|||
oscInPort: argv.p || false,
|
||||
compileScss: argv.c || false,
|
||||
sessionFile: argv.l || false,
|
||||
floatsOnly: argv.f || false,
|
||||
|
||||
|
||||
persistent: function(){var c = {};try {c=require( __dirname + '/config.json')} finally {return c}}(),
|
||||
|
|
@ -95,7 +97,8 @@ app.on('ready', function() {
|
|||
width: 800,
|
||||
height: 600,
|
||||
title:settings.read('appName'),
|
||||
'auto-hide-menu-bar':true
|
||||
'auto-hide-menu-bar':true,
|
||||
'background-color':'#1a1d22'
|
||||
})
|
||||
|
||||
window.loadUrl('file://' + __dirname + '/../browser/index.html')
|
||||
|
|
@ -145,13 +148,42 @@ if (settings.read('oscInPort')) {
|
|||
})
|
||||
}
|
||||
|
||||
function sendOsc(host,port,path,args) {
|
||||
sendOsc = function(host,port,path,args) {
|
||||
var client = new osc.Client(host, port)
|
||||
client.send(path, args, function () {
|
||||
client.kill()
|
||||
})
|
||||
}
|
||||
|
||||
if (settings.read('floatsOnly')) {
|
||||
sendOsc = function(host,port,path,args) {
|
||||
var client = new osc.Client(host, port)
|
||||
|
||||
var message = new osc.Message(path)
|
||||
|
||||
if (typeof args=='object') {
|
||||
for (i in args) {
|
||||
var arg = args[i]
|
||||
if (typeof arg == 'number') {
|
||||
message.append({type:'float',value:arg})
|
||||
} else {
|
||||
message.append({type:'string',value:arg})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (typeof args == 'number') {
|
||||
message.append({type:'float',value:args})
|
||||
} else {
|
||||
message.append({type:'string',value:args})
|
||||
}
|
||||
}
|
||||
|
||||
client.send(message, function () {
|
||||
client.kill()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// mainProcess & renderProcess async i/o
|
||||
|
|
@ -203,7 +235,7 @@ ipc.on('sendOsc', function (event,data) {
|
|||
|
||||
var targets = []
|
||||
|
||||
if (settings.read('syncTargets')) Array.prototype.push.apply(targets, settings.read('syncTargets'))
|
||||
if (settings.read('syncTargets') && data.sync!==false) Array.prototype.push.apply(targets, settings.read('syncTargets'))
|
||||
if (data.target) Array.prototype.push.apply(targets, data.target)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue