This commit is contained in:
xdrm-brackets 2016-10-05 15:05:45 +02:00
parent 1bbb537bf0
commit 90d76fb185
2 changed files with 2 additions and 1 deletions

View File

@ -59,6 +59,7 @@ var pixelRatio = {
this.__defineSetter__('height', function(v){ this._h = v; process.bind(iL._wrapper)(); });
Controller.addFolder('Image Ratio');
Controller.add(this, 'width', 0, 2).listen();
Controller.add(this, 'height', 0, 2).listen();
}

View File

@ -1,4 +1,4 @@
var DOM={body:$("body"),canvas:$("canvas"),imageLoader:$("#image-loader")},Controller=new dat.GUI,_CAN=DOM.canvas;_CAN.width=_CAN.height=1E3;
var _CON=_CAN.getContext("2d"),iL,process,init=function(){this.src="front:male:1.jpg";Controller.addFolder("image source");Controller.add(this,"src",this._images).listen()},pixelRatio={initialized:!1,init:function(){this.initialized||(this.initialized=!0,this._w=this._h=.9,this.width=this.height=null,this.__defineGetter__("width",function(){return this._w}),this.__defineGetter__("height",function(){return this._h}),this.__defineSetter__("width",function(a){this._w=a;process.bind(iL._wrapper)()}),
this.__defineSetter__("height",function(a){this._h=a;process.bind(iL._wrapper)()}),Controller.add(this,"width",0,2).listen(),Controller.add(this,"height",0,2).listen())}},count=0;
this.__defineSetter__("height",function(a){this._h=a;process.bind(iL._wrapper)()}),Controller.addFolder("Image Ratio"),Controller.add(this,"width",0,2).listen(),Controller.add(this,"height",0,2).listen())}},count=0;
process=function(){console.warn("PROCESS");count||(this.defaultWidth=this.width,this.defaultHeight=this.height,log("Image copied","[Canvas]"));count++;_CON.clearRect(0,0,_CAN.width,_CAN.height);pixelRatio.init();this.width=pixelRatio.width*_CAN.width/this.defaultWidth*this.defaultWidth;this.height=pixelRatio.height*_CAN.height/this.defaultHeight*this.defaultHeight;_CON.drawImage(this,0,0,this.width,this.height)};iL=new ImageLoader(DOM.imageLoader,init,process);