From 064c435b09c8765e4cf36dd577c8dd31eab15a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sun, 5 May 2024 21:15:11 +0200 Subject: [PATCH] refactor(legacy): remove unused waveform related code (#3003) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thomas Göttgens Co-authored-by: Kyle Robbertze --- legacy/application/assets.json | 7 +- legacy/application/forms/EditAudioMD.php | 8 - .../views/scripts/library/edit-file-md.phtml | 81 ++-- legacy/public/css/styles.css | 41 +- .../js/waveformplaylist/track_render.js | 449 ------------------ legacy/public/js/wavesurfer/libretime.js | 191 +------- legacy/public/js/wavesurfer/minimap.js | 424 ----------------- legacy/public/js/wavesurfer/minimap.min.js | 7 - 8 files changed, 62 insertions(+), 1146 deletions(-) delete mode 100644 legacy/public/js/waveformplaylist/track_render.js delete mode 100644 legacy/public/js/wavesurfer/minimap.js delete mode 100644 legacy/public/js/wavesurfer/minimap.min.js diff --git a/legacy/application/assets.json b/legacy/application/assets.json index 05739af05..1e0504fcf 100644 --- a/legacy/application/assets.json +++ b/legacy/application/assets.json @@ -43,7 +43,7 @@ "css/show_analytics.css": "4393c521308277447afabe8791779bf1", "css/showbuilder.css": "4421c01b5c2dfb03f8d06dd6023b4bd7", "css/station_podcast.css": "88e9b38ead71eddc69ef50bfc8cb2d0d", - "css/styles.css": "29ce2292b2c007e86d192d0deeaf88ad", + "css/styles.css": "f38f7f24c3895c146babbb56a6534730", "css/tipsy/jquery.tipsy.css": "b13517583583f83ed7d5fc067a0c9372", "css/tracktypes.css": "94c94817a8505ff4dfcd090987859a7e", "css/users.css": "94c94817a8505ff4dfcd090987859a7e", @@ -180,12 +180,9 @@ "js/waveformplaylist/playout.js": "7dfc5fe760f3c6739e38499df7b61e47", "js/waveformplaylist/time_scale.js": "74e0e17e1c8cd597449220c98de408ba", "js/waveformplaylist/track.js": "5456e6081ffedf55a9e38571bc178781", - "js/waveformplaylist/track_render.js": "e371b582b23e4b618e039f096d2f0570", "js/wavesurfer/cursor.js": "8ed17a7437f3ec84972d15d0073249b2", "js/wavesurfer/cursor.min.js": "831165862b629e615cf59112fa00d963", - "js/wavesurfer/libretime.js": "17133cacf09fc204a572b56c99d44278", - "js/wavesurfer/minimap.js": "c17dd315386006bb3cffdabb5f715c7b", - "js/wavesurfer/minimap.min.js": "90b2f2d1d1b4eb189d1a9c3c27dcb4f7", + "js/wavesurfer/libretime.js": "dfaefa6d32657faa77af6145d9d191ae", "js/wavesurfer/regions.js": "aafe4f696d3da50c976d11e472fd56d1", "js/wavesurfer/regions.min.js": "2ed2f8b5880beee568942000a6139e85", "js/wavesurfer/timeline.js": "0bd70779070513c2a4f34237a0f9f573", diff --git a/legacy/application/forms/EditAudioMD.php b/legacy/application/forms/EditAudioMD.php index 2247e2d21..f9ee49285 100644 --- a/legacy/application/forms/EditAudioMD.php +++ b/legacy/application/forms/EditAudioMD.php @@ -190,14 +190,6 @@ class Application_Form_EditAudioMD extends Zend_Form ]); $this->addElement($mood); - // Add replay gain field - $replay_gain = new Zend_Form_Element_Hidden('replay_gain'); - $replay_gain->class = 'input_text replay_gain_' . $p_id; - $replay_gain->setLabel(_('Replay Gain:')) - ->addDecorator('HtmlTag', ['tag' => 'div', 'style' => 'display:none']) - ->removeDecorator('Label'); - $this->addElement($replay_gain); - // Add bmp field $bpm = new Zend_Form_Element_Text('bpm'); $bpm->class = 'input_text'; diff --git a/legacy/application/views/scripts/library/edit-file-md.phtml b/legacy/application/views/scripts/library/edit-file-md.phtml index 06a7ebd9f..09380f07d 100644 --- a/legacy/application/views/scripts/library/edit-file-md.phtml +++ b/legacy/application/views/scripts/library/edit-file-md.phtml @@ -1,12 +1,6 @@ artwork, 256); $baseUrl = Config::getBasePath(); - -$get_replay_gain = Application_Model_Preference::getReplayGainModifier(); -if (!Application_Model_Preference::GetEnableReplayGain() ) { - $get_replay_gain = 0; -} -$analogMeter = true; ?>
@@ -45,8 +39,8 @@ $analogMeter = true;
form; ?> -
-
+
+
@@ -88,54 +82,45 @@ $analogMeter = true;
-
diff --git a/legacy/public/css/styles.css b/legacy/public/css/styles.css index 6e97b930d..6e7b3a515 100644 --- a/legacy/public/css/styles.css +++ b/legacy/public/css/styles.css @@ -4363,44 +4363,19 @@ body.droppable .artwork-upload .artwork-preview { width: 480px; } -/* -webkit-appearance: none; --moz-appearance: none; --ms-appearance: none; -appearance: none; */ -textarea, -input { +.visual-waveform-editor textarea, +.visual-waveform-editor input, +.visual-waveform-editor input:focus, +.visual-waveform-editor select:focus, +.visual-waveform-editor textarea:focus, +.visual-waveform-editor button:focus { outline: none; -} +} */ -input:focus, -select:focus, -textarea:focus, -button:focus { - outline: none; -} - -.navtt { - margin-bottom: 18px; - margin-left: 0; - list-style: none; -} - -.navtt > li > a { - display: block; -} - -li { +.visual-waveform-editor li { line-height: 18px; } -.navtt-content.active { - display: block; -} - -.navtt-content.hide { - display: none; -} - .btn-control-player { padding: 5px 7px 5px 10px; font-size: 14px; diff --git a/legacy/public/js/waveformplaylist/track_render.js b/legacy/public/js/waveformplaylist/track_render.js deleted file mode 100644 index 9f419dd99..000000000 --- a/legacy/public/js/waveformplaylist/track_render.js +++ /dev/null @@ -1,449 +0,0 @@ -'use strict'; - -var WaveformDrawer = function() { - -}; - -WaveformDrawer.prototype.init = function(container, config) { - - makePublisher(this); - - this.config = config; - this.container = container; - this.channels = []; //array of canvases, contexts, 1 for each channel displayed. - - var theme = this.config.getUITheme(); - - if (this.loaderStates[theme] !== undefined) { - this.loaderStates = this.loaderStates[theme]; - } - else { - this.loaderStates = this.loaderStates["default"]; - } -}; - -WaveformDrawer.prototype.loaderStates = { - "bootstrap": { - "downloading": "progress progress-warning", - "decoding": "progress progress-success progress-striped active", - "loader": "bar" - }, - - "jQueryUI": { - "downloading": "ui-progressbar ui-widget ui-widget-content ui-corner-all", - "decoding": "ui-progressbar ui-widget ui-widget-content ui-corner-all", - "loader": "ui-progressbar-value ui-widget-header ui-corner-left" - }, - - "default": { - "downloading": "progress", - "decoding": "decoding", - "loader": "bar" - } -}; - -WaveformDrawer.prototype.getPeaks = function(buffer, cues) { - - // Frames per pixel - var res = this.config.getResolution(), - peaks = [], - i, c, p, l, - chanLength = cues.cueout - cues.cuein, - pixels = Math.ceil(chanLength / res), - numChan = buffer.numberOfChannels, - weight = 1 / (numChan), - makeMono = this.config.isDisplayMono(), - chan, - start, - end, - vals, - max, - min, - maxPeak = -Infinity; //used to scale the waveform on the canvas. - - for (i = 0; i < pixels; i++) { - - peaks[i] = []; - - for (c = 0; c < numChan; c++) { - - chan = buffer.getChannelData(c); - chan = chan.subarray(cues.cuein, cues.cueout); - - start = i * res; - end = (i + 1) * res > chanLength ? chanLength : (i + 1) * res; - vals = chan.subarray(start, end); - max = -Infinity; - min = Infinity; - - for (p = 0, l = vals.length; p < l; p++) { - if (vals[p] > max){ - max = vals[p]; - } - if (vals[p] < min){ - min = vals[p]; - } - } - peaks[i].push({max:max, min:min}); - maxPeak = Math.max.apply(Math, [maxPeak, Math.abs(max), Math.abs(min)]); - } - - if (makeMono) { - max = min = 0; - - for (c = 0 ; c < numChan; c++) { - max = max + weight * peaks[i][c].max; - min = min + weight * peaks[i][c].min; - } - - peaks[i] = []; //need to clear out old stuff (maybe we should keep it for toggling views?). - peaks[i].push({max:max, min:min}); - } - } - - this.maxPeak = maxPeak; - this.peaks = peaks; -}; - -WaveformDrawer.prototype.setTimeShift = function(pixels) { - var i, len; - - for (i = 0, len = this.channels.length; i < len; i++) { - this.channels[i].div.style.left = pixels+"px"; - } -}; - -WaveformDrawer.prototype.updateLoader = function(percent) { - this.loader.style.width = percent+"%"; -}; - -WaveformDrawer.prototype.setLoaderState = function(state) { - this.progressDiv.className = this.loaderStates[state]; -}; - -WaveformDrawer.prototype.drawLoading = function() { - var div, - loader; - - this.height = this.config.getWaveHeight(); - - div = document.createElement("div"); - div.style.height = this.height+"px"; - - loader = document.createElement("div"); - loader.style.height = "10px"; - loader.className = this.loaderStates["loader"]; - - div.appendChild(loader); - - this.progressDiv = div; - this.loader = loader; - - this.setLoaderState("downloading"); - this.updateLoader(0); - - this.container.appendChild(div); -}; - -WaveformDrawer.prototype.drawBuffer = function(buffer, pixelOffset, cues) { - var canv, - div, - i, - top = 0, - left = 0, - makeMono = this.config.isDisplayMono(), - res = this.config.getResolution(), - numChan = makeMono? 1 : buffer.numberOfChannels, - numSamples = cues.cueout - cues.cuein + 1, - fragment = document.createDocumentFragment(), - wrapperHeight; - - this.container.innerHTML = ""; - this.channels = []; - - //width and height is per waveform canvas. - this.width = Math.ceil(numSamples / res); - this.height = this.config.getWaveHeight(); - - for (i = 0; i < numChan; i++) { - - div = document.createElement("div"); - div.classList.add("channel"); - div.classList.add("channel-"+i); - div.style.width = this.width+"px"; - div.style.height = this.height+"px"; - div.style.top = top+"px"; - div.style.left = left+"px"; - - canv = document.createElement("canvas"); - canv.setAttribute('width', this.width); - canv.setAttribute('height', this.height); - - this.channels.push({ - canvas: canv, - context: canv.getContext('2d'), - div: div - }); - - div.appendChild(canv); - fragment.appendChild(div); - - top = top + this.height; - } - - wrapperHeight = numChan * this.height; - this.container.style.height = wrapperHeight+"px"; - this.container.appendChild(fragment); - - - this.getPeaks(buffer, cues); - this.updateEditor(); - - this.setTimeShift(pixelOffset); -}; - -WaveformDrawer.prototype.drawFrame = function(chanNum, index, peaks, maxPeak, cursorPos, pixelOffset) { - var x, y, w, h, max, min, - h2 = this.height / 2, - cc = this.channels[chanNum].context, - colors = this.config.getColorScheme(); - - max = (peaks.max / maxPeak) * h2; - min = (peaks.min / maxPeak) * h2; - - w = 1; - x = index * w; - y = Math.round(h2 - max); - h = Math.ceil(max - min); - - //to prevent blank space when there is basically silence in the track. - h = h === 0 ? 1 : h; - - if (cursorPos >= (x + pixelOffset)) { - cc.fillStyle = colors.progressColor; - } - else { - cc.fillStyle = colors.waveColor; - } - - cc.fillRect(x, y, w, h); -}; - -/* - start, end are optional parameters to only redraw part of the canvas. -*/ -WaveformDrawer.prototype.draw = function(cursorPos, pixelOffset, start, end) { - var that = this, - peaks = this.peaks, - i = (start) ? start - pixelOffset : 0, - len = (end) ? end - pixelOffset + 1 : peaks.length; - - if (i < 0 && len < 0) { - return; - } - - if (i < 0) { - i = 0; - } - - if (len > peaks.length) { - len = peaks.length; - } - - this.clear(i, len); - - for (; i < len; i++) { - - peaks[i].forEach(function(peak, chanNum) { - that.drawFrame(chanNum, i, peak, that.maxPeak, cursorPos, pixelOffset); - }); - } -}; - -/* - If start/end are set clear only part of the canvas. -*/ -WaveformDrawer.prototype.clear = function(start, end) { - var i, len, - width = end - start; - - for (i = 0, len = this.channels.length; i < len; i++) { - this.channels[i].context.clearRect(start, 0, width, this.height); - } -}; - -WaveformDrawer.prototype.updateEditor = function(cursorPos, pixelOffset, start, end, highlighted, selected) { - var i, len, - fragment = document.createDocumentFragment(); - - this.container.innerHTML = ""; - - this.draw(cursorPos, pixelOffset, start, end); - - if (highlighted === true && selected !== undefined) { - var border = (selected.end - selected.start === 0) ? true : false; - this.drawHighlight(selected.start, selected.end, border); - } - - for (i = 0, len = this.channels.length; i < len; i++) { - fragment.appendChild(this.channels[i].div); - } - - this.container.appendChild(fragment); -}; - -/* - start, end in pixels. -*/ -WaveformDrawer.prototype.drawHighlight = function(start, end, isBorder) { - var i, len, - colors = this.config.getColorScheme(), - fillStyle, - ctx, - width = end - start + 1; - - fillStyle = (isBorder) ? colors.selectBorderColor : colors.selectBackgroundColor; - - for (i = 0, len = this.channels.length; i < len; i++) { - ctx = this.channels[i].context; - ctx.fillStyle = fillStyle; - ctx.fillRect(start, 0, width, this.height); - } -}; - -WaveformDrawer.prototype.sCurveFadeIn = function sCurveFadeIn(ctx, width) { - return Curves.createSCurveBuffer(width, (Math.PI/2)); -}; - -WaveformDrawer.prototype.sCurveFadeOut = function sCurveFadeOut(ctx, width) { - return Curves.createSCurveBuffer(width, -(Math.PI/2)); -}; - -WaveformDrawer.prototype.logarithmicFadeIn = function logarithmicFadeIn(ctx, width) { - return Curves.createLogarithmicBuffer(width, 10, 1); -}; - -WaveformDrawer.prototype.logarithmicFadeOut = function logarithmicFadeOut(ctx, width) { - return Curves.createLogarithmicBuffer(width, 10, -1); -}; - -WaveformDrawer.prototype.exponentialFadeIn = function exponentialFadeIn(ctx, width) { - return Curves.createExponentialBuffer(width, 1); -}; - -WaveformDrawer.prototype.exponentialFadeOut = function exponentialFadeOut(ctx, width) { - return Curves.createExponentialBuffer(width, -1); -}; - -WaveformDrawer.prototype.linearFadeIn = function linearFadeIn(ctx, width) { - return Curves.createLinearBuffer(width, 1); -}; - -WaveformDrawer.prototype.linearFadeOut = function linearFadeOut(ctx, width) { - return Curves.createLinearBuffer(width, -1); -}; - -WaveformDrawer.prototype.drawFadeCurve = function(ctx, shape, type, width) { - var method = shape+type, - fn = this[method], - colors = this.config.getColorScheme(), - curve, - i, len, - cHeight = this.height, - y; - - ctx.strokeStyle = colors.fadeColor; - - curve = fn.call(this, ctx, width); - - y = cHeight - curve[0] * cHeight; - ctx.beginPath(); - ctx.moveTo(0, y); - - for (i = 1, len = curve.length; i < len; i++) { - y = cHeight - curve[i] * cHeight; - ctx.lineTo(i, y); - } - ctx.stroke(); -}; - -WaveformDrawer.prototype.removeFade = function(id) { - var fadeClass = "playlist-fade-"+id, - el, els, - i,len; - - els = this.container.getElementsByClassName(fadeClass); - len = els.length; - - //DOM NodeList is live, use a decrementing counter. - if (len > 0) { - for (i = len-1; i >= 0; i--) { - el = els[i]; - el.parentNode.removeChild(el); - } - } -}; - -WaveformDrawer.prototype.drawFade = function(id, type, shape, start, end) { - var div, - canv, - width, - left, - fragment = document.createDocumentFragment(), - i, len, - dup, - ctx, - tmpCtx; - - if ((end - start) === 0) { - return; - } - - width = ~~(end - start + 1); - left = start; - - div = document.createElement("div"); - div.classList.add("playlist-fade"); - div.classList.add("playlist-fade-"+id); - div.style.width = width+"px"; - div.style.height = this.height+"px"; - div.style.top = 0; - div.style.left = left+"px"; - - canv = document.createElement("canvas"); - canv.setAttribute('width', width); - canv.setAttribute('height', this.height); - ctx = canv.getContext('2d'); - - this.drawFadeCurve(ctx, shape, type, width); - - div.appendChild(canv); - fragment.appendChild(div); - - for (i = 0, len = this.channels.length; i < len; i++) { - dup = fragment.cloneNode(true); - tmpCtx = dup.querySelector('canvas').getContext('2d'); - tmpCtx.drawImage(canv, 0, 0); - - this.channels[i].div.appendChild(dup); - } -}; - -WaveformDrawer.prototype.drawFades = function(fades) { - var id, - fade, - startPix, - endPix, - SR = this.config.getSampleRate(), - res = this.config.getResolution(); - - for (id in fades) { - fade = fades[id]; - - if (fades.hasOwnProperty(id)) { - startPix = fade.start * SR / res; - endPix = fade.end * SR / res; - this.drawFade(id, fade.type, fade.shape, startPix, endPix); - } - } -}; diff --git a/legacy/public/js/wavesurfer/libretime.js b/legacy/public/js/wavesurfer/libretime.js index ae894d420..29675b32d 100644 --- a/legacy/public/js/wavesurfer/libretime.js +++ b/legacy/public/js/wavesurfer/libretime.js @@ -4,19 +4,14 @@ var wavesurfer = []; window.addEventListener("load",()=>{ let op=window.inputKnobsOptions||{}; - op.knobWidth=op.knobWidth||op.knobDiameter||64; - op.knobHeight=op.knobHeight||op.knobDiameter||64; op.sliderWidth=op.sliderWidth||op.sliderDiameter||128; op.sliderHeight=op.sliderHeight||op.sliderDiameter||20; - op.switchWidth=op.switchWidth||op.switchDiameter||24; - op.switchHeight=op.switchHeight||op.switchDiameter||24; op.fgcolor=op.fgcolor||"#f00"; op.bgcolor=op.bgcolor||"#000"; - op.knobMode=op.knobMode||"linear"; op.sliderMode=op.sliderMode||"relative"; let styles=document.createElement("style"); styles.innerHTML= -`input[type=range].input-knob,input[type=range].input-slider{ +`input[type=range].input-slider{ -webkit-appearance:none; -moz-appearance:none; border:none; @@ -28,52 +23,24 @@ window.addEventListener("load",()=>{ background-color:transparent; touch-action:none; } -input[type=range].input-knob{ - width:${op.knobWidth}px; height:${op.knobHeight}px; -} input[type=range].input-slider{ width:${op.sliderWidth}px; height:${op.sliderHeight}px; } -input[type=range].input-knob::-webkit-slider-thumb,input[type=range].input-slider::-webkit-slider-thumb{ +input[type=range].input-slider::-webkit-slider-thumb{ -webkit-appearance:none; opacity:0; } -input[type=range].input-knob::-moz-range-thumb,input[type=range].input-slider::-moz-range-thumb{ +input[type=range].input-slider::-moz-range-thumb{ -moz-appearance:none; height:0; border:none; } -input[type=range].input-knob::-moz-range-track,input[type=range].input-slider::-moz-range-track{ +input[type=range].input-slider::-moz-range-track{ -moz-appearance:none; height:0; border:none; -} -input[type=checkbox].input-switch,input[type=radio].input-switch { - width:${op.switchWidth}px; - height:${op.switchHeight}px; - -webkit-appearance:none; - -moz-appearance:none; - background-size:100% 200%; - background-position:0% 0%; - background-repeat:no-repeat; - border:none; - border-radius:0; - background-color:transparent; -} -input[type=checkbox].input-switch:checked,input[type=radio].input-switch:checked { - background-position:0% 100%; }`; document.head.appendChild(styles); - let makeKnobFrames=(fr,fg,bg)=>{ - let r= -` - - -`; - for(let i=1;i`; - return r+""; - } let makeHSliderFrames=(fr,fg,bg,w,h)=>{ let r= ` @@ -85,46 +52,6 @@ input[type=checkbox].input-switch:checked,input[type=radio].input-switch:checked } return r+""; } - let makeVSliderFrames=(fr,fg,bg,w,h)=>{ - let r= -` - -`; - for(let i=0;i`; - r+=``; - } - return r+""; - } - let initSwitches=(el)=>{ - let w,h,d,fg,bg; - if(el.inputKnobs) - return; - el.inputKnobs={}; - el.refresh=()=>{ - let src=el.getAttribute("data-src"); - d=+el.getAttribute("data-diameter"); - let st=document.defaultView.getComputedStyle(el,null); - w=parseFloat(el.getAttribute("data-width")||d||st.width); - h=parseFloat(el.getAttribute("data-height")||d||st.height); - bg=el.getAttribute("data-bgcolor")||op.bgcolor; - fg=el.getAttribute("data-fgcolor")||op.fgcolor; - el.style.width=w+"px"; - el.style.height=h+"px"; - if(src) - el.style.backgroundImage="url("+src+")"; - else { - let minwh=Math.min(w,h); - let svg= -` - - -`; - el.style.backgroundImage="url(data:image/svg+xml;base64,"+btoa(svg)+")"; - } - }; - el.refresh(); - }; let initKnobs=(el)=>{ let w,h,d,fg,bg; if(el.inputKnobs){ @@ -140,22 +67,9 @@ input[type=checkbox].input-switch:checked,input[type=radio].input-switch:checked bg=el.getAttribute("data-bgcolor")||op.bgcolor; fg=el.getAttribute("data-fgcolor")||op.fgcolor; ik.sensex=ik.sensey=200; - if(el.className.indexOf("input-knob")>=0) - ik.itype="k"; - else{ - if(w>=h){ - ik.itype="h"; - ik.sensex=w-h; - ik.sensey=Infinity; - el.style.backgroundSize="auto 100%"; - } - else{ - ik.itype="v"; - ik.sensex="Infinity"; - ik.sensey=h-w; - el.style.backgroundSize="100% auto"; - } - } + ik.sensex=w-h; + ik.sensey=Infinity; + el.style.backgroundSize="auto 100%"; el.style.width=w+"px"; el.style.height=h+"px"; ik.frameheight=h; @@ -169,18 +83,11 @@ input[type=checkbox].input-switch:checked,input[type=radio].input-switch:checked ik.sprites=0; if(ik.sprites>=1) el.style.backgroundSize=`100% ${(ik.sprites+1)*100}%`; - else if(ik.itype!="k"){ - el.style.backgroundColor=bg; - el.style.borderRadius=Math.min(w,h)*0.25+"px"; - } + el.style.backgroundColor=bg; + el.style.borderRadius=Math.min(w,h)*0.25+"px"; } else{ - let svg; - switch(ik.itype){ - case "k": svg=makeKnobFrames(101,fg,bg); break; - case "h": svg=makeHSliderFrames(101,fg,bg,w,h); break; - case "v": svg=makeVSliderFrames(101,fg,bg,w,h); break; - } + let svg=makeHSliderFrames(101,fg,bg,w,h); ik.sprites=100; el.style.backgroundImage="url(data:image/svg+xml;base64,"+btoa(svg)+")"; el.style.backgroundSize=`100% ${(ik.sprites+1)*100}%`; @@ -209,12 +116,7 @@ input[type=checkbox].input-switch:checked,input[type=radio].input-switch:checked let rc=el.getBoundingClientRect(); let cx=(rc.left+rc.right)*0.5,cy=(rc.top+rc.bottom)*0.5; let dx=ev.clientX,dy=ev.clientY; - let da=Math.atan2(ev.clientX-cx,cy-ev.clientY); - if(ik.itype=="k"&&op.knobMode=="circularabs"){ - dv=ik.valrange.min+(da/Math.PI*0.75+0.5)*(ik.valrange.max-ik.valrange.min); - el.setValue(dv); - } - if(ik.itype!="k"&&op.sliderMode=="abs"){ + if(op.sliderMode=="abs"){ dv=(ik.valrange.min+ik.valrange.max)*0.5+((dx-cx)/ik.sensex-(dy-cy)/ik.sensey)*(ik.valrange.max-ik.valrange.min); el.setValue(dv); } @@ -235,40 +137,10 @@ input[type=checkbox].input-switch:checked,input[type=radio].input-switch:checked if(ev.touches) ev = ev.touches[0]; let dx=ev.clientX-ik.dragfrom.x,dy=ev.clientY-ik.dragfrom.y; - let da=Math.atan2(ev.clientX-cx,cy-ev.clientY); - switch(ik.itype){ - case "k": - switch(op.knobMode){ - case "linear": - dv=(dx/ik.sensex-dy/ik.sensey)*(ik.valrange.max-ik.valrange.min); - if(ev.shiftKey) - dv*=0.2; - el.setValue(ik.dragfrom.v+dv); - break; - case "circularabs": - if(!ev.shiftKey){ - dv=ik.valrange.min+(da/Math.PI*0.75+0.5)*(ik.valrange.max-ik.valrange.min); - el.setValue(dv); - break; - } - case "circularrel": - if(da>ik.dragfrom.a+Math.PI) da-=Math.PI*2; - if(da{ document.removeEventListener("mousemove",ik.pointermove); @@ -300,19 +172,8 @@ input[type=checkbox].input-switch:checked,input[type=radio].input-switch:checked let v=(el.value-ik.valrange.min)/(ik.valrange.max-ik.valrange.min); if(ik.sprites>=1) el.style.backgroundPosition="0px "+(-((v*ik.sprites)|0)*ik.frameheight)+"px"; - else{ - switch(ik.itype){ - case "k": - el.style.transform="rotate("+(270*v-135)+"deg)"; - break; - case "h": - el.style.backgroundPosition=((w-h)*v)+"px 0px"; - break; - case "v": - el.style.backgroundPosition="0px "+(h-w)*(1-v)+"px"; - break; - } - } + else + el.style.backgroundPosition=((w-h)*v)+"px 0px"; ik.valueold=el.value; } }; @@ -325,13 +186,9 @@ input[type=checkbox].input-switch:checked,input[type=radio].input-switch:checked el.addEventListener("click",function (event){ event.stopPropagation(); }); } let refreshque=()=>{ - let elem=document.querySelectorAll("input.input-knob,input.input-slider"); + let elem=document.querySelectorAll("input.input-slider"); for(let i=0;i { -return /******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./src/plugin/minimap/index.js": -/*!*************************************!*\ - !*** ./src/plugin/minimap/index.js ***! - \*************************************/ -/***/ ((module, exports) => { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); } -function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } -/*eslint no-console: ["error", { allow: ["warn"] }] */ -/** - * @typedef {Object} MinimapPluginParams - * @desc Extends the `WavesurferParams` wavesurfer was initialised with - * @property {?string|HTMLElement} container CSS selector or HTML element where - * the map should be rendered. By default it is simply appended - * after the waveform. - * @property {?boolean} deferInit Set to true to manually call - * `initPlugin('minimap')` - */ -/** - * Renders a smaller version waveform as a minimap of the main waveform. - * - * @implements {PluginClass} - * @extends {Observer} - * @example - * // es6 - * import MinimapPlugin from 'wavesurfer.minimap.js'; - * - * // commonjs - * var MinimapPlugin = require('wavesurfer.minimap.js'); - * - * // if you are using