From 243b84bd13834390664380c2ace4503499104108 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 24 Oct 2015 13:46:24 +0200 Subject: [PATCH] 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) --- README.md | 11 +- app/browser/css/style.css | 2 +- app/browser/js/app/init.js | 6 +- app/browser/js/app/utils.js | 3 +- app/browser/js/app/widgets.js | 178 ++++++++++++------ .../js/jquery/jquery.event.drag-2.2.js | 11 +- app/browser/scss/style.scss | 115 +++++------ app/main/main.js | 44 ++++- 8 files changed, 228 insertions(+), 142 deletions(-) diff --git a/README.md b/README.md index 2f95c4e5..91d43685 100644 --- a/README.md +++ b/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. diff --git a/app/browser/css/style.css b/app/browser/css/style.css index 508e721f..710758c9 100644 --- a/app/browser/css/style.css +++ b/app/browser/css/style.css @@ -1 +1 @@ -@charset "UTF-8";* { margin: 0; padding: 0; box-sizing: border-box; text-decoration: none; outline: 0; font: inherit; cursor: inherit; }a { cursor: pointer; display: block; }::-webkit-scrollbar { width: 10px; height: 10px; opacity: 1; }::-webkit-scrollbar-track-piece { background: #1a1d22; }::-webkit-scrollbar-track-piece:vertical { border-left: 1px solid #1a1d22; }::-webkit-scrollbar-track-piece:horizontal { border-top: 1px solid #1a1d22; }::-webkit-scrollbar-corner { background: #1a1d22; }::-webkit-scrollbar-thumb { background: linear-gradient(#2d3139, #2b2f37 15rem); }::-webkit-scrollbar-thumb:vertical { border: 1px solid #1a1d22; border-width: 0 1px 0 1px; }::-webkit-scrollbar-thumb:horizontal { border: 1px solid #1a1d22; border-width: 1px 0 1px 0; }* { -webkit-user-select: none; }.inspector * { -webkit-user-select: initial; }.inspector *::selection { background: #528bff !important; }input:focus::selection { background: #528bff; }input { cursor: text; }html, body { height: 100%; overflow: hidden; position: relative; }html { font-size: 1px; }body { font-size: 14rem; line-height: 16rem; font-family: sans; color: #cccccc; white-space: nowrap; opacity: 1; cursor: default; }.btn { background: linear-gradient(#2d3139, #2b2f37 15rem); display: block; border: 1px solid #1a1d22; padding: 15rem; }a.btn:hover { background-image: linear-gradient(#32363d, #2d3139); }#lobby { background: #22252c; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 2; border: 1px solid #1a1d22; display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 20rem; }#lobby .main { width: 600rem; max-height: 100%; }#lobby .header { background: linear-gradient(#2d3139, #2b2f37 15rem); padding: 20rem; font-weight: bold; box-shadow: 0 0 0 1px #1a1d22 inset; white-space: nowrap; text-overflow: ellipsis; }#lobby a { padding-right: 35rem; overflow: hidden; margin-top: 10rem; position: relative; white-space: nowrap; text-overflow: ellipsis; }#lobby a span { position: absolute; right: 0rem; top: 0rem; padding: 15rem; color: #999999; }#lobby a span:hover { color: #cccccc; }#container { background: #22252c; position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; transition: right 0.2s; }#container.sidepanel-open { right: 300rem; }#container #open-toggle { position: absolute; right: 0; top: 2rem; width: 60rem; height: 60rem; padding: 0 10rem; line-height: 60rem; font-size: 24rem; text-align: center; color: #999999; z-index: 2; }#container #open-toggle.sidepanel-open { color: #cccccc; }#sidepanel { position: absolute; z-index: 999999; width: 300rem; top: 0; right: 0; bottom: 0; margin-right: -300rem; background: #282c34; border-left: 1px solid #1a1d22; transition: right 0.2s; overflow-y: auto; overflow-x: visible; }#sidepanel.sidepanel-open { right: 300rem; }#sidepanel #options { position: absolute; left: 0; top: 2rem; right: 0; bottom: 0; padding: 5rem; list-style: none; background: #282c34; }#sidepanel #options li { display: block; margin-bottom: 5rem; background: linear-gradient(#2d3139, #2b2f37 15rem); }#sidepanel #options .inspector { padding: 10rem; }#sidepanel #options .inspector .result { background: #1a1d22; border-radius: 3rem; margin-top: 10rem; padding: 10rem; color: #999999; white-space: pre; word-wrap: break-word; width: 100%; max-height: 300rem; overflow-y: auto; }#sidepanel #options .inspector .result::-webkit-scrollbar-track-piece, #sidepanel #options .inspector .result::-webkit-scrollbar-thumb { border-color: #1a1d22 !important; }#sidepanel #options .inspector .result::-webkit-scrollbar-thumb { background: #22252c !important; opacity: 0.6 !important; }.nicescroll-rails-hr { margin-top: 3rem; }.nicescroll-rails-vr { display: none !important; }a { color: inherit; }.navigation { position: absolute; top: 0; left: 0; right: 0; z-index: 1; font-size: 14rem; background: #22252c; border-bottom: 1px solid #1a1d22; border-top: 1px solid #282c34; height: 60rem; }.navigation ::first-letter { text-transform: uppercase; }.navigation.main { padding-right: 55rem; right: 0; }.navigation ul { list-style: none; display: flex; padding: 7rem 6rem; }.navigation ul li.on + li { border-image: none; border-left: 1px solid transparent; }.navigation ul li { display: block; max-width: 250rem; flex: 1; border-width: 0 0 0 1px; border-image: linear-gradient(rgba(26, 29, 34, 0), #1a1d22, rgba(26, 29, 34, 0)) 0 0 0 1 stretch; }.navigation ul li:first-child, .navigation ul li.on { border-image: none; border-left: 1px solid transparent; }.navigation ul li:first-child { border-left: 0; }.navigation ul li a { display: block; padding: 5rem 10rem; line-height: 34rem; border-radius: 3rem; overflow: hidden; text-align: center; border: 1px solid transparent; position: relative; color: #999999; }.navigation ul li a span { display: block; width: 100%; -webkit-mask: linear-gradient(to left, transparent, #000000 10rem) no-repeat; }.navigation ul li a.on { background: #282c34; border: 1px solid #1a1d22; color: #cccccc; }.navigation ul li a.on:before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.06); background: linear-gradient(rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)); }.navigation ul li a.on:after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4rem; }.content { position: absolute; left: 0; top: 60rem; right: 0; bottom: 0; background: #282c34; }.content .content { top: 60rem; }#loading { position: absolute; top: 50%; left: 50%; margin-top: -15rem; text-align: center; }#loading .spinner { display: block; margin: 0 auto; height: 30rem; width: 30rem; border-radius: 50%; border: 2rem solid rgba(0, 0, 0, 0.2); border-top-color: #528bff; animation: spin 0.5s linear infinite; }#loading #status { margin-top: 10rem; display: inline-block; }@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }.popup { position: fixed; top: 0; left: 0; right: 0; bottom: 0; padding: 10%; background: rgba(0, 0, 0, 0.5); z-index: 1000000; }.popup .popup-title { position: relative; padding: 15rem; background: linear-gradient(#2d3139, #2b2f37 15rem); }.popup .popup-title .closer { position: absolute; right: 0rem; top: 0; padding: 15rem; color: #999999; cursor: pointer; }.popup .popup-title .closer:hover { color: #cccccc; }.popup .popup-wrapper { background: #282c34; height: 100%; width: 100%; max-width: 600rem; margin: 0 auto; position: relative; overflow: hidden; border: 1px solid #1a1d22; }.popup .popup-wrapper .popup-content { height: 100%; width: 100%; padding: 10rem; overflow-y: scroll; white-space: normal; }form label { display: block; padding-top: 10rem; margin-bottom: 10rem; }form .info { color: #999999; margin-bottom: 10rem; }form input { display: block; margin-bottom: 10rem; background: #22252c; font: inherit; color: #cccccc; border: 1px solid #1a1d22; width: 100%; padding: 10rem; }form input.invalid { box-shadow: 0 0 0 1px rgba(255, 0, 0, 0.3) !important; }form input:focus { box-shadow: 0 0 0 1px #528bff; }form .submit { margin-top: 30rem; }.tab.on.stretch { display: flex; justify-content: space-between; }.tab.on.stretch > .widget { width: 100%; }.tab { display: none; overflow: auto; position: relative; }.tab.on { display: block; height: 100%; width: auto; }.widget { display: inline-block; height: auto; min-width: 100rem; overflow: hidden; position: relative; font-size: 13rem; padding: 35rem 1px 0; vertical-align: top; border: 6rem solid transparent; border-width: 6rem 0; margin: 0 3rem; box-shadow: 0 0 0 1px #22252c inset; background: linear-gradient(#2d3139, #2b2f37 15rem); background-clip: padding-box; -webkit-tap-highlight-color: transparent; }.widget:first-child { margin-left: 6rem; }.widget:last-child { margin-right: 6rem; }.widget.nolabel { padding-top: 0; }.widget.nolabel > .label { display: none; }.widget .label { z-index: 1; padding: 10rem 10rem; position: absolute; top: 0rem; left: 0; right: 0; text-overflow: ellipsis; overflow: hidden; height: 35rem; }.widget .label.accent { color: #528bff; }.widget input { width: 100%; height: 35rem; border: 0; background: #22252c; color: inherit; display: block; padding: 10rem; }.widget input:focus { box-shadow: 0 0 0 1px #528bff inset !important; }.widget input[disabled] { color: #999999; }/* STRIP (contains any widgets) */.strip-container { width: 100rem; height: 100%; overflow: visible; border-bottom: 0; background: none; box-shadow: none; }.strip-container > .label { background: linear-gradient(#2d3139, #2b2f37 15rem); box-shadow: 0 0 0 1px #22252c inset; }.strip-container .strip { height: 100%; display: flex; flex-direction: column; }.strip-container .strip > .widget { display: block; margin: 0; width: auto; }.strip-container .strip > .widget:not(:last-child) { border-bottom-width: 0; }.strip-container .strip > .widget:first-childĀ  { border-top-width: 0; }.strip-container.horizontal { padding-top: 0; padding-left: 40rem; width: 100%; height: auto; margin: 0; border-left-width: 6rem; display: block; }.strip-container.horizontal:last-child { margin-bottom: 6rem; }.strip-container.horizontal.nolabel { padding-left: 0; }.strip-container.horizontal .strip { flex-direction: row; align-items: flex-start; }.strip-container.horizontal .strip > .widget { border-bottom-width: 0; border-top-width: 0; border-right-width: 6rem; flex-shrink: initial; }.strip-container.horizontal .strip > .widget:last-child { border-right-width: 6rem; }.strip-container.horizontal > .label { width: 35rem; height: 100%; left: 0; top: 0; }.strip-container.horizontal > .label span { transform: rotate(180deg); display: block; position: relative; overflow: hidden; text-overflow: ellipsis; -webkit-writing-mode: vertical-lr; text-align: center; height: 100%; }.panel-container { position: absolute; margin: 0 !important; border-top: 0; z-index: 2; }.panel-container .panel { height: 100%; padding: 6rem 0; overflow: auto; }.panel-container .panel > .widget { border: 0; }.panel-container .panel.stretch { display: flex; justify-content: space-between; }.panel-container .panel.stretch > .widget { width: 100%; }/* BUTTONS */.toggle-container { width: 100rem; flex-shrink: 0; padding: 0 !important; cursor: pointer; }.toggle-container .label { position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 29rem 10rem 26rem; line-height: 1rem; background: none !important; text-align: center; pointer-events: none; }.toggle-container:hover { background-image: linear-gradient(#32363d, #2d3139); }.toggle { z-index: 1; padding: 29rem 10rem 26rem; }.toggle .light { position: absolute; left: 4rem; right: 4rem; top: 4rem; height: 4rem; background: #1a1d22; border-radius: 3rem; }.toggle.on .light { background: #528bff; }.switch-container { width: 100rem; flex-shrink: 0; }.switch-container .switch { height: 100%; width: 100%; cursor: pointer; display: flex; flex-direction: column; align-items: stretch; padding-bottom: 1px; }.switch-container .switch .value { background: linear-gradient(#2d3139, #2b2f37 15rem); color: #999999; width: 100%; position: relative; border-top: 1px solid #282c34; padding: 12rem 12rem 12rem 24rem; white-space: normal; text-align: left; word-break: break-all; overflow: hidden; }.switch-container .switch .value:hover { background: linear-gradient(#32363d, #2d3139); }.switch-container .switch .value:last-child { margin-bottom: 0; }.switch-container .switch .value:after { content: ""; position: absolute; left: 8rem; top: 50%; width: 8rem; height: 8rem; margin-top: -4rem; background: #1a1d22; border-radius: 8rem; }.switch-container .switch .value.on:after { background: #528bff; }/* XY */.xy-container, .rgb-container { width: 300rem; flex-shrink: 0; }.xy-wrapper { overflow: hidden; }.xy-wrapper .value { width: 100%; }.xy-wrapper input { width: 50%; float: left; padding: 2rem; text-align: center; position: relative; left: 0rem; right: 0rem; box-shadow: 0 0 1px 0 #1a1d22 inset; }.xy { position: relative; width: 100%; padding-bottom: 90%; overflow: hidden; }.xy .handle { position: absolute; height: 0rem; width: 0rem; bottom: 0; left: 0; max-height: 100%; max-width: 100%; z-index: 2; cursor: -webkit-grab; }.xy .handle:active { cursor: -webkit-grabbing; }.xy .handle:active:after { transform: scale(1.5); }.xy .handle:after { content: ""; position: absolute; top: -.5rem; right: -1px; border-radius: 100% !important; width: 20rem; height: 20rem; margin: -10rem -10rem 0 0; box-shadow: 0 0 0 1000rem rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2); }.xy .handle::before { content: ""; position: absolute; top: -.5rem; left: -1px; width: 2000rem; height: 2000rem; margin: -1000rem 0 0 -1000rem; }.rgb-wrapper input { width: 33.33%; }.rgb { background-color: red; }.rgb:before, .rgb:after { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 100%; }.rgb:before { background: linear-gradient(to right, white 0%, rgba(255, 255, 255, 0) 100%); }.rgb:after { background: linear-gradient(to bottom, transparent 0%, black 100%); /* W3C */ }.hue { width: 100%; height: 30rem; 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; }.hue .handle { position: absolute; height: 100%; max-width: 100%; width: 0; z-index: 2; left: 0; bottom: 0; cursor: -webkit-grab; }.hue .handle:active { cursor: -webkit-grabbing; }.hue .handle:active:after { transform: scale(1.5); }.hue .handle:after { content: ""; position: absolute; top: 50%; right: -1px; box-shadow: 0 0 0 1000rem rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2); border-radius: 100% !important; width: 11rem; height: 11rem; margin: -5rem -4rem 0 0; }.hue .handle:before { content: ""; position: absolute; top: 0; left: 0; width: 2000rem; height: 100%; margin-left: -1000rem; }.fader-container { width: 100rem; min-width: 80rem; height: 100%; min-height: 300rem; }.fader-container.nolabel .fader-wrapper-outer { top: 0; }.fader-container .fader-wrapper-outer { padding-bottom: 30rem; position: absolute; top: 30rem; bottom: 0; left: 1px; right: 1px; }.fader-container .fader-wrapper-outer input { position: absolute; bottom: 0; }.fader-container .fader-wrapper { padding: 20rem; overflow: hidden; height: 100%; position: relative; }.fader-container .fader-wrapper .fader { height: 100%; width: 4rem; background: #1a1d22; position: relative; margin: 0 auto; left: -25rem; }.fader-container .fader-wrapper .fader.nogauge .handle { background: none; }.fader-container .fader-wrapper .fader .handle { position: absolute; bottom: 0 !important; top: auto !important; width: 100%; height: 0rem; max-height: 100%; max-width: 100%; cursor: -webkit-grab; background: #528bff; z-index: 1; }.fader-container .fader-wrapper .fader .handle:active { cursor: -webkit-grabbing; }.fader-container .fader-wrapper .fader .handle:before { content: ""; position: absolute; top: -6rem; left: -2rem; height: 8rem; width: 8rem; background: #528bff; border: none !important; border-radius: 100% !important; box-shadow: 0 0 0 5rem rgba(82, 139, 255, 0.2), 0 0 2px 0 #2b2f37; }.fader-container .fader-wrapper .fader .handle:after { content: ""; position: absolute; height: 2000rem; width: 2000rem; margin: -1000rem 0 0 -1000rem; }.fader-container .fader-wrapper .pips { position: absolute; top: -1%; bottom: 1%; left: 14rem; }.fader-container .fader-wrapper .pips .pip { height: 1%; width: 4rem; border-bottom: 1px solid #cccccc; }.fader-container .fader-wrapper .pips .pip.val { width: 10rem; position: relative; }.fader-container .fader-wrapper .pips .pip.val span { position: relative; width: 30rem; display: block; text-align: center; font-size: 11rem; line-height: 12rem; left: 15rem; top: -2rem; color: #cccccc; }.fader-container.horizontal { min-height: 80rem; height: auto; width: 300rem; flex-shrink: 0; }.fader-container.horizontal .fader-wrapper-outer { position: relative; top: auto; padding-bottom: 35rem; }.fader-container.horizontal .fader-wrapper-outer .fader-wrapper { padding: 20rem 20rem 50rem; }.fader-container.horizontal .fader-wrapper-outer .fader { width: 100%; left: auto; height: 4rem; }.fader-container.horizontal .fader-wrapper-outer .fader .handle { height: 100% !important; width: 0; }.fader-container.horizontal .fader-wrapper-outer .pips { top: 14rem; left: 0; right: 0; display: flex; flex-direction: row; align-items: stretch; }.fader-container.horizontal .fader-wrapper-outer .pip { width: 100%; display: block; height: 4rem; border-bottom: 0; border-right: 1px solid #999999; }.fader-container.horizontal .fader-wrapper-outer .pip.val { width: 1%; float: left; height: 10rem; }.fader-container.horizontal .fader-wrapper-outer .pip.val span { top: 15rem; left: -15rem; }.knob-container { width: 100rem; min-height: 135rem; flex-shrink: 0; }.knob-container.nolabel .knob-wrapper-outer { padding-top: 15rem; }.knob-container .knob-wrapper-outer { width: 100%; top: 0; bottom: 0; padding-bottom: 15rem; overflow: hidden; }.knob-container .knob-wrapper-outer input { bottom: -15rem; position: relative; z-index: 1; }.knob-container .knob-wrapper-outer.nogauge .knob:after, .knob-container .knob-wrapper-outer.nogauge .knob-mask:after { display: none; }.knob-container .knob-wrapper-outer.nogauge .knob-wrapper .knob:before { content: ""; position: absolute; top: auto; bottom: 6rem; left: 6rem; height: 7rem; width: 7rem; background: #528bff; border: none !important; border-radius: 100% !important; box-shadow: 0 0 0 3rem rgba(82, 139, 255, 0.2), 0 0 2px 0 #2b2f37; }.knob-container .knob-wrapper-outer .knob-wrapper { padding: 5rem 20rem; margin: 0 auto; width: 95rem; position: relative; }.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask { width: 100%; padding-bottom: 100%; border-radius: 100%; position: relative; }.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask:before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 100%; border: 4rem solid #1a1d22; border-bottom-color: transparent; pointer-events: none; z-index: 0; }.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask:after { content: ""; position: absolute; top: 0rem; left: -3rem; right: -3rem; bottom: -2rem; border-radius: 100%; border: 12rem solid transparent; border-bottom-color: #2b2f37; pointer-events: none; }.knob-container .knob-wrapper-outer .knob-wrapper .knob { position: absolute; top: 0; left: 0; right: 0; bottom: 0; cursor: -webkit-grab; }.knob-container .knob-wrapper-outer .knob-wrapper .knob:active { cursor: -webkit-grabbing; }.knob-container .knob-wrapper-outer .knob-wrapper .knob:after { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 100%; border: 4rem solid transparent; border-bottom-color: #528bff; }.knob-container .knob-wrapper-outer .knob-wrapper .knob.d2:after { border-right-color: #528bff; }.knob-container .knob-wrapper-outer .knob-wrapper .knob.d3:after { border-top-color: #528bff; border-right-color: #528bff; }.knob-container .knob-wrapper-outer .knob-wrapper .knob span { position: absolute; top: 20rem; left: 20rem; right: 20rem; bottom: 20rem; border-radius: 100%; background: #4c4e52; box-shadow: 0 0 0 4rem #22252c; z-index: 100; transform: rotate(45deg); z-index: 100; }.knob-container .knob-wrapper-outer .knob-wrapper .knob span:before { content: ""; position: absolute; height: 3rem; width: 3rem; background: #4c4e52; margin-left: -1.5rem; left: 50%; bottom: -3rem; }.knob-container .knob-wrapper-outer .knob-wrapper .knob span:after { content: ""; position: absolute; height: 2000rem; width: 2000rem; margin: -1000rem 0 0 -1000rem; }.knob-container .knob-wrapper-outer .knob-wrapper .pip { position: absolute; font-size: 11rem; color: #cccccc; pointer-events: none; }.knob-container .knob-wrapper-outer .knob-wrapper .pip.min { bottom: -5rem; left: 0; right: 50%; width: 50%; text-align: center; }.knob-container .knob-wrapper-outer .knob-wrapper .pip.max { bottom: -5rem; left: 50%; width: 50%; right: 0; text-align: center; }.led-container { width: 100rem; flex-shrink: 0; }.led-container .led { padding: 10rem 1px 5rem; }.led-container .led div { border-radius: 100%; width: 60%; margin: 0 auto; overflow: hidden; background: #1a1d22; }.led-container .led div span { padding-bottom: 100%; display: block; background-color: #528bff; } \ No newline at end of file +@charset "UTF-8";* { margin: 0; padding: 0; box-sizing: border-box; text-decoration: none; outline: 0; font: inherit; cursor: inherit; }a { cursor: pointer; display: block; }::-webkit-scrollbar { width: 10px; height: 10px; opacity: 1; }::-webkit-scrollbar-track-piece { background: #1a1d22; }::-webkit-scrollbar-track-piece:vertical { border-left: 1px solid #1a1d22; }::-webkit-scrollbar-track-piece:horizontal { border-top: 1px solid #1a1d22; }::-webkit-scrollbar-corner { background: #1a1d22; }::-webkit-scrollbar-thumb { background: linear-gradient(#2d3139, #2b2f37 15rem); }::-webkit-scrollbar-thumb:vertical { border: 1px solid #1a1d22; border-width: 0 1px 0 1px; }::-webkit-scrollbar-thumb:horizontal { border: 1px solid #1a1d22; border-width: 1px 0 1px 0; }* { -webkit-user-select: none; }.inspector * { -webkit-user-select: initial; }.inspector *::selection { background: #528bff !important; }input:focus::selection { background: #528bff; }input { cursor: text; }html, body { height: 100%; overflow: hidden; position: relative; }html { font-size: 1px; }body { font-size: 14rem; line-height: 16rem; font-family: sans; color: #cccccc; white-space: nowrap; opacity: 1; cursor: default; }.btn { background: linear-gradient(#2d3139, #2b2f37 15rem); display: block; border: 1px solid #1a1d22; padding: 15rem; }a.btn:hover { background-image: linear-gradient(#32363d, #2d3139); }#lobby { background: #22252c; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 2; border: 1px solid #1a1d22; display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 20rem; }#lobby .main { width: 600rem; max-height: 100%; }#lobby .header { background: linear-gradient(#2d3139, #2b2f37 15rem); padding: 20rem; font-weight: bold; box-shadow: 0 0 0 1px #1a1d22 inset; white-space: nowrap; text-overflow: ellipsis; }#lobby a { padding-right: 35rem; overflow: hidden; margin-top: 10rem; position: relative; white-space: nowrap; text-overflow: ellipsis; }#lobby a span { position: absolute; right: 0rem; top: 0rem; padding: 15rem; color: #999999; }#lobby a span:hover { color: #cccccc; }#container { background: #22252c; position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; transition: right 0.2s; }#container.sidepanel-open { right: 300rem; }#container #open-toggle { position: absolute; right: 0; top: 2rem; width: 60rem; height: 60rem; padding: 0 10rem; line-height: 60rem; font-size: 24rem; text-align: center; color: #999999; z-index: 2; }#container #open-toggle.sidepanel-open { color: #cccccc; }#sidepanel { position: absolute; z-index: 999999; width: 300rem; top: 0; right: 0; bottom: 0; margin-right: -300rem; background: #282c34; border-left: 1px solid #1a1d22; transition: right 0.2s; overflow-y: auto; overflow-x: visible; }#sidepanel.sidepanel-open { right: 300rem; }#sidepanel #options { position: absolute; left: 0; top: 2rem; right: 0; bottom: 0; padding: 5rem; list-style: none; background: #282c34; }#sidepanel #options li { display: block; margin-bottom: 5rem; background: linear-gradient(#2d3139, #2b2f37 15rem); }#sidepanel #options .inspector { padding: 10rem; }#sidepanel #options .inspector .result { background: #1a1d22; border-radius: 3rem; margin-top: 10rem; padding: 10rem; color: #999999; white-space: pre; word-wrap: break-word; width: 100%; max-height: 300rem; overflow-y: auto; }#sidepanel #options .inspector .result::-webkit-scrollbar-track-piece, #sidepanel #options .inspector .result::-webkit-scrollbar-thumb { border-color: #1a1d22 !important; }#sidepanel #options .inspector .result::-webkit-scrollbar-thumb { background: #22252c !important; opacity: 0.6 !important; }.nicescroll-rails-hr { margin-top: 3rem; }.nicescroll-rails-vr { display: none !important; }a { color: inherit; }.navigation { position: absolute; top: 0; left: 0; right: 0; z-index: 1; font-size: 14rem; background: #22252c; border-bottom: 1px solid #1a1d22; border-top: 1px solid #282c34; height: 60rem; }.navigation ::first-letter { text-transform: uppercase; }.navigation.main { padding-right: 55rem; right: 0; }.navigation ul { list-style: none; display: flex; padding: 7rem 6rem; }.navigation ul li.on + li { border-image: none; border-left: 1px solid transparent; }.navigation ul li { display: block; max-width: 250rem; flex: 1; border-width: 0 0 0 1px; border-image: linear-gradient(rgba(26, 29, 34, 0), #1a1d22, rgba(26, 29, 34, 0)) 0 0 0 1 stretch; }.navigation ul li:first-child, .navigation ul li.on { border-image: none; border-left: 1px solid transparent; }.navigation ul li:first-child { border-left: 0; }.navigation ul li a { display: block; padding: 5rem 10rem; line-height: 34rem; border-radius: 3rem; overflow: hidden; text-align: center; border: 1px solid transparent; position: relative; color: #999999; }.navigation ul li a span { display: block; width: 100%; -webkit-mask: linear-gradient(to left, transparent, #000000 10rem) no-repeat; }.navigation ul li a.on { background: #282c34; border: 1px solid #1a1d22; color: #cccccc; }.navigation ul li a.on:before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.06); background: linear-gradient(rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)); }.navigation ul li a.on:after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4rem; }.content { position: absolute; left: 0; top: 60rem; right: 0; bottom: 0; background: #282c34; }.content .content { top: 60rem; }#loading { position: absolute; top: 50%; left: 50%; margin-top: -15rem; text-align: center; }#loading .spinner { display: block; margin: 0 auto; height: 30rem; width: 30rem; border-radius: 50%; border: 2rem solid rgba(0, 0, 0, 0.2); border-top-color: #528bff; animation: spin 0.5s linear infinite; }#loading #status { margin-top: 10rem; display: inline-block; }@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }.popup { position: fixed; top: 0; left: 0; right: 0; bottom: 0; padding: 10%; background: rgba(0, 0, 0, 0.5); z-index: 1000000; }.popup .popup-title { position: relative; padding: 15rem; background: linear-gradient(#2d3139, #2b2f37 15rem); }.popup .popup-title .closer { position: absolute; right: 0rem; top: 0; padding: 15rem; color: #999999; cursor: pointer; }.popup .popup-title .closer:hover { color: #cccccc; }.popup .popup-wrapper { background: #282c34; height: 100%; width: 100%; max-width: 600rem; margin: 0 auto; position: relative; overflow: hidden; border: 1px solid #1a1d22; }.popup .popup-wrapper .popup-content { height: 100%; width: 100%; padding: 10rem; overflow-y: scroll; white-space: normal; }form label { display: block; padding-top: 10rem; margin-bottom: 10rem; }form .info { color: #999999; margin-bottom: 10rem; }form input { display: block; margin-bottom: 10rem; background: #22252c; font: inherit; color: #cccccc; border: 1px solid #1a1d22; width: 100%; padding: 10rem; }form input.invalid { box-shadow: 0 0 0 1px rgba(255, 0, 0, 0.3) !important; }form input:focus { box-shadow: 0 0 0 1px #528bff; }form .submit { margin-top: 30rem; }.tab.on.stretch { display: flex; justify-content: space-between; }.tab.on.stretch > .widget { width: 100%; }.tab { display: none; overflow: auto; position: relative; }.tab.on { display: block; height: 100%; width: auto; }.widget { display: inline-block; height: auto; min-width: 100rem; overflow: hidden; position: relative; font-size: 13rem; padding: 35rem 1px 0; vertical-align: top; border: 6rem solid transparent; border-width: 6rem 0; margin: 0 3rem; box-shadow: 0 0 0 1px #22252c inset; background: linear-gradient(#2d3139, #2b2f37 15rem); background-clip: padding-box; -webkit-tap-highlight-color: transparent; }.widget:first-child { margin-left: 6rem; }.widget:last-child { margin-right: 6rem; }.widget.nolabel { padding-top: 0; }.widget.nolabel > .label { display: none; }.widget .label { z-index: 1; padding: 10rem 10rem; position: absolute; top: 0rem; left: 0; right: 0; text-overflow: ellipsis; overflow: hidden; height: 35rem; }.widget .label.accent { color: #528bff; }.widget input { width: 100%; height: 35rem; border: 0; background: #22252c; color: inherit; display: block; padding: 10rem; }.widget input:focus { box-shadow: 0 0 0 1px #528bff inset !important; }.widget input[disabled] { color: #999999; }/* STRIP (contains any widgets) */.strip-container { width: 100rem; height: 100%; overflow: visible; border-bottom: 0; background: none; box-shadow: none; }.strip-container > .label { background: linear-gradient(#2d3139, #2b2f37 15rem); box-shadow: 0 0 0 1px #22252c inset; }.strip-container .strip { height: 100%; display: flex; flex-direction: column; }.strip-container .strip > .widget { display: block; margin: 0; width: auto; }.strip-container .strip > .widget:not(:last-child) { border-bottom-width: 0; }.strip-container .strip > .widget:first-childĀ  { border-top-width: 0; }.strip-container.horizontal { padding-top: 0; padding-left: 40rem; width: 100%; height: auto; margin: 0; border-left-width: 6rem; display: block; }.strip-container.horizontal:last-child { margin-bottom: 6rem; }.strip-container.horizontal.nolabel { padding-left: 0; }.strip-container.horizontal .strip { flex-direction: row; align-items: flex-start; }.strip-container.horizontal .strip > .widget { border-bottom-width: 0; border-top-width: 0; border-right-width: 6rem; flex-shrink: initial; }.strip-container.horizontal .strip > .widget:last-child { border-right-width: 6rem; }.strip-container.horizontal > .label { width: 35rem; height: 100%; left: 0; top: 0; }.strip-container.horizontal > .label span { transform: rotate(180deg); display: block; position: relative; overflow: hidden; text-overflow: ellipsis; -webkit-writing-mode: vertical-lr; text-align: center; height: 100%; }.panel-container { position: absolute; margin: 0 !important; border-top: 0; z-index: 2; }.panel-container .panel { height: 100%; padding: 6rem 0; overflow: auto; }.panel-container .panel > .widget { border: 0; }.panel-container .panel.stretch { display: flex; justify-content: space-between; }.panel-container .panel.stretch > .widget { width: 100%; }/* BUTTONS */.toggle-container { width: 100rem; flex-shrink: 0; padding: 0 !important; cursor: pointer; }.toggle-container .label { position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 29rem 10rem 26rem; line-height: 1rem; background: none !important; text-align: center; pointer-events: none; }.toggle-container:hover { background-image: linear-gradient(#32363d, #2d3139); }.toggle { z-index: 1; padding: 29rem 10rem 26rem; }.toggle .light { position: absolute; left: 4rem; right: 4rem; top: 4rem; height: 4rem; background: #1a1d22; border-radius: 3rem; }.toggle.on .light { background: #528bff; }.switch-container { width: 100rem; flex-shrink: 0; }.switch-container .switch { height: 100%; width: 100%; cursor: pointer; display: flex; flex-direction: column; align-items: stretch; padding-bottom: 1px; }.switch-container .switch .value { background: linear-gradient(#2d3139, #2b2f37 15rem); color: #999999; width: 100%; position: relative; border-top: 1px solid #282c34; padding: 12rem 12rem 12rem 24rem; white-space: normal; text-align: left; word-break: break-all; overflow: hidden; }.switch-container .switch .value:hover { background: linear-gradient(#32363d, #2d3139); }.switch-container .switch .value:last-child { margin-bottom: 0; }.switch-container .switch .value:after { content: ""; position: absolute; left: 8rem; top: 50%; width: 8rem; height: 8rem; margin-top: -4rem; background: #1a1d22; border-radius: 8rem; }.switch-container .switch .value.on:after { background: #528bff; }/* XY */.xy-container, .rgb-container { width: 300rem; flex-shrink: 0; }.xy-wrapper { overflow: hidden; }.xy-wrapper .value { width: 100%; }.xy-wrapper input { width: 50%; float: left; padding: 2rem; text-align: center; position: relative; left: 0rem; right: 0rem; box-shadow: 0 0 1px 0 #1a1d22 inset; }.xy { position: relative; width: 100%; padding-bottom: 90%; overflow: hidden; cursor: -webkit-grab; }.xy:active { cursor: -webkit-grabbing; }.xy:active .handle:after { transform: scale(1.5); }.xy .handle { position: absolute; height: 0rem; width: 0rem; bottom: 0; left: 0; max-height: 100%; max-width: 100%; z-index: 2; pointer-events: none; }.xy .handle:after { content: ""; position: absolute; top: -.5rem; right: -1px; border-radius: 100% !important; width: 20rem; height: 20rem; margin: -10rem -10rem 0 0; box-shadow: 0 0 0 1000rem rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2); }.rgb-wrapper input { width: 33.33%; }.rgb { background-color: red; }.rgb:before, .rgb:after { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 100%; }.rgb:before { background: linear-gradient(to right, white 0%, rgba(255, 255, 255, 0) 100%); }.rgb:after { background: linear-gradient(to bottom, transparent 0%, black 100%); /* W3C */ }.hue { width: 100%; height: 30rem; 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; }.hue:active { cursor: -webkit-grabbing; }.hue:active .handle:after { transform: scale(1.5); }.hue .handle { position: absolute; height: 100%; max-width: 100%; width: 0; z-index: 2; left: 0; bottom: 0; pointer-events: none; }.hue .handle:after { content: ""; position: absolute; top: 50%; right: -1px; box-shadow: 0 0 0 1000rem rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2); border-radius: 100% !important; width: 11rem; height: 11rem; margin: -5rem -4rem 0 0; }.fader-container { width: 100rem; min-width: 80rem; height: 100%; min-height: 300rem; }.fader-container.nolabel .fader-wrapper-outer { top: 0; }.fader-container .fader-wrapper-outer { padding-bottom: 30rem; position: absolute; top: 30rem; bottom: 0; left: 1px; right: 1px; }.fader-container .fader-wrapper-outer input { position: absolute; bottom: 0; }.fader-container .fader-wrapper { padding: 20rem; overflow: hidden; height: 100%; position: relative; cursor: -webkit-grab; }.fader-container .fader-wrapper:active { cursor: -webkit-grabbing; }.fader-container .fader-wrapper .fader { height: 100%; width: 4rem; background: #1a1d22; position: relative; margin: 0 auto; left: -25rem; pointer-events: none; }.fader-container .fader-wrapper .fader.nogauge .handle { background: none; }.fader-container .fader-wrapper .fader .handle { position: absolute; bottom: 0 !important; top: auto !important; width: 100%; height: 0rem; max-height: 100%; max-width: 100%; background: #528bff; z-index: 1; }.fader-container .fader-wrapper .fader .handle:before { content: ""; position: absolute; top: -6rem; left: -2rem; height: 8rem; width: 8rem; background: #528bff; border: none !important; border-radius: 100% !important; box-shadow: 0 0 0 5rem rgba(82, 139, 255, 0.2), 0 0 2px 0 #2b2f37; }.fader-container .fader-wrapper .pips { position: absolute; top: -1%; bottom: 1%; left: 14rem; }.fader-container .fader-wrapper .pips .pip { height: 1%; width: 4rem; border-bottom: 1px solid #cccccc; }.fader-container .fader-wrapper .pips .pip.val { width: 10rem; position: relative; }.fader-container .fader-wrapper .pips .pip.val span { position: relative; width: 30rem; display: block; text-align: center; font-size: 11rem; line-height: 12rem; left: 15rem; top: -2rem; color: #cccccc; }.fader-container.horizontal { min-height: 80rem; height: auto; width: 300rem; flex-shrink: 0; }.fader-container.horizontal .fader-wrapper-outer { position: relative; top: auto; padding-bottom: 35rem; }.fader-container.horizontal .fader-wrapper-outer .fader-wrapper { padding: 20rem 20rem 50rem; }.fader-container.horizontal .fader-wrapper-outer .fader { width: 100%; left: auto; height: 4rem; }.fader-container.horizontal .fader-wrapper-outer .fader .handle { height: 100% !important; width: 0; }.fader-container.horizontal .fader-wrapper-outer .fader .handle:before { top: -2rem; right: -6rem; left: auto; }.fader-container.horizontal .fader-wrapper-outer .pips { top: 14rem; left: 0; right: 0; display: flex; flex-direction: row; align-items: stretch; }.fader-container.horizontal .fader-wrapper-outer .pip { width: 100%; display: block; height: 4rem; border-bottom: 0; border-right: 1px solid #999999; }.fader-container.horizontal .fader-wrapper-outer .pip.val { width: 1%; float: left; height: 10rem; }.fader-container.horizontal .fader-wrapper-outer .pip.val span { top: 15rem; left: -15rem; }.knob-container { width: 100rem; min-height: 135rem; flex-shrink: 0; padding-top: 15rem; }.knob-container.nolabel .knob-wrapper-outer { top: 0; }.knob-container .knob-wrapper-outer { width: 100%; top: 30rem; bottom: 0; padding-bottom: 30rem; overflow: hidden; }.knob-container .knob-wrapper-outer input { bottom: 0; position: absolute; z-index: 1; }.knob-container .knob-wrapper-outer.nogauge .knob:after, .knob-container .knob-wrapper-outer.nogauge .knob-mask:after { display: none; }.knob-container .knob-wrapper-outer.nogauge .knob-wrapper .knob:before { content: ""; position: absolute; top: auto; bottom: 6rem; left: 6rem; height: 7rem; width: 7rem; background: #528bff; border: none !important; border-radius: 100% !important; box-shadow: 0 0 0 3rem rgba(82, 139, 255, 0.2), 0 0 2px 0 #2b2f37; }.knob-container .knob-wrapper-outer .knob-wrapper { padding: 20rem; margin: 0 auto; width: 95rem; position: relative; cursor: -webkit-grab; }.knob-container .knob-wrapper-outer .knob-wrapper:active { cursor: -webkit-grabbing; }.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask { width: 100%; padding-bottom: 100%; border-radius: 100%; pointer-events: none; position: relative; }.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask:before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 100%; border: 4rem solid #1a1d22; border-bottom-color: transparent; pointer-events: none; z-index: 0; }.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask:after { content: ""; position: absolute; top: 0rem; left: -3rem; right: -3rem; bottom: -2rem; border-radius: 100%; border: 12rem solid transparent; border-bottom-color: #2b2f37; pointer-events: none; }.knob-container .knob-wrapper-outer .knob-wrapper .knob { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }.knob-container .knob-wrapper-outer .knob-wrapper .knob:after { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 100%; border: 4rem solid transparent; border-bottom-color: #528bff; }.knob-container .knob-wrapper-outer .knob-wrapper .knob.d2:after { border-right-color: #528bff; }.knob-container .knob-wrapper-outer .knob-wrapper .knob.d3:after { border-top-color: #528bff; border-right-color: #528bff; }.knob-container .knob-wrapper-outer .knob-wrapper .knob span { position: absolute; top: 20rem; left: 20rem; right: 20rem; bottom: 20rem; border-radius: 100%; background: #4c4e52; box-shadow: 0 0 0 4rem #22252c; z-index: 100; transform: rotate(45deg); z-index: 100; }.knob-container .knob-wrapper-outer .knob-wrapper .knob span:before { content: ""; position: absolute; height: 3rem; width: 3rem; background: #4c4e52; margin-left: -1.5rem; left: 50%; bottom: -3rem; }.knob-container .knob-wrapper-outer .knob-wrapper .pip { position: absolute; font-size: 11rem; color: #cccccc; pointer-events: none; }.knob-container .knob-wrapper-outer .knob-wrapper .pip.min { bottom: 7.5rem; left: 0; right: 50%; width: 50%; text-align: center; }.knob-container .knob-wrapper-outer .knob-wrapper .pip.max { bottom: 7.5rem; left: 50%; width: 50%; right: 0; text-align: center; }.led-container { width: 100rem; flex-shrink: 0; }.led-container .led { padding: 10rem 1px 5rem; }.led-container .led div { border-radius: 100%; width: 60%; margin: 0 auto; overflow: hidden; background: #1a1d22; }.led-container .led div span { padding-bottom: 100%; display: block; background-color: #528bff; } \ No newline at end of file diff --git a/app/browser/js/app/init.js b/app/browser/js/app/init.js index 7944e6aa..8f900d7c 100644 --- a/app/browser/js/app/init.js +++ b/app/browser/js/app/init.js @@ -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() } diff --git a/app/browser/js/app/utils.js b/app/browser/js/app/utils.js index e3780c30..278c3385 100644 --- a/app/browser/js/app/utils.js +++ b/app/browser/js/app/utils.js @@ -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 () { diff --git a/app/browser/js/app/widgets.js b/app/browser/js/app/widgets.js index fb897ce0..9604df2c 100644 --- a/app/browser/js/app/widgets.js +++ b/app/browser/js/app/widgets.js @@ -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){ `), 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) { `), + 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]) diff --git a/app/browser/js/jquery/jquery.event.drag-2.2.js b/app/browser/js/jquery/jquery.event.drag-2.2.js index 443e2940..851a34e9 100644 --- a/app/browser/js/jquery/jquery.event.drag-2.2.js +++ b/app/browser/js/jquery/jquery.event.drag-2.2.js @@ -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() ); diff --git a/app/browser/scss/style.scss b/app/browser/scss/style.scss index 0238406f..7f7062b5 100644 --- a/app/browser/scss/style.scss +++ b/app/browser/scss/style.scss @@ -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; diff --git a/app/main/main.js b/app/main/main.js index 0dbbfa70..9d3928da 100644 --- a/app/main/main.js +++ b/app/main/main.js @@ -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)