@mediapipe/control_utils
Advanced tools
Comparing version 0.5.1623725837 to 0.5.1625171504
@@ -49,8 +49,8 @@ (function(){/* | ||
function Ca(a,b){a.video.onloadedmetadata=function(){return L(a,function d(){var f=this,g;return I(d,function(e){g=f;f.video.loop=!0;f.g.onFrame?e=F(e,Ea(f,{label:"file",type:"video",video:f.video,start:function(){return Ga(g)}}),0):(e.g=0,e=void 0);return e})})};a.video.srcObject=null;a.video.src=b} | ||
Y.prototype.create=function(a,b,c){var d=this,f=this.u=c.appendChild(document.createElement("div"));f.classList.add("control-panel-entry");f.classList.add("control-panel-source-picker");var g=Q("source-selection");f.append(g);Aa(this).then(function(e){d.l=e;Ha(d,g);Ia(d,g);e=g.appendChild(document.createElement("div"));e.classList.add("inputs");d.video=e.appendChild(document.createElement("video"));d.h=e.appendChild(document.createElement("img"));Ja(d,f);0<d.l.length&&(e=d.l[0],T(d.o,e.label)||U(d.o), | ||
e.start())})}; | ||
function Ja(a,b){var c=ua("pause"),d=ua("play_arrow"),f,g,e,h;b.append(e=Q("video-controls",[h=S(c),g=Q("video-track"),f=Q("video-slider-ball"),b=R("video-time")]));a.i={parent:e,K:f,track:g,time:b};b.textContent="00:00";f.style.display="inline-block";f.onmousedown=function(k){function l(){k.preventDefault();document.removeEventListener("mousemove",n);u||a.video.play();document.removeEventListener("mouseup",l)}function n(m){k.preventDefault();var q=e.getBoundingClientRect(),E=f.getBoundingClientRect(),A= | ||
g.getBoundingClientRect();m=m.clientX-q.left-E.width/2;q=A.left-q.left;m<q?m=q:m>q+A.width&&(m=q+A.width);f.style.left=m+"px";a.video.currentTime=(m-q)/A.width*a.video.duration}k.preventDefault();var u=a.video.paused;a.video.pause();document.addEventListener("mousemove",n);document.addEventListener("mouseup",l)};h.onclick=function(){a.video.paused?(a.video.play(),h.src=c):(a.video.pause(),h.src=d)};a.D=function(){a.video.paused&&(h.src=d);h.src=c}} | ||
Y.prototype.create=function(a,b,c){var d=this,f=this.u=c.appendChild(document.createElement("div"));f.classList.add("control-panel-entry");f.classList.add("control-panel-source-picker");var g=Q("source-selection");f.append(g);Aa(this).then(function(e){d.l=e;Ha(d,g);Ia(d,g);e=g.appendChild(document.createElement("div"));e.classList.add("inputs");d.video=e.appendChild(document.createElement("video"));d.video.setAttribute("crossorigin","anonymous");d.h=e.appendChild(document.createElement("img"));d.h.setAttribute("crossorigin", | ||
"anonymous");Ja(d,f);0<d.l.length&&(e=d.l[0],T(d.o,e.label)||U(d.o),e.start())})}; | ||
function Ja(a,b){var c=ua("pause"),d=ua("play_arrow"),f,g,e,h;b.append(e=Q("video-controls",[h=S(c),g=Q("video-track"),f=Q("video-slider-ball"),b=R("video-time")]));a.i={parent:e,K:f,track:g,time:b};b.textContent="00:00";f.style.display="inline-block";f.onmousedown=function(k){function l(){k.preventDefault();document.removeEventListener("mousemove",n);u||a.video.play();document.removeEventListener("mouseup",l)}function n(m){k.preventDefault();var q=e.getBoundingClientRect(),E=f.getBoundingClientRect(), | ||
A=g.getBoundingClientRect();m=m.clientX-q.left-E.width/2;q=A.left-q.left;m<q?m=q:m>q+A.width&&(m=q+A.width);f.style.left=m+"px";a.video.currentTime=(m-q)/A.width*a.video.duration}k.preventDefault();var u=a.video.paused;a.video.pause();document.addEventListener("mousemove",n);document.addEventListener("mouseup",l)};h.onclick=function(){a.video.paused?(a.video.play(),h.src=c):(a.video.pause(),h.src=d)};a.D=function(){a.video.paused&&(h.src=d);h.src=c}} | ||
function wa(a,b){var c=a.i.K,d=a.i.track.getBoundingClientRect();a=a.i.parent.getBoundingClientRect();c.style.left=d.left-a.left+d.width*b+"px"}function xa(a){var b=Math.floor(a%60).toString();b=1===b.length?"0"+b:b;a=Math.floor(a/60).toString();a=1===a.length?"0"+a:a;return a+":"+b}Y.prototype.update=function(){if(this.h&&!this.j&&this.g.onFrame)this.g.onFrame(this.h,{width:this.h.naturalWidth,height:this.h.naturalHeight})};function Ka(a){this.g=a}Ka.prototype.create=function(a,b,c){a=c.appendChild(document.createElement("div"));a.classList.add("control-panel-entry");a.classList.add("control-panel-text");a.textContent=this.g.title};Ka.prototype.update=function(){};function La(a){this.h=a}La.prototype.create=function(a,b,c){var d=this;this.i=a;this.options=b;this.g=c.appendChild(document.createElement("div"));this.g.classList.add("control-panel-entry");this.g.classList.add("control-panel-toggle");this.g.onclick=function(){d.options[d.h.field]=!d.options[d.h.field];d.i()};a=this.g.appendChild(document.createElement("span"));a.classList.add("label");this.value=this.g.appendChild(document.createElement("span"));this.value.classList.add("value");a.textContent=this.h.title}; | ||
La.prototype.update=function(){this.options[this.h.field]?(this.value.textContent="Yes",this.g.classList.add("yes"),this.g.classList.remove("no")):(this.value.textContent="No",this.g.classList.add("no"),this.g.classList.remove("yes"))};function Ma(a,b){this.parent=a;this.options=b;this.g=[];this.h=this.parent.appendChild(document.createElement("div"));this.h.classList.add("control-panel")}Ma.prototype.add=function(a){var b=this;a=v(a);for(var c=a.next();!c.done;c=a.next())c=c.value,this.g.push(c),c.create(function(){Na(b)},this.options,this.h);Na(this);return this};Ma.prototype.on=function(a){this.i=a;Na(this);return this};function Na(a){for(var b=v(a.g),c=b.next();!c.done;c=b.next())c.value.update();a.i&&a.i(a.options)} | ||
K("ControlPanel",Ma);K("Slider",X);K("StaticText",Ka);K("Toggle",La);K("SourcePicker",Y);K("FPS",W);K("DropDownControl",V);}).call(this); |
@@ -149,3 +149,3 @@ /** | ||
onSourceChanged?: () => Promise<void>| void; | ||
examples: ExampleOptions; | ||
examples?: ExampleOptions; | ||
} | ||
@@ -152,0 +152,0 @@ |
{ | ||
"name": "@mediapipe/control_utils", | ||
"version": "0.5.1623725837", | ||
"version": "0.5.1625171504", | ||
"description": "Mediapipe Simple Control Panel", | ||
@@ -5,0 +5,0 @@ "main": "control_utils.js", |
32550
302