diff --git a/browser/css/style.css b/browser/css/style.css index fa32173a..a207b623 100644 --- a/browser/css/style.css +++ b/browser/css/style.css @@ -1 +1 @@ -:root{--color-text:rgba(255,255,255,0.8);--color-text-fade:rgba(255,255,255,0.5);--color-bg:#202329;--color-fg:#2d313a;--color-raised:#363b45;--color-faded:#292d34;--color-track:#1c1f25;--color-accent:#528bff;--color-custom:var(--color-accent);--nav-height:40rem;--sidepanel-size:300rem;--pixel-scale:1}*{margin:0;padding:0;border:0;box-sizing:border-box;text-decoration:none;outline:0;font:inherit;color:inherit;cursor:inherit;-webkit-tap-highlight-color:transparent;-webkit-user-select:none}::-webkit-scrollbar{width:20rem;height:20rem;opacity:1}::-webkit-scrollbar-track-piece{background:var(--color-bg)}::-webkit-scrollbar-track-piece:vertical{border-left:2rem solid var(--color-bg)}::-webkit-scrollbar-track-piece:horizontal{border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-corner{background:var(--color-fg);border-left:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-thumb{background:var(--color-raised)}::-webkit-scrollbar-thumb:vertical{border-left:2rem solid var(--color-bg)}::-webkit-scrollbar-thumb:horizontal{border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start,::-webkit-scrollbar-button:increment:end{background:var(--color-fg);height:20rem;width:20rem;display:block}::-webkit-scrollbar-button:decrement:start:vertical:decrement:start,::-webkit-scrollbar-button:increment:end:vertical:decrement:start{border-left:2rem solid var(--color-bg);border-bottom:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start:vertical:increment:end,::-webkit-scrollbar-button:increment:end:vertical:increment:end{border-left:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start:horizontal:decrement:start,::-webkit-scrollbar-button:increment:end:horizontal:decrement:start{border-right:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start:horizontal:increment:end,::-webkit-scrollbar-button:increment:end:horizontal:increment:end{border-left:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}body{background:var(--color-bg)}#container{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;flex-direction:column;background:var(--color-bg);padding:2rem}#container.sidepanel-open{right:var(--sidepanel-size)}.content{height:100%;overflow:hidden;position:relative;background:var(--color-fg);padding:2rem}.tab{position:absolute;overflow:auto;left:0;right:0;top:0;bottom:0;background:var(--color-bg);transform:rotateZ(0)}.tab.has-tabs{display:flex;flex-direction:column}.tab.has-tabs>.navigation{background:var(--color-bg)}.tab.has-tabs>.content{background:none}.navigation{height:var(--nav-height);margin-bottom:2rem;flex-shrink:0;font-weight:bold;text-transform:uppercase}.navigation.main li:last-child{width:var(--nav-height);max-width:var(--nav-height);min-width:var(--nav-height)}.navigation.main li:last-child i{margin:0 auto}.navigation ul{list-style:none;display:flex;overflow:hidden;height:100%}.navigation ul li{display:block;min-width:0;flex:1;cursor:pointer;height:100%;margin-right:1rem}.navigation ul li:last-child{margin-right:0}.navigation ul li a{background:var(--color-fg);pointer-events:none;padding:5rem;height:100%;display:flex;align-items:center;overflow:hidden;text-align:center;position:relative}.navigation ul li a span{display:block;width:100%;-webkit-mask:linear-gradient(to left, transparent, #000 10rem) no-repeat}.navigation ul li a:after{content:"";background:var(--color-accent);position:absolute;bottom:0;left:0;right:0;height:1rem;opacity:0;transition:all .2s;transform:scale(0)}.navigation ul li.on a,.navigation ul li .sidepanel-open{position:relative;background:var(--color-raised)}.navigation ul li.on a:after,.navigation ul li .sidepanel-open:after{opacity:1;transform:scale(1)}.navigation ul .parent+li a{padding-left:calc(5rem + 0.5 * var(--nav-height))}.form .input-wrapper{display:flex;margin-bottom:4rem;background:var(--color-bg);align-items:center}.form .input-wrapper:last-child{margin-bottom:0}.form .input-wrapper label{background:var(--color-fg);flex-shrink:0;padding:5rem;border:1rem solid var(--color-bg)}.form .input-wrapper .input,.form .input-wrapper input{background:var(--color-bg);width:100%;padding:5rem}.form .input-wrapper.column{flex-direction:column}.form .input-wrapper.column label{width:100%;padding:7rem;margin-bottom:0}.form label{display:block;font-size:10rem;background:var(--color-faded)}.form .info{color:var(--color-text-fade);margin-bottom:10rem}.form input,.form .input{display:block;border:0;font:inherit;color:var(--color-text);width:100%}.form input:focus,.form .input:focus{border-color:var(--color-accent)}.form input .btn,.form .input .btn{background:var(--color-raised);box-shadow:0 0 0 1rem var(--color-bg)}.form .checkbox{background:var(--color-raised);cursor:pointer}.form .select-wrapper{position:relative;width:100%}.form .select-wrapper:after{content:"\f107";font-family:FontAwesome;position:absolute;padding:5rem;right:0;top:0;font-size:20rem}.form select{-webkit-appearance:none}.form .submit{margin-top:30rem}.form .separator{line-height:30rem;height:30rem;margin-bottom:5rem;position:relative;display:flex;align-items:center}.form .separator:before,.form .separator:after{content:"";top:14rem;width:100%;height:1rem;background:var(--color-text-fade)}.form .separator span{font-variant:small-caps;position:relative;display:block;width:100%;text-align:center}.widget.editing{z-index:11 !important;overflow:visible}.widget.editing:after,li.editing a:before,a.editing:before,.content.editing:before,#container.editing:before{content:"";z-index:999;position:absolute;top:0;left:0;right:0;bottom:0;border:1rem dashed var(--color-accent);pointer-events:none}.context-menu{position:fixed;z-index:999999999;background:var(--color-raised);box-shadow:0 0 4rem 0;color:var(--color-track)}.context-menu .item{color:var(--color-text)}.context-menu .context-menu{position:absolute;left:100%;top:0;opacity:0;pointer-events:none;margin-left:2rem}.context-menu .context-menu:before{content:"";position:absolute;top:0;bottom:0;left:-2rem;width:2rem}.context-menu>.item{padding:10rem 15rem 10rem 10rem;position:relative;cursor:pointer}.context-menu>.item i{margin-right:5rem;width:15rem;text-align:center}.context-menu>.item:hover,.context-menu>.item:focus{background:var(--color-accent)}.context-menu>.item:hover>.context-menu,.context-menu>.item:focus>.context-menu{pointer-events:auto;opacity:1}.context-menu>.item.has-sub:before{content:"\f105";display:block;font-family:FontAwesome;float:right;margin-right:-10rem;padding-left:10rem}.ui-resizable-handle{position:absolute;z-index:1000000;display:flex;justify-content:center;align-items:center;background:var(--color-accent);width:20rem;height:20rem;border-radius:100%;box-shadow:0 0 4rem 0 var(--color-bg)}.ui-resizable-handle:after{content:"";position:absolute;top:-5rem;right:-5rem;left:-5rem;bottom:-5rem}.ui-resizable-handle.ui-resizable-se{content:"";bottom:5rem;right:5rem;cursor:se-resize}.ui-resizable-handle.ui-resizable-se:before{content:"\f065";font-family:FontAwesome;transform:rotate(90deg)}.ui-resizable-handle.ui-resizable-e{top:50%;margin-top:-10rem;right:5rem;cursor:e-resize}.ui-resizable-handle.ui-resizable-e:before{content:"\f051";font-family:FontAwesome}.ui-resizable-handle.ui-resizable-s{bottom:5rem;left:50%;margin-left:-10rem;cursor:s-resize}.ui-resizable-handle.ui-resizable-s:before{content:"\f051";font-family:FontAwesome;transform:rotate(90deg)}.ui-helper{border:1rem dashed var(--color-accent);min-width:30rem !important;min-height:30rem !important;z-index:12 !important;opacity:1 !important}.ui-helper:after{content:"";display:block;width:100%;height:100%;background:var(--color-accent);opacity:.25}.ui-draggable-handle:not(.label){position:absolute;top:5rem;left:5rem;z-index:100000;height:20rem;width:20rem;display:flex;justify-content:center;align-items:center;border-radius:100%;background:var(--color-accent);box-shadow:0 0 4rem 0 var(--color-bg)}.ui-draggable-handle:not(.label):before{content:"\f0b2";font-family:FontAwesome;transform:rotate(45deg)}.ui-draggable-handle{cursor:-webkit-grab}.ui-draggable-handle:active{cursor:-webkit-grabbing}#sidepanel{position:absolute;z-index:999999;width:var(--sidepanel-size);border:8rem solid var(--color-fg);top:0;right:0;bottom:0;margin-right:calc(-1 * var(--sidepanel-size));background:var(--color-fg);transition:transform .25s, opacity .25s;transform:translate3d(0, 0, 0);opacity:0;overflow-y:auto;overflow-x:visible}#sidepanel.sidepanel-open{transform:translate3d(calc(-1 * var(--sidepanel-size)), 0, 0);opacity:1}#sidepanel #options{position:absolute;left:0;top:0;right:0;bottom:0;list-style:none}#sidepanel #options li{display:block;margin-bottom:8rem;position:relative}#sidepanel #options li:last-child{margin:0}#sidepanel #options li .btn+span{position:absolute;right:0rem;top:0rem;padding:8rem;color:var(--color-text-fade)}#sidepanel #options li .btn+span:hover{color:var(--color-text)}#sidepanel #options li ul{padding:4rem}#sidepanel #options li ul li{margin-bottom:4rem}#sidepanel #options .editor .form{margin-top:10rem}#sidepanel #options .help{margin-top:10rem;font-size:.75em;text-align:center;font-style:italic}#sidepanel::-webkit-scrollbar-track-piece{background:var(--color-bg)}#sidepanel::-webkit-scrollbar-track-piece:vertical{border-left:8rem solid var(--color-fg)}#sidepanel::-webkit-scrollbar-thumb{background:var(--color-raised)}#sidepanel::-webkit-scrollbar-thumb:vertical{border-left:8rem solid var(--color-fg)}.actions{padding:1rem;background:var(--color-bg);display:flex;align-items:stretch;flex-wrap:wrap}.actions .title{background:var(--color-faded);min-width:100%;flex-grow:2;padding:10rem;position:relative}.actions .title:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:0 0 0 1rem;color:var(--color-bg)}.actions a{min-width:33%;flex-grow:4;padding:10rem;display:block;text-align:center;position:relative;color:var(--color-text);overflow:visible}.actions a.on{pointer-events:none}.actions a.on:after{opacity:1;transform:scale(1)}.actions a:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:0 0 0 1rem;color:var(--color-bg)}.actions a:after{content:"";background:var(--color-accent);position:absolute;top:0;left:0;right:0;height:1rem;opacity:0;transition:all .2s;transform:scale(0)}.widget{display:inline-block;height:auto;overflow:hidden;position:relative;vertical-align:top;box-shadow:-0.5rem -0.5rem 0 0.5rem;color:var(--color-bg);border-right:1rem solid var(--color-bg);border-bottom:1rem solid var(--color-bg);background:var(--color-fg);-webkit-tap-highlight-color:transparent;min-height:30rem;min-width:30rem;display:inline-flex;flex-direction:column}.widget>*{color:var(--color-text)}.widget.absolute-position{position:absolute}.widget.nolabel>.label{display:none}.widget .label{padding:10rem 10rem;text-overflow:ellipsis;overflow:hidden;text-align:center;height:35rem;max-height:35rem;width:100%;background:var(--color-raised);border-bottom:1rem solid var(--color-bg);flex-shrink:0}.widget .label.accent{color:var(--color-accent)}.widget .input{width:100%;height:30rem;border:0;background:transparent;color:var(--color-text-fade);display:block;padding:7rem 5rem;position:relative;display:var(--display-input)}.widget .input input{position:absolute;top:0;left:0;right:0;bottom:0;padding:7rem 5rem;width:100%;font:inherit;text-align:center;border:0;background:transparent;color:var(--color-accent)}.widget .input canvas{width:100%;height:100%;opacity:0.8}.widget .input input+canvas{visibility:hidden}.widget .input:focus{color:var(--color-accent)}.widget .input[disabled]{color:var(--color-text-fade)}.fader-container{--color-pips:var(--color-text-fade);--color-gauge:var(--color-custom);--color-knob:var(--color-custom);height:100%}.fader{height:100%;overflow:hidden;display:flex;flex-direction:column;position:relative}.fader .wrapper{overflow:hidden;flex:1;display:flex;max-height:100%;width:100%;position:relative}.fader .wrapper canvas{flex:1;max-height:100%;width:100%}.fader .wrapper .meter-container{pointer-events:none;position:absolute;top:20rem;bottom:19rem;left:50%;height:auto;width:3rem;min-width:3rem}.fader.has-pips .wrapper canvas{padding-right:28rem}.fader.has-pips .pips{pointer-events:none;position:absolute;top:20rem;bottom:20rem;left:50%;z-index:0;width:4rem;margin-left:7rem;background:linear-gradient(to bottom, transparent 0, transparent 2px, var(--color-pips) 2px, var(--color-pips) 3px, transparent 3px, transparent 5px);background-size:100% 5px;background-repeat:repeat-y}.fader.has-pips .pips .pip{height:1px;background:var(--color-pips);color:var(--color-fg);position:absolute;width:8rem;left:0}.fader.has-pips .pips .pip:before{content:"";position:absolute;top:-4px;left:0;right:0;bottom:-4px;background:var(--color-fg);z-index:-1}.fader.has-pips .pips .pip span{position:absolute;width:30rem;display:block;text-align:center;font-size:10rem;line-height:12rem;left:3rem;top:-5.5rem;color:var(--color-pips)}.fader.has-pips.horizontal .wrapper canvas{padding-right:0;padding-bottom:20rem}.fader.has-pips.horizontal .wrapper .meter-container{left:20rem;right:20rem;height:3rem;min-height:3rem;width:auto;top:50%;margin-top:3rem}.fader.has-pips.horizontal .pips{top:50%;left:20rem;right:20rem;font-size:0;height:4rem;width:auto;margin:0;margin-top:10rem;background:linear-gradient(to right, transparent 0, transparent 2px, var(--color-pips) 2px, var(--color-pips) 3px, transparent 3px, transparent 5px);background-size:5px 100%;background-repeat:repeat-x}.fader.has-pips.horizontal .pips .pip{width:1px;height:6rem;margin:0}.fader.has-pips.horizontal .pips .pip:before{top:0;bottom:0;left:-4px;right:-4px}.fader.has-pips.horizontal .pips .pip span{top:15rem;left:-15rem !important;right:auto}.fader.has-pips.align-right .wrapper canvas{padding-right:0;padding-left:28rem}.fader.has-pips.align-right .wrapper .meter-container{left:auto;right:50%;margin-left:0}.fader.has-pips.align-right .pips{margin-left:0;margin-right:7rem;left:auto;right:50%}.fader.has-pips.align-right .pips .pip{right:0;left:auto}.fader.has-pips.align-right .pips .pip span{right:3rem;left:auto}.fader.compact .input{overflow:hidden;position:absolute;top:50%;transform:rotate(-90deg);pointer-events:none;width:100rem;margin-left:-50rem;left:50%;z-index:3;margin-top:-15rem}.fader.compact .meter-container{top:0;bottom:0;left:auto;right:0}.fader.compact.horizontal .meter-container{top:auto;bottom:0;left:0;right:0;height:3rem;min-height:3rem;width:auto}.fader.compact.horizontal .input{transform:none;top:50%}.knob-container{--color-pips:var(--color-text-fade);--color-gauge:var(--color-custom);--color-knob:var(--color-custom);width:100rem;height:150rem;align-items:center;flex-shrink:0}.knob-container.compact .pips{display:none}.knob-container.compact .input{position:absolute;top:50%;margin-top:-15rem;left:22%;right:22%;width:auto;pointer-events:none}.knob-container.compact .knob-wrapper-outer{position:relative}.knob-container.compact .knob-wrapper{padding:10% 0 !important}.knob-container.compact .knob:before{display:none}.knob-container .knob-wrapper-outer{width:100%;display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;overflow:hidden}.knob-container .knob-wrapper-outer .input{flex-shrink:0}.knob-container .knob-wrapper-outer .knob-wrapper{padding:15rem 0 15rem;margin:0 auto;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:0;position:relative;cursor:-webkit-grab}.knob-container .knob-wrapper-outer .knob-wrapper:active{cursor:-webkit-grabbing}.knob-container .knob-wrapper-outer .knob-wrapper.no-pip{padding-bottom:0}.knob-container .knob-wrapper-outer .knob-wrapper.no-pip .pips{display:none}.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask{width:58%;padding-bottom:58%;flex-shrink:0;border-radius:100%;pointer-events:none;position:relative}.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask:before{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;border:2rem solid var(--color-track);transform:rotate(45deg);z-index:4}.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:var(--color-fg);z-index:4}.knob-container .knob-wrapper-outer .knob-wrapper .knob{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;transform:rotateZ(0deg);backface-visibility:hidden;z-index:2}.knob-container .knob-wrapper-outer .knob-wrapper .knob:before{content:"";position:absolute;top:17rem;left:17rem;right:17rem;bottom:17rem;border-radius:100%;background-color:var(--color-raised);box-shadow:0 0 1rem 0 var(--color-text-fade) inset}.knob-container .knob-wrapper-outer .knob-wrapper .knob:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;border:2rem solid var(--color-track);border-bottom-color:var(--color-gauge)}.knob-container .knob-wrapper-outer .knob-wrapper .knob.d2:after{border-right-color:var(--color-gauge)}.knob-container .knob-wrapper-outer .knob-wrapper .knob.d3:after{border-top-color:var(--color-gauge);border-right-color:var(--color-gauge)}.knob-container .knob-wrapper-outer .knob-wrapper .handle{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;transform:rotateZ(-45deg);backface-visibility:hidden;z-index:5}.knob-container .knob-wrapper-outer .knob-wrapper .handle:before{content:"";position:absolute;top:50%;left:-3rem;margin-top:-4rem;height:8rem;width:8rem;background:var(--color-knob);border:none !important;border-radius:100% !important}.knob-container .knob-wrapper-outer .knob-wrapper .handle:after{content:"";position:absolute;top:50%;margin-top:-10rem;left:-9rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-knob);opacity:.2}.knob-container .knob-wrapper-outer .knob-wrapper .pips{width:100%;pointer-events:none;height:0}.knob-container .knob-wrapper-outer .knob-wrapper .pip{font-size:11rem;color:var(--color-pips);display:inline-block}.knob-container .knob-wrapper-outer .knob-wrapper .pip.min{width:50%;text-align:center}.knob-container .knob-wrapper-outer .knob-wrapper .pip.max{width:50%;text-align:center}.multitoggle-container,.multipush-container,.multifader-container{height:200rem;width:200rem}.multitoggle-container.nolabel .matrix,.multipush-container.nolabel .matrix,.multifader-container.nolabel .matrix{top:0}.matrix{flex:1;overflow:auto;background:var(--color-bg);display:flex;flex-wrap:wrap;flex-direction:row;margin-right:-1rem;margin-bottom:-1rem}.matrix>.widget{min-height:0;min-width:0;margin:0 !important}.matrix>.widget .label{background:none;border:0}.multifader-container .matrix{padding:0 !important;align-items:stretch}.multifader-container .widget{height:auto}.multifader-container .fader-wrapper{padding:10rem 0 20rem !important}.multifader-container .fader-wrapper .fader{left:0 !important}.xy-container,.rgb-container{width:200rem;height:250rem;flex-shrink:0;display:flex}.xy-container .label,.rgb-container .label{flex-shrink:0}.xy-wrapper{height:100%;overflow:hidden;display:flex;flex-direction:column}.xy-wrapper .value{width:100%;display:var(--display-input)}.xy-wrapper .input{width:50%;float:left;height:30rem;text-align:center;position:relative}.xy{position:relative;width:auto;height:100%;overflow:hidden;cursor:-webkit-grab;background:var(--color-faded)}.xy:active{cursor:-webkit-grabbing}.xy .handle{position:absolute;bottom:0;left:0;z-index:2;pointer-events:none;backface-visibility:hidden;transform-origin:center;transform:translate3d(0, 0, 0)}.xy .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;background:var(--color-custom);border:none !important;border-radius:100% !important}.xy .handle:after{content:"";position:absolute;top:-10rem;right:-10rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-custom);opacity:.2}.rgb-wrapper .input,.rgb-wrapper input{width:33.33%}.rgb .bg{position:absolute;top:0;left:0;right:0;bottom:0;background-color:red;opacity:.75;pointer-events:none}.rgb .bg:before,.rgb .bg:after{content:"";position:absolute;left:0;top:0;width:100%;height:100%}.rgb .bg:before{background:linear-gradient(to right, #fff 0%, rgba(255,255,255,0) 100%)}.rgb .bg:after{background:linear-gradient(to bottom, transparent 0%, #000 100%)}.rgb .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;background:var(--color-text);border:none !important;border-radius:100% !important}.rgb .handle:after{content:"";position:absolute;top:-10rem;right:-10rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-text)}.hue{width:auto;min-height:30rem;overflow:hidden;cursor:-webkit-grab;position:relative;flex-shrink:0}.hue .bg{position:absolute;top:0;left:0;right:0;bottom:0;opacity:0.5;background:transparent linear-gradient(to left, red, #FF0080, #f0f, #8000FF, blue, #0080FF, cyan, #00FF80, lime, #80FF00, #ff0, #FF8000, red) repeat scroll 0% 0%;pointer-events:none}.hue:active{cursor:-webkit-grabbing}.hue .handle{position:absolute;z-index:2;left:0;top:50%;pointer-events:none;transform:translate3d(0, 0, 0)}.hue .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;border:none !important;border-radius:100% !important;box-shadow:none;background:var(--color-text)}.led-container{width:100rem;flex-shrink:0}.led-container .led{display:flex;align-items:center;height:100%;padding:10rem 0;overflow:hidden}.led-container .led div{border-radius:100%;width:calc(100% - 20rem);padding-bottom:calc(100% - 20rem);margin:0 auto;background:var(--color-track);position:relative}.led-container .led div span{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;display:block;background-color:var(--color-custom)}.led-container .led div span:after{content:"";border-radius:100%;position:absolute;top:-1rem;left:-1rem;right:-1rem;bottom:-1rem;display:block;border:6rem solid var(--color-fg);opacity:0.8}.plot-container,.visualizer-container,.eq-container{--color-custom:var(--color-accent);height:200rem;width:200rem}.plot-container .plot,.visualizer-container .plot,.eq-container .plot{display:flex;flex-direction:row;flex:1;position:relative}.plot-container canvas,.visualizer-container canvas,.eq-container canvas{position:absolute;top:0;left:0;width:100%;height:100%}.meter-container{--color-custom:var(--color-accent);--color-gauge:var(--color-custom);height:100rem}.meter-container .meter{display:flex;flex-direction:row;flex:1;position:relative;background:var(--color-track)}.meter-container .meter .level{width:100%;flex:1;transform-origin:bottom;background:var(--color-custom)}.meter-container .meter::after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background-image:linear-gradient(transparent 1px, var(--color-fg) 1px, var(--color-fg) 2px);background-size:100% 2px;background-repeat:repeat}.meter-container .meter.horizontal::after{background-image:linear-gradient(to left, transparent 1px, var(--color-fg) 1px, var(--color-fg) 2px);background-size:2px 100%}.meter-container .meter.horizontal .level{transform-origin:left}.text-container{--color-custom:var(--color-accent)}.text-container .text{flex:1;height:35rem;padding:10rem;justify-content:center;display:flex;align-items:center;background:var(--color-faded);color:var(--color-custom)}.text-container .text.vertical{transform:rotate(180deg);text-overflow:ellipsis;overflow:hidden;-webkit-writing-mode:vertical-lr}.toggle-container,.push-container{width:100rem;min-height:65rem;flex-shrink:0;padding:0 !important;background:var(--color-raised);cursor:pointer}.toggle-container .label,.push-container .label{position:absolute;top:1rem;left:0;right:0;bottom:0;height:auto;max-height:initial;border:0;background:none !important;text-align:center;pointer-events:none;display:flex;justify-content:center;align-items:center}.toggle-container .light,.push-container .light{box-shadow:0 0 1rem 0 var(--color-text-fade) inset;flex:1}.toggle-container .light:before,.push-container .light:before{content:"";width:100%;height:100%;position:absolute;background:var(--color-custom);opacity:0}.toggle-container .light.on,.push-container .light.on{box-shadow:0 0 1rem 0 var(--color-custom) inset}.toggle-container .light.on:before,.push-container .light.on:before{opacity:.3}.push-container .active{background:var(--color-fg)}.push-container .light:after{content:"";position:absolute;width:100%;height:100%;box-shadow:0 0 0 4rem var(--color-text-fade) inset;opacity:.1}.switch-container{width:100rem;flex-shrink:0}.switch-container .switch{height:100%;width:100%;cursor:pointer;display:flex;flex-direction:column;align-items:stretch;flex:1;z-index:1}.switch-container .switch.horizontal{flex-direction:row}.switch-container .switch.horizontal .value{padding:6rem;text-align:center;display:flex;justify-content:center;flex-direction:column;border-top:0;border-right:1rem solid var(--color-bg);flex:1;height:auto}.switch-container .switch.horizontal .value:last-child{border-right:0}.switch-container .switch .value{background:var(--color-raised);color:var(--color-text);width:100%;height:100%;position:relative;border-top:1rem solid var(--color-bg);white-space:normal;padding:12rem;text-align:center;word-break:break-all;overflow:hidden;display:flex;flex-direction:column;justify-content:center;box-shadow:0 0 1rem 0 var(--color-text-fade) inset}.switch-container .switch .value:first-child{border-top:0}.switch-container .switch .value:last-child{margin-bottom:0}.switch-container .switch .value:before{content:"";position:absolute;left:0;top:0;right:0;bottom:0;background:var(--color-custom);opacity:0;z-index:2}.switch-container .switch .value.on:before{opacity:.3;box-shadow:0 0 1rem 0 var(--color-custom) inset}.strip-container{width:100rem;height:100%;overflow:visible;border:0}.strip-container:before{content:"";position:absolute;top:0;bottom:0;right:0;left:0;pointer-events:none;z-index:2}.strip-container>.strip{height:100%;display:flex;flex-direction:column}.strip-container>.strip>.widget{width:auto;margin:0;box-shadow:none}.strip-container>.strip>.widget .label{background-image:none}.strip-container.vertical>.strip>.widget{max-width:100%}.strip-container.vertical::before{border-right:1rem solid var(--color-bg)}.strip-container.horizontal{width:100%;height:200rem;display:flex;flex-direction:row}.strip-container.horizontal::before{border-bottom:1rem solid var(--color-bg)}.strip-container.horizontal>.strip{flex-direction:row;flex:1}.strip-container.horizontal>.strip>.widget{flex-shrink:initial;width:100%;min-height:100%;max-height:100%;height:100%}.strip-container.horizontal>.label{width:35rem;height:100%;border-bottom:0;border-right:1rem solid var(--color-bg);max-height:initial}.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{width:200rem;height:200rem;border:0;background:var(--color-faded)}.panel-container:before{content:"";position:absolute;top:0;bottom:0;right:0;left:0;border-bottom:1rem solid var(--color-bg);border-right:1rem solid var(--color-bg);pointer-events:none;z-index:2}.panel-container ::-webkit-scrollbar-thumb,.panel-container ::-webkit-scrollbar-track-piece{border-top:1rem solid var(--color-bg)}.panel-container.nolabel .panel{top:0}.panel-container .panel{overflow:auto;position:absolute;top:35rem;left:0;right:0;bottom:0}.panel-container .panel.has-tabs{display:flex;flex-direction:column;background:var(--color-bg)}.panel-container .panel.noscroll{overflow:hidden}.panel-container .panel.noscroll>.widget{max-width:100%;max-height:100%}.panel-container .navigation{border-top:0;background:transparent}.panel-container .navigation:after{background:var(--color-bg)}.panel-container .navigation a.on{border-color:var(--color-bg)}.panel-container .content{background:transparent}input:focus::selection{background:var(--color-accent);color:var(--color-text)}input{cursor:text}html,body{height:100%;overflow:hidden;position:relative}html{font-size:calc(var(--pixel-scale) * 1px);max-height:999999px}body{font-size:13rem;line-height:16rem;font-family:Droid Sans;color:var(--color-text);white-space:nowrap;opacity:1;cursor:default}i{font-size:14rem !important}.btn{background:var(--color-raised);display:block;padding:15rem;position:relative;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;cursor:pointer}.btn.small{padding:8rem;padding-right:15rem}.btn.warning{background:firebrick}.btn.disabled{pointer-events:none;color:var(--color-text-fade)}.btn.align-center{text-align:center}#lobby{background:var(--color-bg);position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;display:flex;align-items:center;justify-content:center;overflow-y:auto;padding:20rem}#lobby .main{width:600rem;max-width:100%;max-height:100%;display:flex;flex-direction:column}#lobby .list{flex:1;overflow:auto;background:var(--color-fg);border-top:2rem solid var(--color-bg)}#lobby .header{padding:20rem;white-space:nowrap;text-overflow:ellipsis;flex-grow:0;background-color:var(--color-faded);color:var(--color-accent);font-size:16rem;line-height:24rem}#lobby .footer{background:var(--color-raised);white-space:nowrap;text-overflow:ellipsis;flex-grow:0;background:var(--color-faded);border-top:2rem solid var(--color-bg)}#lobby a{display:block;padding-right:35rem;overflow:hidden;padding-top:15rem;position:relative;white-space:nowrap;text-overflow:ellipsis;background:none;border-bottom:1rem solid var(--color-bg)}#lobby a:hover{background:var(--color-raised)}#lobby a:last-child{border-bottom:0}#lobby a span{position:absolute;right:0rem;top:0rem;padding:15rem;color:var(--color-text-fade)}#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 var(--color-track);border-top-color:var(--color-accent);animation:spin .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%;display:flex;align-items:center;z-index:1000000}.popup:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--color-bg);opacity:.5}.popup .popup-title{position:relative;padding:15rem;background:var(--color-raised)}.popup .popup-title .closer{position:absolute;right:0rem;top:0;padding:15rem;color:var(--color-text-fade);cursor:pointer}.popup .popup-wrapper{display:flex;flex-direction:column;align-items:stretch;background:var(--color-fg);width:auto;max-width:600rem;margin:0 auto;position:relative;overflow:hidden;border:1rem solid var(--color-track)}.popup .popup-wrapper .popup-content{height:100%;width:100%;padding:10rem;overflow-y:auto;white-space:normal} +:root{--color-text:rgba(255,255,255,0.8);--color-text-fade:rgba(255,255,255,0.5);--color-bg:#202329;--color-fg:#2d313a;--color-raised:#363b45;--color-faded:#292d34;--color-track:#1c1f25;--color-accent:#528bff;--color-custom:var(--color-accent);--nav-height:40rem;--sidepanel-size:300rem;--pixel-scale:1}*{margin:0;padding:0;border:0;box-sizing:border-box;text-decoration:none;outline:0;font:inherit;color:inherit;cursor:inherit;-webkit-tap-highlight-color:transparent;-webkit-user-select:none}::-webkit-scrollbar{width:20rem;height:20rem;opacity:1}::-webkit-scrollbar-track-piece{background:var(--color-bg)}::-webkit-scrollbar-track-piece:vertical{border-left:2rem solid var(--color-bg)}::-webkit-scrollbar-track-piece:horizontal{border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-corner{background:var(--color-fg);border-left:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-thumb{background:var(--color-raised)}::-webkit-scrollbar-thumb:vertical{border-left:2rem solid var(--color-bg)}::-webkit-scrollbar-thumb:horizontal{border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start,::-webkit-scrollbar-button:increment:end{background:var(--color-fg);height:20rem;width:20rem;display:block}::-webkit-scrollbar-button:decrement:start:vertical:decrement:start,::-webkit-scrollbar-button:increment:end:vertical:decrement:start{border-left:2rem solid var(--color-bg);border-bottom:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start:vertical:increment:end,::-webkit-scrollbar-button:increment:end:vertical:increment:end{border-left:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start:horizontal:decrement:start,::-webkit-scrollbar-button:increment:end:horizontal:decrement:start{border-right:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start:horizontal:increment:end,::-webkit-scrollbar-button:increment:end:horizontal:increment:end{border-left:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}body{background:var(--color-bg)}#container{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;flex-direction:column;background:var(--color-bg);padding:2rem}#container.sidepanel-open{right:var(--sidepanel-size)}.content{height:100%;overflow:hidden;position:relative;background:var(--color-fg);padding:2rem}.tab{position:absolute;overflow:auto;left:0;right:0;top:0;bottom:0;background:var(--color-bg);transform:rotateZ(0)}.tab.has-tabs{display:flex;flex-direction:column}.tab.has-tabs>.navigation{background:var(--color-bg)}.tab.has-tabs>.content{background:none}.navigation{height:var(--nav-height);margin-bottom:2rem;flex-shrink:0;font-weight:bold;text-transform:uppercase}.navigation.main li:last-child{width:var(--nav-height);max-width:var(--nav-height);min-width:var(--nav-height)}.navigation.main li:last-child i{margin:0 auto}.navigation ul{list-style:none;display:flex;overflow:hidden;height:100%}.navigation ul li{display:block;min-width:0;flex:1;cursor:pointer;height:100%;margin-right:1rem}.navigation ul li:last-child{margin-right:0}.navigation ul li a{background:var(--color-fg);pointer-events:none;padding:5rem;height:100%;display:flex;align-items:center;overflow:hidden;text-align:center;position:relative}.navigation ul li a span{display:block;width:100%;-webkit-mask:linear-gradient(to left, transparent, #000 10rem) no-repeat}.navigation ul li a:after{content:"";background:var(--color-accent);position:absolute;bottom:0;left:0;right:0;height:1rem;opacity:0;transition:all .2s;transform:scale(0)}.navigation ul li.on a,.navigation ul li .sidepanel-open{position:relative;background:var(--color-raised)}.navigation ul li.on a:after,.navigation ul li .sidepanel-open:after{opacity:1;transform:scale(1)}.navigation ul .parent+li a{padding-left:calc(5rem + 0.5 * var(--nav-height))}.form .input-wrapper{display:flex;margin-bottom:4rem;background:var(--color-bg);align-items:center}.form .input-wrapper:last-child{margin-bottom:0}.form .input-wrapper label{background:var(--color-fg);flex-shrink:0;padding:5rem;border:1rem solid var(--color-bg)}.form .input-wrapper .input,.form .input-wrapper input{background:var(--color-bg);width:100%;padding:5rem}.form .input-wrapper.column{flex-direction:column}.form .input-wrapper.column label{width:100%;padding:7rem;margin-bottom:0}.form label{display:block;font-size:10rem;background:var(--color-faded)}.form .info{color:var(--color-text-fade);margin-bottom:10rem}.form input,.form .input{display:block;border:0;font:inherit;color:var(--color-text);width:100%}.form input:focus,.form .input:focus{border-color:var(--color-accent)}.form input .btn,.form .input .btn{background:var(--color-raised);box-shadow:0 0 0 1rem var(--color-bg)}.form .checkbox{background:var(--color-raised);cursor:pointer}.form .select-wrapper{position:relative;width:100%}.form .select-wrapper:after{content:"\f107";font-family:FontAwesome;position:absolute;padding:5rem;right:0;top:0;font-size:20rem}.form select{-webkit-appearance:none}.form .submit{margin-top:30rem}.form .separator{line-height:30rem;height:30rem;margin-bottom:5rem;position:relative;display:flex;align-items:center}.form .separator:before,.form .separator:after{content:"";top:14rem;width:100%;height:1rem;background:var(--color-text-fade)}.form .separator span{font-variant:small-caps;position:relative;display:block;width:100%;text-align:center}.widget.editing{z-index:11 !important;overflow:visible}.widget.editing:after,li.editing a:before,a.editing:before,.content.editing:before,#container.editing:before{content:"";z-index:999;position:absolute;top:0;left:0;right:0;bottom:0;border:1rem dashed var(--color-accent);pointer-events:none}.context-menu{position:fixed;z-index:999999999;background:var(--color-raised);box-shadow:0 0 4rem 0;color:var(--color-track)}.context-menu .item{color:var(--color-text)}.context-menu .context-menu{position:absolute;left:100%;top:0;opacity:0;pointer-events:none;margin-left:2rem}.context-menu .context-menu:before{content:"";position:absolute;top:0;bottom:0;left:-2rem;width:2rem}.context-menu>.item{padding:10rem 15rem 10rem 10rem;position:relative;cursor:pointer}.context-menu>.item i{margin-right:5rem;width:15rem;text-align:center}.context-menu>.item:hover,.context-menu>.item:focus{background:var(--color-accent)}.context-menu>.item:hover>.context-menu,.context-menu>.item:focus>.context-menu{pointer-events:auto;opacity:1}.context-menu>.item.has-sub:before{content:"\f105";display:block;font-family:FontAwesome;float:right;margin-right:-10rem;padding-left:10rem}.ui-resizable-handle{position:absolute;z-index:1000000;display:flex;justify-content:center;align-items:center;background:var(--color-accent);width:20rem;height:20rem;border-radius:100%;box-shadow:0 0 4rem 0 var(--color-bg)}.ui-resizable-handle:after{content:"";position:absolute;top:-5rem;right:-5rem;left:-5rem;bottom:-5rem}.ui-resizable-handle.ui-resizable-se{content:"";bottom:5rem;right:5rem;cursor:se-resize}.ui-resizable-handle.ui-resizable-se:before{content:"\f065";font-family:FontAwesome;transform:rotate(90deg)}.ui-resizable-handle.ui-resizable-e{top:50%;margin-top:-10rem;right:5rem;cursor:e-resize}.ui-resizable-handle.ui-resizable-e:before{content:"\f051";font-family:FontAwesome}.ui-resizable-handle.ui-resizable-s{bottom:5rem;left:50%;margin-left:-10rem;cursor:s-resize}.ui-resizable-handle.ui-resizable-s:before{content:"\f051";font-family:FontAwesome;transform:rotate(90deg)}.ui-helper{border:1rem dashed var(--color-accent);min-width:30rem !important;min-height:30rem !important;z-index:12 !important;opacity:1 !important}.ui-helper:after{content:"";display:block;width:100%;height:100%;background:var(--color-accent);opacity:.25}.ui-draggable-handle:not(.label){position:absolute;top:5rem;left:5rem;z-index:100000;height:20rem;width:20rem;display:flex;justify-content:center;align-items:center;border-radius:100%;background:var(--color-accent);box-shadow:0 0 4rem 0 var(--color-bg)}.ui-draggable-handle:not(.label):before{content:"\f0b2";font-family:FontAwesome;transform:rotate(45deg)}.ui-draggable-handle{cursor:-webkit-grab}.ui-draggable-handle:active{cursor:-webkit-grabbing}#sidepanel{position:absolute;z-index:999999;width:var(--sidepanel-size);border:8rem solid var(--color-fg);top:0;right:0;bottom:0;margin-right:calc(-1 * var(--sidepanel-size));background:var(--color-fg);transition:transform .25s, opacity .25s;transform:translate3d(0, 0, 0);opacity:0;overflow-y:auto;overflow-x:visible}#sidepanel.sidepanel-open{transform:translate3d(calc(-1 * var(--sidepanel-size)), 0, 0);opacity:1}#sidepanel #options{position:absolute;left:0;top:0;right:0;bottom:0;list-style:none}#sidepanel #options li{display:block;margin-bottom:8rem;position:relative}#sidepanel #options li:last-child{margin:0}#sidepanel #options li .btn+span{position:absolute;right:0rem;top:0rem;padding:8rem;color:var(--color-text-fade)}#sidepanel #options li .btn+span:hover{color:var(--color-text)}#sidepanel #options li ul{padding:4rem}#sidepanel #options li ul li{margin-bottom:4rem}#sidepanel #options .editor .form{margin-top:10rem}#sidepanel #options .help{margin-top:10rem;font-size:.75em;text-align:center;font-style:italic}#sidepanel::-webkit-scrollbar-track-piece{background:var(--color-bg)}#sidepanel::-webkit-scrollbar-track-piece:vertical{border-left:8rem solid var(--color-fg)}#sidepanel::-webkit-scrollbar-thumb{background:var(--color-raised)}#sidepanel::-webkit-scrollbar-thumb:vertical{border-left:8rem solid var(--color-fg)}.actions{padding:1rem;background:var(--color-bg);display:flex;align-items:stretch;flex-wrap:wrap}.actions .title{background:var(--color-faded);min-width:100%;flex-grow:2;padding:10rem;position:relative}.actions .title:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:0 0 0 1rem;color:var(--color-bg)}.actions a{min-width:33%;flex-grow:4;padding:10rem;display:block;text-align:center;position:relative;color:var(--color-text);overflow:visible}.actions a.on{pointer-events:none}.actions a.on:after{opacity:1;transform:scale(1)}.actions a:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:0 0 0 1rem;color:var(--color-bg)}.actions a:after{content:"";background:var(--color-accent);position:absolute;top:0;left:0;right:0;height:1rem;opacity:0;transition:all .2s;transform:scale(0)}.widget{display:inline-block;height:auto;overflow:hidden;position:relative;vertical-align:top;box-shadow:-0.5rem -0.5rem 0 0.5rem;color:var(--color-bg);border-right:1rem solid var(--color-bg);border-bottom:1rem solid var(--color-bg);background:var(--color-fg);-webkit-tap-highlight-color:transparent;min-height:30rem;min-width:30rem;display:inline-flex;flex-direction:column}.widget>*{color:var(--color-text)}.widget.absolute-position{position:absolute}.widget.nolabel>.label{display:none}.widget .label{padding:10rem 10rem;text-overflow:ellipsis;overflow:hidden;text-align:center;height:35rem;max-height:35rem;width:100%;background:var(--color-raised);border-bottom:1rem solid var(--color-bg);flex-shrink:0}.widget .label.accent{color:var(--color-accent)}.widget .input{width:100%;height:30rem;border:0;background:transparent;color:var(--color-text-fade);display:block;padding:7rem 5rem;position:relative;display:var(--display-input)}.widget .input input{position:absolute;top:0;left:0;right:0;bottom:0;padding:7rem 5rem;width:100%;font:inherit;text-align:center;border:0;background:transparent;color:var(--color-accent)}.widget .input canvas{width:100%;height:100%;opacity:0.8}.widget .input input+canvas{visibility:hidden}.widget .input:focus{color:var(--color-accent)}.widget .input[disabled]{color:var(--color-text-fade)}.fader-container{--color-pips:var(--color-text-fade);--color-gauge:var(--color-custom);--color-knob:var(--color-custom);height:100%}.fader{height:100%;overflow:hidden;display:flex;flex-direction:column;position:relative}.fader .wrapper{overflow:hidden;flex:1;display:flex;max-height:100%;width:100%;position:relative}.fader .wrapper canvas{flex:1;max-height:100%;width:100%}.fader .wrapper .meter-container{pointer-events:none;position:absolute;top:20rem;bottom:19rem;left:50%;height:auto;width:3rem;min-width:3rem}.fader.has-pips .wrapper canvas{padding-right:28rem}.fader.has-pips .pips{pointer-events:none;position:absolute;top:20rem;bottom:20rem;left:50%;z-index:0;width:4rem;margin-left:7rem;background:linear-gradient(to bottom, transparent 0, transparent 2px, var(--color-pips) 2px, var(--color-pips) 3px, transparent 3px, transparent 5px);background-size:100% 5px;background-repeat:repeat-y}.fader.has-pips .pips .pip{height:1px;background:var(--color-pips);color:var(--color-fg);position:absolute;width:8rem;left:0}.fader.has-pips .pips .pip:before{content:"";position:absolute;top:-4px;left:0;right:0;bottom:-4px;background:var(--color-fg);z-index:-1}.fader.has-pips .pips .pip span{position:absolute;width:30rem;display:block;text-align:center;font-size:10rem;line-height:12rem;left:3rem;top:-5.5rem;color:var(--color-pips)}.fader.has-pips.horizontal .wrapper canvas{padding-right:0;padding-bottom:20rem}.fader.has-pips.horizontal .wrapper .meter-container{left:20rem;right:20rem;height:3rem;min-height:3rem;width:auto;top:50%;margin-top:3rem}.fader.has-pips.horizontal .pips{top:50%;left:20rem;right:20rem;font-size:0;height:4rem;width:auto;margin:0;margin-top:10rem;background:linear-gradient(to right, transparent 0, transparent 2px, var(--color-pips) 2px, var(--color-pips) 3px, transparent 3px, transparent 5px);background-size:5px 100%;background-repeat:repeat-x}.fader.has-pips.horizontal .pips .pip{width:1px;height:6rem;margin:0}.fader.has-pips.horizontal .pips .pip:before{top:0;bottom:0;left:-4px;right:-4px}.fader.has-pips.horizontal .pips .pip span{top:15rem;left:-15rem !important;right:auto}.fader.has-pips.align-right .wrapper canvas{padding-right:0;padding-left:28rem}.fader.has-pips.align-right .wrapper .meter-container{left:auto;right:50%;margin-left:0}.fader.has-pips.align-right .pips{margin-left:0;margin-right:7rem;left:auto;right:50%}.fader.has-pips.align-right .pips .pip{right:0;left:auto}.fader.has-pips.align-right .pips .pip span{right:3rem;left:auto}.fader.compact .input{overflow:hidden;position:absolute;top:50%;transform:rotate(-90deg);pointer-events:none;width:100rem;margin-left:-50rem;left:50%;z-index:3;margin-top:-15rem}.fader.compact .meter-container{top:0;bottom:0;left:auto;right:0}.fader.compact.horizontal .meter-container{top:auto;bottom:0;left:0;right:0;height:3rem;min-height:3rem;width:auto}.fader.compact.horizontal .input{transform:none;top:50%}.knob{height:100%;overflow:hidden;display:flex;flex-direction:column;position:relative}.knob .wrapper{overflow:hidden;flex:1;display:flex;max-height:100%;width:100%;position:relative}.knob .wrapper canvas{flex:1;max-height:100%;width:100%;position:relative}.knob-container{--color-pips:var(--color-text-fade);--color-gauge:var(--color-custom);--color-knob:var(--color-custom);width:100rem;height:150rem;align-items:center;flex-shrink:0}.knob-container.compact .pips{display:none}.knob-container.compact .input{position:absolute;top:50%;margin-top:-15rem;left:22%;right:22%;width:auto;pointer-events:none}.knob-container.compact .knob-wrapper-outer{position:relative}.knob-container.compact .knob-wrapper{padding:10% 0 !important}.knob-container.compact .knob:before{display:none}.knob-container .knob-wrapper-outer{width:100%;display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;overflow:hidden}.knob-container .knob-wrapper-outer .input{flex-shrink:0}.knob-container .knob-wrapper-outer .knob-wrapper{padding:15rem 0 15rem;margin:0 auto;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:0;position:relative;cursor:-webkit-grab}.knob-container .knob-wrapper-outer .knob-wrapper:active{cursor:-webkit-grabbing}.knob-container .knob-wrapper-outer .knob-wrapper.no-pip{padding-bottom:0}.knob-container .knob-wrapper-outer .knob-wrapper.no-pip .pips{display:none}.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask{width:58%;padding-bottom:58%;flex-shrink:0;border-radius:100%;pointer-events:none;position:relative}.knob-container .knob-wrapper-outer .knob-wrapper .knob-mask:before{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;border:2rem solid var(--color-track);transform:rotate(45deg);z-index:4}.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:var(--color-fg);z-index:4}.knob-container .knob-wrapper-outer .knob-wrapper .knob{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;transform:rotateZ(0deg);backface-visibility:hidden;z-index:2}.knob-container .knob-wrapper-outer .knob-wrapper .knob:before{content:"";position:absolute;top:17rem;left:17rem;right:17rem;bottom:17rem;border-radius:100%;background-color:var(--color-raised);box-shadow:0 0 1rem 0 var(--color-text-fade) inset}.knob-container .knob-wrapper-outer .knob-wrapper .knob:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;border:2rem solid var(--color-track);border-bottom-color:var(--color-gauge)}.knob-container .knob-wrapper-outer .knob-wrapper .knob.d2:after{border-right-color:var(--color-gauge)}.knob-container .knob-wrapper-outer .knob-wrapper .knob.d3:after{border-top-color:var(--color-gauge);border-right-color:var(--color-gauge)}.knob-container .knob-wrapper-outer .knob-wrapper .handle{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;transform:rotateZ(-45deg);backface-visibility:hidden;z-index:5}.knob-container .knob-wrapper-outer .knob-wrapper .handle:before{content:"";position:absolute;top:50%;left:-3rem;margin-top:-4rem;height:8rem;width:8rem;background:var(--color-knob);border:none !important;border-radius:100% !important}.knob-container .knob-wrapper-outer .knob-wrapper .handle:after{content:"";position:absolute;top:50%;margin-top:-10rem;left:-9rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-knob);opacity:.2}.knob-container .knob-wrapper-outer .knob-wrapper .pips{width:100%;pointer-events:none;height:0}.knob-container .knob-wrapper-outer .knob-wrapper .pip{font-size:11rem;color:var(--color-pips);display:inline-block}.knob-container .knob-wrapper-outer .knob-wrapper .pip.min{width:50%;text-align:center}.knob-container .knob-wrapper-outer .knob-wrapper .pip.max{width:50%;text-align:center}.multitoggle-container,.multipush-container,.multifader-container{height:200rem;width:200rem}.multitoggle-container.nolabel .matrix,.multipush-container.nolabel .matrix,.multifader-container.nolabel .matrix{top:0}.matrix{flex:1;overflow:auto;background:var(--color-bg);display:flex;flex-wrap:wrap;flex-direction:row;margin-right:-1rem;margin-bottom:-1rem}.matrix>.widget{min-height:0;min-width:0;margin:0 !important}.matrix>.widget .label{background:none;border:0}.multifader-container .matrix{padding:0 !important;align-items:stretch}.multifader-container .widget{height:auto}.multifader-container .fader-wrapper{padding:10rem 0 20rem !important}.multifader-container .fader-wrapper .fader{left:0 !important}.xy-container,.rgb-container{width:200rem;height:250rem;flex-shrink:0;display:flex}.xy-container .label,.rgb-container .label{flex-shrink:0}.xy-wrapper{height:100%;overflow:hidden;display:flex;flex-direction:column}.xy-wrapper .value{width:100%;display:var(--display-input)}.xy-wrapper .input{width:50%;float:left;height:30rem;text-align:center;position:relative}.xy{position:relative;width:auto;height:100%;overflow:hidden;cursor:-webkit-grab;background:var(--color-faded)}.xy:active{cursor:-webkit-grabbing}.xy .handle{position:absolute;bottom:0;left:0;z-index:2;pointer-events:none;backface-visibility:hidden;transform-origin:center;transform:translate3d(0, 0, 0)}.xy .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;background:var(--color-custom);border:none !important;border-radius:100% !important}.xy .handle:after{content:"";position:absolute;top:-10rem;right:-10rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-custom);opacity:.2}.rgb-wrapper .input,.rgb-wrapper input{width:33.33%}.rgb .bg{position:absolute;top:0;left:0;right:0;bottom:0;background-color:red;opacity:.75;pointer-events:none}.rgb .bg:before,.rgb .bg:after{content:"";position:absolute;left:0;top:0;width:100%;height:100%}.rgb .bg:before{background:linear-gradient(to right, #fff 0%, rgba(255,255,255,0) 100%)}.rgb .bg:after{background:linear-gradient(to bottom, transparent 0%, #000 100%)}.rgb .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;background:var(--color-text);border:none !important;border-radius:100% !important}.rgb .handle:after{content:"";position:absolute;top:-10rem;right:-10rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-text)}.hue{width:auto;min-height:30rem;overflow:hidden;cursor:-webkit-grab;position:relative;flex-shrink:0}.hue .bg{position:absolute;top:0;left:0;right:0;bottom:0;opacity:0.5;background:transparent linear-gradient(to left, red, #FF0080, #f0f, #8000FF, blue, #0080FF, cyan, #00FF80, lime, #80FF00, #ff0, #FF8000, red) repeat scroll 0% 0%;pointer-events:none}.hue:active{cursor:-webkit-grabbing}.hue .handle{position:absolute;z-index:2;left:0;top:50%;pointer-events:none;transform:translate3d(0, 0, 0)}.hue .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;border:none !important;border-radius:100% !important;box-shadow:none;background:var(--color-text)}.led-container{width:100rem;flex-shrink:0}.led-container .led{display:flex;align-items:center;height:100%;padding:10rem 0;overflow:hidden}.led-container .led div{border-radius:100%;width:calc(100% - 20rem);padding-bottom:calc(100% - 20rem);margin:0 auto;background:var(--color-track);position:relative}.led-container .led div span{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;display:block;background-color:var(--color-custom)}.led-container .led div span:after{content:"";border-radius:100%;position:absolute;top:-1rem;left:-1rem;right:-1rem;bottom:-1rem;display:block;border:6rem solid var(--color-fg);opacity:0.8}.plot-container,.visualizer-container,.eq-container{--color-custom:var(--color-accent);height:200rem;width:200rem}.plot-container .plot,.visualizer-container .plot,.eq-container .plot{display:flex;flex-direction:row;flex:1;position:relative}.plot-container canvas,.visualizer-container canvas,.eq-container canvas{position:absolute;top:0;left:0;width:100%;height:100%}.meter-container{--color-custom:var(--color-accent);--color-gauge:var(--color-custom);height:100rem}.meter-container .meter{display:flex;flex-direction:row;flex:1;position:relative;background:var(--color-track)}.meter-container .meter .level{width:100%;flex:1;transform-origin:bottom;background:var(--color-custom)}.meter-container .meter::after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background-image:linear-gradient(transparent 1px, var(--color-fg) 1px, var(--color-fg) 2px);background-size:100% 2px;background-repeat:repeat}.meter-container .meter.horizontal::after{background-image:linear-gradient(to left, transparent 1px, var(--color-fg) 1px, var(--color-fg) 2px);background-size:2px 100%}.meter-container .meter.horizontal .level{transform-origin:left}.text-container{--color-custom:var(--color-accent)}.text-container .text{flex:1;height:35rem;padding:10rem;justify-content:center;display:flex;align-items:center;background:var(--color-faded);color:var(--color-custom)}.text-container .text.vertical{transform:rotate(180deg);text-overflow:ellipsis;overflow:hidden;-webkit-writing-mode:vertical-lr}.toggle-container,.push-container{width:100rem;min-height:65rem;flex-shrink:0;padding:0 !important;background:var(--color-raised);cursor:pointer}.toggle-container .label,.push-container .label{position:absolute;top:1rem;left:0;right:0;bottom:0;height:auto;max-height:initial;border:0;background:none !important;text-align:center;pointer-events:none;display:flex;justify-content:center;align-items:center}.toggle-container .light,.push-container .light{box-shadow:0 0 1rem 0 var(--color-text-fade) inset;flex:1}.toggle-container .light:before,.push-container .light:before{content:"";width:100%;height:100%;position:absolute;background:var(--color-custom);opacity:0}.toggle-container .light.on,.push-container .light.on{box-shadow:0 0 1rem 0 var(--color-custom) inset}.toggle-container .light.on:before,.push-container .light.on:before{opacity:.3}.push-container .active{background:var(--color-fg)}.push-container .light:after{content:"";position:absolute;width:100%;height:100%;box-shadow:0 0 0 4rem var(--color-text-fade) inset;opacity:.1}.switch-container{width:100rem;flex-shrink:0}.switch-container .switch{height:100%;width:100%;cursor:pointer;display:flex;flex-direction:column;align-items:stretch;flex:1;z-index:1}.switch-container .switch.horizontal{flex-direction:row}.switch-container .switch.horizontal .value{padding:6rem;text-align:center;display:flex;justify-content:center;flex-direction:column;border-top:0;border-right:1rem solid var(--color-bg);flex:1;height:auto}.switch-container .switch.horizontal .value:last-child{border-right:0}.switch-container .switch .value{background:var(--color-raised);color:var(--color-text);width:100%;height:100%;position:relative;border-top:1rem solid var(--color-bg);white-space:normal;padding:12rem;text-align:center;word-break:break-all;overflow:hidden;display:flex;flex-direction:column;justify-content:center;box-shadow:0 0 1rem 0 var(--color-text-fade) inset}.switch-container .switch .value:first-child{border-top:0}.switch-container .switch .value:last-child{margin-bottom:0}.switch-container .switch .value:before{content:"";position:absolute;left:0;top:0;right:0;bottom:0;background:var(--color-custom);opacity:0;z-index:2}.switch-container .switch .value.on:before{opacity:.3;box-shadow:0 0 1rem 0 var(--color-custom) inset}.strip-container{width:100rem;height:100%;overflow:visible;border:0}.strip-container:before{content:"";position:absolute;top:0;bottom:0;right:0;left:0;pointer-events:none;z-index:2}.strip-container>.strip{height:100%;display:flex;flex-direction:column}.strip-container>.strip>.widget{width:auto;margin:0;box-shadow:none}.strip-container>.strip>.widget .label{background-image:none}.strip-container.vertical>.strip>.widget{max-width:100%}.strip-container.vertical::before{border-right:1rem solid var(--color-bg)}.strip-container.horizontal{width:100%;height:200rem;display:flex;flex-direction:row}.strip-container.horizontal::before{border-bottom:1rem solid var(--color-bg)}.strip-container.horizontal>.strip{flex-direction:row;flex:1}.strip-container.horizontal>.strip>.widget{flex-shrink:initial;width:100%;min-height:100%;max-height:100%;height:100%}.strip-container.horizontal>.label{width:35rem;height:100%;border-bottom:0;border-right:1rem solid var(--color-bg);max-height:initial}.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{width:200rem;height:200rem;border:0;background:var(--color-faded)}.panel-container:before{content:"";position:absolute;top:0;bottom:0;right:0;left:0;border-bottom:1rem solid var(--color-bg);border-right:1rem solid var(--color-bg);pointer-events:none;z-index:2}.panel-container ::-webkit-scrollbar-thumb,.panel-container ::-webkit-scrollbar-track-piece{border-top:1rem solid var(--color-bg)}.panel-container.nolabel .panel{top:0}.panel-container .panel{overflow:auto;position:absolute;top:35rem;left:0;right:0;bottom:0}.panel-container .panel.has-tabs{display:flex;flex-direction:column;background:var(--color-bg)}.panel-container .panel.noscroll{overflow:hidden}.panel-container .panel.noscroll>.widget{max-width:100%;max-height:100%}.panel-container .navigation{border-top:0;background:transparent}.panel-container .navigation:after{background:var(--color-bg)}.panel-container .navigation a.on{border-color:var(--color-bg)}.panel-container .content{background:transparent}input:focus::selection{background:var(--color-accent);color:var(--color-text)}input{cursor:text}html,body{height:100%;overflow:hidden;position:relative}html{font-size:calc(var(--pixel-scale) * 1px);max-height:999999px}body{font-size:13rem;line-height:16rem;font-family:Droid Sans;color:var(--color-text);white-space:nowrap;opacity:1;cursor:default}i{font-size:14rem !important}.btn{background:var(--color-raised);display:block;padding:15rem;position:relative;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;cursor:pointer}.btn.small{padding:8rem;padding-right:15rem}.btn.warning{background:firebrick}.btn.disabled{pointer-events:none;color:var(--color-text-fade)}.btn.align-center{text-align:center}#lobby{background:var(--color-bg);position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;display:flex;align-items:center;justify-content:center;overflow-y:auto;padding:20rem}#lobby .main{width:600rem;max-width:100%;max-height:100%;display:flex;flex-direction:column}#lobby .list{flex:1;overflow:auto;background:var(--color-fg);border-top:2rem solid var(--color-bg)}#lobby .header{padding:20rem;white-space:nowrap;text-overflow:ellipsis;flex-grow:0;background-color:var(--color-faded);color:var(--color-accent);font-size:16rem;line-height:24rem}#lobby .footer{background:var(--color-raised);white-space:nowrap;text-overflow:ellipsis;flex-grow:0;background:var(--color-faded);border-top:2rem solid var(--color-bg)}#lobby a{display:block;padding-right:35rem;overflow:hidden;padding-top:15rem;position:relative;white-space:nowrap;text-overflow:ellipsis;background:none;border-bottom:1rem solid var(--color-bg)}#lobby a:hover{background:var(--color-raised)}#lobby a:last-child{border-bottom:0}#lobby a span{position:absolute;right:0rem;top:0rem;padding:15rem;color:var(--color-text-fade)}#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 var(--color-track);border-top-color:var(--color-accent);animation:spin .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%;display:flex;align-items:center;z-index:1000000}.popup:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--color-bg);opacity:.5}.popup .popup-title{position:relative;padding:15rem;background:var(--color-raised)}.popup .popup-title .closer{position:absolute;right:0rem;top:0;padding:15rem;color:var(--color-text-fade);cursor:pointer}.popup .popup-wrapper{display:flex;flex-direction:column;align-items:stretch;background:var(--color-fg);width:auto;max-width:600rem;margin:0 auto;position:relative;overflow:hidden;border:1rem solid var(--color-track)}.popup .popup-wrapper .popup-content{height:100%;width:100%;padding:10rem;overflow-y:auto;white-space:normal} diff --git a/browser/js/app/widgets.js b/browser/js/app/widgets.js index 3fbf78de..f62d6cd2 100644 --- a/browser/js/app/widgets.js +++ b/browser/js/app/widgets.js @@ -1,7 +1,7 @@ var widgets = { // sliders fader: require('./widgets/sliders/fader'), - knob: require('./widgets/knob'), + knob: require('./widgets/sliders/knob'), // buttons toggle: require('./widgets/toggle'), diff --git a/browser/js/app/widgets/sliders/_sliders_base.js b/browser/js/app/widgets/sliders/_sliders_base.js index a47e10de..76783bd4 100644 --- a/browser/js/app/widgets/sliders/_sliders_base.js +++ b/browser/js/app/widgets/sliders/_sliders_base.js @@ -14,6 +14,7 @@ var _sliders_base = module.exports = function(){ _canvas_base.apply(this, arguments) + this.wrapper = this.widget.find('.wrapper') this.input = this.widget.find('.input').fakeInput({align:'center'}) this.roundFactor = Math.pow(10,this.widgetData.precision) this.value = undefined diff --git a/browser/js/app/widgets/sliders/fader.js b/browser/js/app/widgets/sliders/fader.js index bc51c784..e1c3f19d 100644 --- a/browser/js/app/widgets/sliders/fader.js +++ b/browser/js/app/widgets/sliders/fader.js @@ -1,6 +1,43 @@ var {clip, mapToScale, sendOsc} = require('../utils'), _sliders_base = require('./_sliders_base') + +module.exports.options = { + type:'fader', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + unit:'', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + alignRight:false, + horizontal:false, + noPip:false, + compact:false, + color:'auto', + css:'', + + separator2:'behaviour', + + snap:false, + + separator3:'osc', + + range:{min:0,max:1}, + origin: 'auto', + logScale:false, + precision:2, + meter:false, + path:'auto', + preArgs:[], + target:[] +} + var Fader = function(widgetData){ _sliders_base.apply(this,arguments) @@ -157,12 +194,12 @@ Fader.prototype.draw = function(){ this.ctx.save() this.ctx.globalAlpha = 0.3 - this.ctx.arc(d + this.margin * PXSCALE, this.height / 2, 10 *PXSCALE, Math.PI * 2,false) + this.ctx.arc(d + this.margin * PXSCALE, this.height / 2, 10 * PXSCALE, Math.PI * 2) this.ctx.fill() this.ctx.restore() this.ctx.beginPath() - this.ctx.arc(d + this.margin * PXSCALE, this.height / 2, 4 * PXSCALE, Math.PI * 2,false) + this.ctx.arc(d + this.margin * PXSCALE, this.height / 2, 4 * PXSCALE, Math.PI * 2) this.ctx.fill() } @@ -184,7 +221,7 @@ Fader.prototype.draw = function(){ this.ctx.beginPath() this.ctx.fillStyle = this.colors.knob - this.ctx.rect(0, Math.min(d,this.height-PXSCALE), this.width, PXSCALE) + this.ctx.rect(0, Math.min(d, this.height - PXSCALE), this.width, PXSCALE) this.ctx.fill() @@ -207,54 +244,17 @@ Fader.prototype.draw = function(){ this.ctx.fillStyle = this.colors.knob this.ctx.save() this.ctx.globalAlpha = 0.3 - this.ctx.arc(this.width / 2, d, 10 *PXSCALE, Math.PI * 2,false) + this.ctx.arc(this.width / 2, d, 10 * PXSCALE, Math.PI * 2,false) this.ctx.fill() this.ctx.restore() this.ctx.beginPath() - this.ctx.arc(this.width / 2, d, 4 *PXSCALE, Math.PI * 2,false) + this.ctx.arc(this.width / 2, d, 4 * PXSCALE, Math.PI * 2,false) this.ctx.fill() } } } - -module.exports.options = { - type:'fader', - id:'auto', - linkId:'', - - separator1:'style', - - label:'auto', - unit:'', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - alignRight:false, - horizontal:false, - noPip:false, - compact:false, - color:'auto', - css:'', - - separator2:'behaviour', - - snap:false, - - separator3:'osc', - - range:{min:0,max:1}, - origin: 'auto', - logScale:false, - precision:2, - meter:false, - path:'auto', - preArgs:[], - target:[] -} - module.exports.create = function(widgetData,container) { var fader = new Fader(widgetData, container) diff --git a/browser/js/app/widgets/knob.js b/browser/js/app/widgets/sliders/knob.js similarity index 64% rename from browser/js/app/widgets/knob.js rename to browser/js/app/widgets/sliders/knob.js index 6f21a699..9a1a72b5 100644 --- a/browser/js/app/widgets/knob.js +++ b/browser/js/app/widgets/sliders/knob.js @@ -1,7 +1,6 @@ -var utils = require('./utils'), - clip = utils.clip, - mapToScale = utils.mapToScale, - sendOsc = utils.sendOsc +var {clip, mapToScale, sendOsc} = require('../utils'), + _sliders_base = require('./_sliders_base') + module.exports.options = { type:'knob', @@ -19,6 +18,7 @@ module.exports.options = { color:'auto', noPip:false, compact:false, + angle:270, css:'', separator2:'behaviour', @@ -28,13 +28,153 @@ module.exports.options = { separator3:'osc', range:{min:0,max:1}, + origin: 'auto', logScale:false, precision:2, path:'auto', preArgs:[], target:[] } -module.exports.create = function(widgetData,container) { + + + +Knob = function(widgetData) { + + _sliders_base.apply(this,arguments) + + this.widget.addClass('knob') + + this.lastOffsetX = 0 + this.lastOffsetY = 0 + this.minDimension = 0 + + this.maxAngle = widgetData.angle + + // calculate lost height factor + var a = Math.sin((360 - this.maxAngle)), + h = a < 0 ? 1 - a : a + + this.lostHeightFactor = h / 4 + +} + + +Knob.prototype = Object.create(_sliders_base.prototype) + +Knob.prototype.constructor = Knob + +Knob.prototype.draginitHandle = function(e, data, traversing){ + + this.percent = clip(this.percent,[0,100]) + + this.lastOffsetX = data.offsetX + this.lastOffsetY = data.offsetY + + if (!(traversing || this.widgetData.snap)) return + + this.percent = this.angleToPercent(this.coordsToAngle(data.offsetX, data.offsetY)) + + this.setValue(this.percentToValue(this.percent), true, true, true) + +} + +Knob.prototype.dragHandle = function(e, data, traversing) { + + + if (!(traversing || this.widgetData.snap)) { + + this.percent = -data.speedY + this.percent + + } else { + + this.lastOffsetX = this.lastOffsetX + data.speedX + this.lastOffsetY = this.lastOffsetY + data.speedY + this.percent = this.angleToPercent(this.coordsToAngle(this.lastOffsetX, this.lastOffsetY)) + } + + this.percent = this.percent,[0,100] + + this.setValue(this.percentToValue(this.percent), true, true, true) + +} + +Knob.prototype.coordsToAngle = function(x,y) { + var xToCenter = x - this.width /2, + yToCenter = y - this.height / 2, + angle = Math.atan2(-yToCenter, -xToCenter) * 180 / Math.PI + 90 + + return angle<0?360+angle:angle +} + +Knob.prototype.angleToPercent = function(angle) { + return clip(angle - (360 - this.maxAngle) / 2, [0, this.maxAngle]) / this.maxAngle * 100 +} + +Knob.prototype.percentToAngle = function(percent) { + var percent = clip(percent, [0, 100]) + return 2 * Math.PI * percent / 100 * (this.maxAngle / 360) // angle relative to maxAngle + + Math.PI / 2 // quarter circle offset + + Math.PI * (1 - this.maxAngle / 360) // centering offset depending on maxAngle +} + +Knob.prototype.resizeHandle = function() { + _sliders_base.prototype.resizeHandle.call(this) + this.minDimension = Math.min(this.width, this.height) + this.canvas[0].style.top = (this.minDimension / 2 - 15) * this.lostHeightFactor + 'px' +} + + +Knob.prototype.draw = function(){ + + var o = this.percentToAngle(this.valueToPercent(this.originValue)), + d = this.percentToAngle(this.percent), + min = this.percentToAngle(0), + max = this.percentToAngle(100) + + this.ctx.clearRect(0,0,this.width,this.height) + + this.ctx.lineWidth = 2 * PXSCALE + this.ctx.beginPath() + this.ctx.strokeStyle = this.colors.track + this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - 15 * PXSCALE, min, max) + this.ctx.stroke() + + + this.ctx.beginPath() + this.ctx.strokeStyle = this.colors.custom + this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - 15 * PXSCALE, Math.min(o,d), Math.max(o,d)) + this.ctx.stroke() + + + this.ctx.save() + + this.ctx.translate(this.width / 2, this.height / 2) + this.ctx.rotate(d) + this.ctx.translate(-this.width / 2, -this.height / 2) + + this.ctx.beginPath() + + this.ctx.fillStyle = this.colors.gauge + this.ctx.arc(this.width / 2 + this.minDimension / 2 - 15 * PXSCALE, this.height / 2, 4 * PXSCALE, 0, Math.PI * 2) + this.ctx.fill() + + this.ctx.globalAlpha = 0.3 + this.ctx.fillStyle = this.colors.knob + this.ctx.arc(this.width / 2 + this.minDimension / 2 - 15 * PXSCALE, this.height / 2, 10 * PXSCALE, 0, Math.PI * 2) + this.ctx.fill() + + this.ctx.restore() +} + + +module.exports.create = function(widgetData) { + var knob = new Knob(widgetData) + return knob.widget +} + + + +var oldstuf = function(widgetData,container) { var widget = $(`
diff --git a/browser/js/browser-headless.bundle.js b/browser/js/browser-headless.bundle.js index 1d47c72d..397767b9 100644 --- a/browser/js/browser-headless.bundle.js +++ b/browser/js/browser-headless.bundle.js @@ -1610,7 +1610,7 @@ module.exports = { var widgets = { // sliders fader: require('./widgets/sliders/fader'), - knob: require('./widgets/knob'), + knob: require('./widgets/sliders/knob'), // buttons toggle: require('./widgets/toggle'), @@ -1689,7 +1689,7 @@ module.exports.sync = function() { }) } -},{"./widgets/knob":17,"./widgets/multifader":18,"./widgets/multipush":19,"./widgets/multitoggle":20,"./widgets/panel":21,"./widgets/plots/eq":24,"./widgets/plots/led":25,"./widgets/plots/meter":26,"./widgets/plots/plot":27,"./widgets/plots/text":28,"./widgets/plots/visualizer":29,"./widgets/push":30,"./widgets/rgb":31,"./widgets/sliders/fader":33,"./widgets/strip":34,"./widgets/switch":35,"./widgets/toggle":36,"./widgets/xy":38}],15:[function(require,module,exports){ +},{"./widgets/multifader":17,"./widgets/multipush":18,"./widgets/multitoggle":19,"./widgets/panel":20,"./widgets/plots/eq":23,"./widgets/plots/led":24,"./widgets/plots/meter":25,"./widgets/plots/plot":26,"./widgets/plots/text":27,"./widgets/plots/visualizer":28,"./widgets/push":29,"./widgets/rgb":30,"./widgets/sliders/fader":32,"./widgets/sliders/knob":33,"./widgets/strip":34,"./widgets/switch":35,"./widgets/toggle":36,"./widgets/xy":38}],15:[function(require,module,exports){ var _widgets_base = require('./_widgets_base') var _canvas_base = module.exports = function() { @@ -1760,284 +1760,6 @@ var _widget_base = module.exports = function(widgetData) { } },{}],17:[function(require,module,exports){ -var utils = require('./utils'), - clip = utils.clip, - mapToScale = utils.mapToScale, - sendOsc = utils.sendOsc - -module.exports.options = { - type:'knob', - id:'auto', - linkId:'', - - separator1:'style', - - label:'auto', - unit:'', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - color:'auto', - noPip:false, - compact:false, - css:'', - - separator2:'behaviour', - - snap:false, - - separator3:'osc', - - range:{min:0,max:1}, - logScale:false, - precision:2, - path:'auto', - preArgs:[], - target:[] -} -module.exports.create = function(widgetData,container) { - var widget = $(` -
-
-
-
-
-
-
-
-
-
-
-
-
- `), - wrapper = widget.find('.knob-wrapper'), - mask = widget.find('.knob-mask'), - knob = widget.find('.knob'), - handle = widget.find('.handle'), - input = widget.find('.input').fakeInput({align:'center'}), - range = widgetData.range, - unit = widgetData.unit?' '+widgetData.unit.trim(): '', - snap = widgetData.snap, - logScale = widgetData.logScale, - roundFactor = Math.pow(10,widgetData.precision) - - if (widgetData.noPip) wrapper.addClass('no-pip') - if (widgetData.compact) container.addClass('compact') - - - var rangeKeys = [], - rangeVals = [], - rangeLabels = [] - - for (k in widgetData.range) { - var key = k=='min'?0:k=='max'?100:parseInt(k), - val = typeof widgetData.range[k] == 'object'? - widgetData.range[k][Object.keys(widgetData.range[k])[0]]: - widgetData.range[k], - label = typeof widgetData.range[k] == 'object'? - Object.keys(widgetData.range[k])[0]: - val - - rangeKeys.push(key) - rangeVals.push(val) - rangeLabels.push(label) - } - - var rangeValsMax = Math.max.apply(Math, rangeVals), - rangeValsMin = Math.min.apply(Math, rangeVals) - - - var pipmin = Math.abs(rangeLabels[0])>=1000?rangeLabels[0]/1000+'k':rangeLabels[0], - pipmax = Math.abs(rangeLabels[rangeLabels.length-1])>=1000?rangeLabels[rangeLabels.length-1]/1000+'k':rangeLabels[rangeLabels.length-1] - - - - widget.find('.pip.min').text(pipmin) - widget.find('.pip.max').text(pipmax) - - mask.size = 0 - widget.value = undefined - - wrapper.resize(function(e,width,height){ - - var w = Math.floor(Math.min(height,width)*.58) - - if (!w || mask.size==w) return - mask.size=w - mask[0].setAttribute('style',`height:${w}px;width:${w}px;padding-bottom:0`) - wrapper.size = {width:wrapper[0].clientWidth,height:wrapper[0].clientHeight} - }) - - wrapper.on('fake-right-click',function(e){ - if (!EDITING) { - e.stopPropagation() - e.preventDefault() - input.focus() - } - }) - - wrapper.on('mousewheel',function(e){ - if (e.originalEvent.wheelDeltaX) return - - e.preventDefault() - e.stopPropagation() - - var divider = e.ctrlKey?48:8 - knob.rotation = clip(knob.rotation+e.originalEvent.wheelDeltaY/divider,[0,270]) - - widget.updateUi(knob.rotation) - - var v = widget.getValue() - - if (v!=widget.value) { - widget.value = v - - widget.sendValue(v) - widget.showValue(v) - - widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - }) - - - knob.rotation = 0 - - var offR = 0, - offX = 0, - offY = 0 - wrapper.on('draginit',function(e,data,traversing){ - - if (snap || traversing) { - - var w = wrapper.size.width, - h = wrapper.size.height, - x = data.offsetX-w/2, - y = data.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 - - widget.updateUi(r) - - knob.rotation = r - - var v = widget.getValue() - - if (v!=widget.value) { - widget.value = v - - widget.sendValue(v) - widget.showValue(v) - - widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - - } - - offR = knob.rotation - }) - - wrapper.on('drag',function(e,data){ - - var r = clip(-data.deltaY*2+offR,[0,270]) - - if (snap || data.ctrlKey || data.shiftKey) { - var w = data.target.clientWidth, - h = data.target.clientHeight, - x = data.deltaX + offX, - y = data.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]) - } - - widget.updateUi(r) - - knob.rotation = r - - var v = widget.getValue() - - if (v!=widget.value) { - widget.value = v - - widget.sendValue(v) - widget.showValue(v) - - widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - }) - - widget.updateUi = function(r) { - knob[0].setAttribute('style','transform:rotateZ('+r+'deg)') - handle[0].setAttribute('style','transform:rotateZ('+(r-45)+'deg)') - - if (r>180) {knob.addClass('d3')} - else if (r>90) {knob.removeClass('d3').addClass('d2')} - else {knob.removeClass('d3 d2')} - } - - widget.getValue = function() { - var h = knob.rotation - for (var i=0;i= rangeKeys[i]*2.7) { - return mapToScale(h,[rangeKeys[i]*2.7,rangeKeys[i+1]*2.7],[rangeVals[i],rangeVals[i+1]],widgetData.precision,logScale) - } - } - } - widget.showValue = function(v) { - input.val(v+unit) - } - widget.sendValue = function(v) { - var args = widgetData.preArgs.concat(v) - - sendOsc({ - target:widgetData.target, - path:widgetData.path, - precision:widgetData.precision, - args:args - }) - } - widget.setValue = function(v,send,sync) { - if (typeof v != 'number') return - - var v = clip(Math.round(v*roundFactor)/roundFactor,[rangeValsMin,rangeValsMax]), - r - - for (var i=0;i= rangeVals[i]) { - r = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i]*2.7,rangeKeys[i+1]*2.7],false,logScale,true) - break - } - } - - knob.rotation = r - - widget.updateUi(r) - - var v = widget.getValue() - widget.value = v - - widget.showValue(v) - - if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - if (send) widget.sendValue(v) - } - input.change(function(){ - widget.setValue(parseFloat(input.val()),true,true) - }) - - widget.setValue(rangeVals[0]) - return widget -} - -},{"./utils":37}],18:[function(require,module,exports){ module.exports.options = { type:'multifader', id:'auto', @@ -2124,7 +1846,7 @@ module.exports.create = function(widgetData,container) { return widget } -},{"../parser":10}],19:[function(require,module,exports){ +},{"../parser":10}],18:[function(require,module,exports){ module.exports.options = { type:'multipush', id:'auto', @@ -2202,7 +1924,7 @@ module.exports.create = function(widgetData,container) { return widget } -},{"../parser":10}],20:[function(require,module,exports){ +},{"../parser":10}],19:[function(require,module,exports){ module.exports.options = { type:'multitoggle', id:'auto', @@ -2280,7 +2002,7 @@ module.exports.create = function(widgetData,container) { return widget } -},{"../parser":10}],21:[function(require,module,exports){ +},{"../parser":10}],20:[function(require,module,exports){ module.exports.options = { type:'panel', id:'auto', @@ -2323,7 +2045,7 @@ module.exports.create = function(widgetData,container) { return widget } -},{"../parser":10}],22:[function(require,module,exports){ +},{"../parser":10}],21:[function(require,module,exports){ // // calcBiquad // @@ -2462,7 +2184,7 @@ module.exports = function(options,linear,resolution) { return magPlot } -},{}],23:[function(require,module,exports){ +},{}],22:[function(require,module,exports){ var {mapToScale} = require('../utils'), _canvas_base = require('../common/_canvas_base') @@ -2590,7 +2312,7 @@ _plots_base.prototype.updateData = function(){ // update the coordinates to draw } -},{"../common/_canvas_base":15,"../utils":37}],24:[function(require,module,exports){ +},{"../common/_canvas_base":15,"../utils":37}],23:[function(require,module,exports){ var {mapToScale, clip} = require('../utils'), _biquad_response = require('./_biquad_response'), _plots_base = require('./_plots_base') @@ -2704,7 +2426,7 @@ module.exports.create = function(widgetData) { return eq.widget } -},{"../utils":37,"./_biquad_response":22,"./_plots_base":23}],25:[function(require,module,exports){ +},{"../utils":37,"./_biquad_response":21,"./_plots_base":22}],24:[function(require,module,exports){ var {mapToScale} = require('../utils') module.exports.options = { @@ -2747,7 +2469,7 @@ module.exports.create = function(widgetData,container) { return widget } -},{"../utils":37}],26:[function(require,module,exports){ +},{"../utils":37}],25:[function(require,module,exports){ var {mapToScale, clip} = require('../utils') module.exports.options = { @@ -2834,7 +2556,7 @@ module.exports.create = function(widgetData,container) { return widget } -},{"../utils":37}],27:[function(require,module,exports){ +},{"../utils":37}],26:[function(require,module,exports){ var {mapToScale} = require('../utils'), _plots_base = require('./_plots_base') @@ -2924,7 +2646,7 @@ module.exports.create = function(widgetData) { return plot.widget } -},{"../utils":37,"./_plots_base":23}],28:[function(require,module,exports){ +},{"../utils":37,"./_plots_base":22}],27:[function(require,module,exports){ module.exports.options = { type:'text', id:'auto', @@ -2977,7 +2699,7 @@ module.exports.create = function(widgetData,container) { return widget } -},{}],29:[function(require,module,exports){ +},{}],28:[function(require,module,exports){ var {mapToScale, clip} = require('../utils'), _plots_base = require('./_plots_base') @@ -3105,7 +2827,7 @@ module.exports.create = function(widgetData,container) { return visualizer.widget } -},{"../utils":37,"./_plots_base":23}],30:[function(require,module,exports){ +},{"../utils":37,"./_plots_base":22}],29:[function(require,module,exports){ var sendOsc = require('./utils').sendOsc module.exports.options = { @@ -3214,7 +2936,7 @@ module.exports.create = function(widgetData,container) { return widget } -},{"./utils":37}],31:[function(require,module,exports){ +},{"./utils":37}],30:[function(require,module,exports){ var utils = require('./utils'), clip = utils.clip, mapToScale = utils.mapToScale, @@ -3508,7 +3230,7 @@ module.exports.create = function(widgetData,container) { return widget } -},{"./utils":37}],32:[function(require,module,exports){ +},{"./utils":37}],31:[function(require,module,exports){ var {clip, roundTo, mapToScale, sendOsc} = require('../utils') var _canvas_base = require('../common/_canvas_base') @@ -3525,6 +3247,7 @@ var _sliders_base = module.exports = function(){ _canvas_base.apply(this, arguments) + this.wrapper = this.widget.find('.wrapper') this.input = this.widget.find('.input').fakeInput({align:'center'}) this.roundFactor = Math.pow(10,this.widgetData.precision) this.value = undefined @@ -3683,10 +3406,47 @@ _sliders_base.prototype.showValue = function() { this.input.val(this.value + ' ' + this.widgetData.unit) } -},{"../common/_canvas_base":15,"../utils":37}],33:[function(require,module,exports){ +},{"../common/_canvas_base":15,"../utils":37}],32:[function(require,module,exports){ var {clip, mapToScale, sendOsc} = require('../utils'), _sliders_base = require('./_sliders_base') + +module.exports.options = { + type:'fader', + id:'auto', + linkId:'', + + separator1:'style', + + label:'auto', + unit:'', + left:'auto', + top:'auto', + width:'auto', + height:'auto', + alignRight:false, + horizontal:false, + noPip:false, + compact:false, + color:'auto', + css:'', + + separator2:'behaviour', + + snap:false, + + separator3:'osc', + + range:{min:0,max:1}, + origin: 'auto', + logScale:false, + precision:2, + meter:false, + path:'auto', + preArgs:[], + target:[] +} + var Fader = function(widgetData){ _sliders_base.apply(this,arguments) @@ -3843,12 +3603,12 @@ Fader.prototype.draw = function(){ this.ctx.save() this.ctx.globalAlpha = 0.3 - this.ctx.arc(d + this.margin * PXSCALE, this.height / 2, 10 *PXSCALE, Math.PI * 2,false) + this.ctx.arc(d + this.margin * PXSCALE, this.height / 2, 10 * PXSCALE, Math.PI * 2) this.ctx.fill() this.ctx.restore() this.ctx.beginPath() - this.ctx.arc(d + this.margin * PXSCALE, this.height / 2, 4 * PXSCALE, Math.PI * 2,false) + this.ctx.arc(d + this.margin * PXSCALE, this.height / 2, 4 * PXSCALE, Math.PI * 2) this.ctx.fill() } @@ -3870,7 +3630,7 @@ Fader.prototype.draw = function(){ this.ctx.beginPath() this.ctx.fillStyle = this.colors.knob - this.ctx.rect(0, Math.min(d,this.height-PXSCALE), this.width, PXSCALE) + this.ctx.rect(0, Math.min(d, this.height - PXSCALE), this.width, PXSCALE) this.ctx.fill() @@ -3893,20 +3653,30 @@ Fader.prototype.draw = function(){ this.ctx.fillStyle = this.colors.knob this.ctx.save() this.ctx.globalAlpha = 0.3 - this.ctx.arc(this.width / 2, d, 10 *PXSCALE, Math.PI * 2,false) + this.ctx.arc(this.width / 2, d, 10 * PXSCALE, Math.PI * 2,false) this.ctx.fill() this.ctx.restore() this.ctx.beginPath() - this.ctx.arc(this.width / 2, d, 4 *PXSCALE, Math.PI * 2,false) + this.ctx.arc(this.width / 2, d, 4 * PXSCALE, Math.PI * 2,false) this.ctx.fill() } } } +module.exports.create = function(widgetData,container) { + + var fader = new Fader(widgetData, container) + return fader.widget +} + +},{"../../parser":10,"../utils":37,"./_sliders_base":31}],33:[function(require,module,exports){ +var {clip, mapToScale, sendOsc} = require('../utils'), + _sliders_base = require('./_sliders_base') + module.exports.options = { - type:'fader', + type:'knob', id:'auto', linkId:'', @@ -3918,11 +3688,10 @@ module.exports.options = { top:'auto', width:'auto', height:'auto', - alignRight:false, - horizontal:false, + color:'auto', noPip:false, compact:false, - color:'auto', + angle:270, css:'', separator2:'behaviour', @@ -3935,19 +3704,391 @@ module.exports.options = { origin: 'auto', logScale:false, precision:2, - meter:false, path:'auto', preArgs:[], target:[] } -module.exports.create = function(widgetData,container) { - var fader = new Fader(widgetData, container) - return fader.widget + +Knob = function(widgetData) { + + _sliders_base.apply(this,arguments) + + this.widget.addClass('knob') + + this.lastOffsetX = 0 + this.lastOffsetY = 0 + this.minDimension = 0 + + this.maxAngle = widgetData.angle + + // calculate lost height factor + var a = Math.sin((360 - this.maxAngle)), + h = a < 0 ? 1 - a : a + + this.lostHeightFactor = h / 4 + } -},{"../../parser":10,"../utils":37,"./_sliders_base":32}],34:[function(require,module,exports){ + +Knob.prototype = Object.create(_sliders_base.prototype) + +Knob.prototype.constructor = Knob + +Knob.prototype.draginitHandle = function(e, data, traversing){ + + this.percent = clip(this.percent,[0,100]) + + this.lastOffsetX = data.offsetX + this.lastOffsetY = data.offsetY + + if (!(traversing || this.widgetData.snap)) return + + this.percent = this.angleToPercent(this.coordsToAngle(data.offsetX, data.offsetY)) + + this.setValue(this.percentToValue(this.percent), true, true, true) + +} + +Knob.prototype.dragHandle = function(e, data, traversing) { + + + if (!(traversing || this.widgetData.snap)) { + + this.percent = -data.speedY + this.percent + + } else { + + this.lastOffsetX = this.lastOffsetX + data.speedX + this.lastOffsetY = this.lastOffsetY + data.speedY + this.percent = this.angleToPercent(this.coordsToAngle(this.lastOffsetX, this.lastOffsetY)) + } + + this.percent = this.percent,[0,100] + + this.setValue(this.percentToValue(this.percent), true, true, true) + +} + +Knob.prototype.coordsToAngle = function(x,y) { + var xToCenter = x - this.width /2, + yToCenter = y - this.height / 2, + angle = Math.atan2(-yToCenter, -xToCenter) * 180 / Math.PI + 90 + + return angle<0?360+angle:angle +} + +Knob.prototype.angleToPercent = function(angle) { + return clip(angle - (360 - this.maxAngle) / 2, [0, this.maxAngle]) / this.maxAngle * 100 +} + +Knob.prototype.percentToAngle = function(percent) { + var percent = clip(percent, [0, 100]) + return 2 * Math.PI * percent / 100 * (this.maxAngle / 360) // angle relative to maxAngle + + Math.PI / 2 // quarter circle offset + + Math.PI * (1 - this.maxAngle / 360) // centering offset depending on maxAngle +} + +Knob.prototype.resizeHandle = function() { + _sliders_base.prototype.resizeHandle.call(this) + this.minDimension = Math.min(this.width, this.height) + this.canvas[0].style.top = (this.minDimension / 2 - 15) * this.lostHeightFactor + 'px' +} + + +Knob.prototype.draw = function(){ + + var o = this.percentToAngle(this.valueToPercent(this.originValue)), + d = this.percentToAngle(this.percent), + min = this.percentToAngle(0), + max = this.percentToAngle(100) + + this.ctx.clearRect(0,0,this.width,this.height) + + this.ctx.lineWidth = 2 * PXSCALE + this.ctx.beginPath() + this.ctx.strokeStyle = this.colors.track + this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - 15 * PXSCALE, min, max) + this.ctx.stroke() + + + this.ctx.beginPath() + this.ctx.strokeStyle = this.colors.custom + this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - 15 * PXSCALE, Math.min(o,d), Math.max(o,d)) + this.ctx.stroke() + + + this.ctx.save() + + this.ctx.translate(this.width / 2, this.height / 2) + this.ctx.rotate(d) + this.ctx.translate(-this.width / 2, -this.height / 2) + + this.ctx.beginPath() + + this.ctx.fillStyle = this.colors.gauge + this.ctx.arc(this.width / 2 + this.minDimension / 2 - 15 * PXSCALE, this.height / 2, 4 * PXSCALE, 0, Math.PI * 2) + this.ctx.fill() + + this.ctx.globalAlpha = 0.3 + this.ctx.fillStyle = this.colors.knob + this.ctx.arc(this.width / 2 + this.minDimension / 2 - 15 * PXSCALE, this.height / 2, 10 * PXSCALE, 0, Math.PI * 2) + this.ctx.fill() + + this.ctx.restore() +} + + +module.exports.create = function(widgetData) { + var knob = new Knob(widgetData) + return knob.widget +} + + + +var oldstuf = function(widgetData,container) { + var widget = $(` +
+
+
+
+
+
+
+
+
+
+
+
+
+ `), + wrapper = widget.find('.knob-wrapper'), + mask = widget.find('.knob-mask'), + knob = widget.find('.knob'), + handle = widget.find('.handle'), + input = widget.find('.input').fakeInput({align:'center'}), + range = widgetData.range, + unit = widgetData.unit?' '+widgetData.unit.trim(): '', + snap = widgetData.snap, + logScale = widgetData.logScale, + roundFactor = Math.pow(10,widgetData.precision) + + if (widgetData.noPip) wrapper.addClass('no-pip') + if (widgetData.compact) container.addClass('compact') + + + var rangeKeys = [], + rangeVals = [], + rangeLabels = [] + + for (k in widgetData.range) { + var key = k=='min'?0:k=='max'?100:parseInt(k), + val = typeof widgetData.range[k] == 'object'? + widgetData.range[k][Object.keys(widgetData.range[k])[0]]: + widgetData.range[k], + label = typeof widgetData.range[k] == 'object'? + Object.keys(widgetData.range[k])[0]: + val + + rangeKeys.push(key) + rangeVals.push(val) + rangeLabels.push(label) + } + + var rangeValsMax = Math.max.apply(Math, rangeVals), + rangeValsMin = Math.min.apply(Math, rangeVals) + + + var pipmin = Math.abs(rangeLabels[0])>=1000?rangeLabels[0]/1000+'k':rangeLabels[0], + pipmax = Math.abs(rangeLabels[rangeLabels.length-1])>=1000?rangeLabels[rangeLabels.length-1]/1000+'k':rangeLabels[rangeLabels.length-1] + + + + widget.find('.pip.min').text(pipmin) + widget.find('.pip.max').text(pipmax) + + mask.size = 0 + widget.value = undefined + + wrapper.resize(function(e,width,height){ + + var w = Math.floor(Math.min(height,width)*.58) + + if (!w || mask.size==w) return + mask.size=w + mask[0].setAttribute('style',`height:${w}px;width:${w}px;padding-bottom:0`) + wrapper.size = {width:wrapper[0].clientWidth,height:wrapper[0].clientHeight} + }) + + wrapper.on('fake-right-click',function(e){ + if (!EDITING) { + e.stopPropagation() + e.preventDefault() + input.focus() + } + }) + + wrapper.on('mousewheel',function(e){ + if (e.originalEvent.wheelDeltaX) return + + e.preventDefault() + e.stopPropagation() + + var divider = e.ctrlKey?48:8 + knob.rotation = clip(knob.rotation+e.originalEvent.wheelDeltaY/divider,[0,270]) + + widget.updateUi(knob.rotation) + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + }) + + + knob.rotation = 0 + + var offR = 0, + offX = 0, + offY = 0 + wrapper.on('draginit',function(e,data,traversing){ + + if (snap || traversing) { + + var w = wrapper.size.width, + h = wrapper.size.height, + x = data.offsetX-w/2, + y = data.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 + + widget.updateUi(r) + + knob.rotation = r + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + + } + + offR = knob.rotation + }) + + wrapper.on('drag',function(e,data){ + + var r = clip(-data.deltaY*2+offR,[0,270]) + + if (snap || data.ctrlKey || data.shiftKey) { + var w = data.target.clientWidth, + h = data.target.clientHeight, + x = data.deltaX + offX, + y = data.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]) + } + + widget.updateUi(r) + + knob.rotation = r + + var v = widget.getValue() + + if (v!=widget.value) { + widget.value = v + + widget.sendValue(v) + widget.showValue(v) + + widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + } + }) + + widget.updateUi = function(r) { + knob[0].setAttribute('style','transform:rotateZ('+r+'deg)') + handle[0].setAttribute('style','transform:rotateZ('+(r-45)+'deg)') + + if (r>180) {knob.addClass('d3')} + else if (r>90) {knob.removeClass('d3').addClass('d2')} + else {knob.removeClass('d3 d2')} + } + + widget.getValue = function() { + var h = knob.rotation + for (var i=0;i= rangeKeys[i]*2.7) { + return mapToScale(h,[rangeKeys[i]*2.7,rangeKeys[i+1]*2.7],[rangeVals[i],rangeVals[i+1]],widgetData.precision,logScale) + } + } + } + widget.showValue = function(v) { + input.val(v+unit) + } + widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + + sendOsc({ + target:widgetData.target, + path:widgetData.path, + precision:widgetData.precision, + args:args + }) + } + widget.setValue = function(v,send,sync) { + if (typeof v != 'number') return + + var v = clip(Math.round(v*roundFactor)/roundFactor,[rangeValsMin,rangeValsMax]), + r + + for (var i=0;i= rangeVals[i]) { + r = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i]*2.7,rangeKeys[i+1]*2.7],false,logScale,true) + break + } + } + + knob.rotation = r + + widget.updateUi(r) + + var v = widget.getValue() + widget.value = v + + widget.showValue(v) + + if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) + if (send) widget.sendValue(v) + } + input.change(function(){ + widget.setValue(parseFloat(input.val()),true,true) + }) + + widget.setValue(rangeVals[0]) + return widget +} + +},{"../utils":37,"./_sliders_base":31}],34:[function(require,module,exports){ module.exports.options = { type:'strip', diff --git a/browser/scss/widgets/_knob.scss b/browser/scss/widgets/_knob.scss index 7c7116c7..4289f3f7 100644 --- a/browser/scss/widgets/_knob.scss +++ b/browser/scss/widgets/_knob.scss @@ -1,3 +1,27 @@ +.knob { + height:100%; + overflow: hidden; + display: flex; + flex-direction: column; + position: relative; + + .wrapper { + overflow: hidden; + flex:1; + display: flex; + max-height: 100%; + width: 100%; + position: relative; + + canvas { + flex:1; + max-height: 100%; + width: 100%; + position: relative; + } + } +} + .knob-container { --color-pips: var(--color-text-fade); --color-gauge: var(--color-custom);