ImageTweak 0.19 will come, sooner or later

I’ve been working (right now I’m busy with my university exams!) on ImageTweak (IT) 0.19, and that’s coming along quite nicely.

What reamins to be done is to fix the zoom-on-pointer behaviour that broke with the moving viewport merge, to clean up quite a lot of code, localize everything and then test it. If you’re willing to try it out, this is the link to to the latest trunk debug build.

Now, if only I could find out what’s wrong with the zoom-on-pointer code…

ImageTweak.Document.prototype.PerformZoom = function PerformZoom(delta, px, py) {
/**/	ImageTweak.Helper.log(">");
/**/	ImageTweak.Helper.log("delta " + delta + " px " + px + " py " + py);
	this.ConvertToFree();
	var imgZoomFactor = ImageTweak.GetPref("ZoomFactor");
	var imgZoomNew = Math.pow( imgZoomFactor, Math.round( delta + Math.log(this.Zoom) / Math.log(imgZoomFactor) ) );
	if ( imgZoomNew <= this.ZoomMax ) {
		var imgZoomRatio = imgZoomNew / this.Zoom;
		var imgZoomDirRatio = imgZoomRatio * ( delta < 0 ? -1 : 1 );
		if ( typeof(px) != "undefined" && ImageTweak.GetPref("ZoomOnPointer") /* && imgZoomNew >= this.FitZoom() */ ) {
			//this.FreeLeft += ( imgZoomRatio - 1 ) * ( px - this.Helper.Clip( Coordinates.imgLeft, -this.ImageMax, 0 ) );
			//this.FreeTop += ( imgZoomRatio - 1 ) * ( py - this.Helper.Clip( Coordinates.imgTop, -this.ImageMax, 0 ) );
			px -= this.Window.innerWidth / 2;
			py -= this.Window.innerHeight / 2;
		} else {
			px = 0;
			py = 0;
		}
		this.FreeLeft = px * ( imgZoomRatio - 1 ) + this.Window.scrollX;
		this.FreeTop = py * ( imgZoomRatio - 1 ) + this.Window.scrollY;
		this.Zoom = imgZoomNew;
/**/		ImageTweak.Helper.log( "Zoom " + this.Zoom + " FreeLeft " + this.FreeLeft + " FreeTop " + this.FreeTop );
		this.Repaint();
	}
/**/	ImageTweak.Helper.log("<");
};
Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *