Skip to content

Commit

Permalink
New build for release v1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tylik1 committed Mar 23, 2017
1 parent e8aa60b commit de66103
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 28 deletions.
53 changes: 42 additions & 11 deletions dist/amplience-sdk-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -5016,7 +5016,7 @@ amp.stats.event = function(dom,type,event,value){
},
load:function(){
this._setupZoomArea().then($.proxy(function(area){
this.zoomArea.allowClone = true;
this.zoomArea.allowClone = true;
area.setScale(this.options.zoom);
},this))
},
Expand All @@ -5030,7 +5030,7 @@ amp.stats.event = function(dom,type,event,value){
img.src = this.element.attr('src');
var $loading = $('<div class="amp-loading"></div>');
this.$parent.append($loading);
this.zoomArea = new zoomArea(this.element, this.$parent, size, this.options.transforms);
this.zoomArea = new zoomArea(this.element, this.$parent, size, this.options.transforms, this.options);

img.onload = function(){
$loading.remove();
Expand Down Expand Up @@ -5338,7 +5338,7 @@ amp.stats.event = function(dom,type,event,value){
var x = Math.abs(touches[0].pageX-touches[1].pageX),
y = Math.abs(touches[0].pageY-touches[1].pageY);
return Math.sqrt(
(x * x) + (y * y)
(x * x) + (y * y)
);
};

Expand Down Expand Up @@ -5423,8 +5423,11 @@ amp.stats.event = function(dom,type,event,value){
};


var zoomArea = function($source,$area,originalSize,transforms) {
var zoomArea = function($source,$area,originalSize,transforms, options) {
this.options = options;
this.animating = false;
this._allowChangeClone = true;
this.isFF = navigator.userAgent.toLowerCase().search("firefox") > -1;
this.transforms = transforms;
this.initialSrc = $source[0].src;
this.scale = 1;
Expand Down Expand Up @@ -5526,10 +5529,10 @@ amp.stats.event = function(dom,type,event,value){
cb();
}
this.animating = false;
},this),600);
},this),this.isFF ? 1000 : 600);
};

zoomArea.prototype.updateImageSrc = function(scaleIncreased){
zoomArea.prototype.updateImageSrc = function(scaleIncreased){
var self = this;
if(!scaleIncreased || !self.allowClone || !self._preloaderImgLoaded){
return false;
Expand Down Expand Up @@ -5577,7 +5580,7 @@ amp.stats.event = function(dom,type,event,value){
});
} else {
this.animate(this.newSize, this.getPixPos(), function(){
self.updateImageSrc(scaleIncreased);
self.updateImageSrc(scaleIncreased);
});
}
this.scale = scale;
Expand Down Expand Up @@ -5609,14 +5612,42 @@ amp.stats.event = function(dom,type,event,value){
if(size.x == 0 || size.y ==0) {
src='';
}
self.$preloader = new Image();
self._preloaderImgLoaded = true;
self.$preloader.setAttribute('src', src);

};
zoomArea.prototype.setImage = function() {
var self = this;
var previousSrc = self.$zoomed[0].src;
self.$zoomed.attr('src', self.$preloader.src);
self.$zoomedClone.attr('src', previousSrc);
var loaded;
var previousSrc = self.$zoomed.attr('src');

if(self._allowChangeClone){
self.$zoomedClone.attr('src', previousSrc);
}

if(self.$preloader.complete && self.$preloader.naturalWidth && self.$preloader.naturalWidth > 0){
if(loaded){
return;
}

setTimeout(function(){
self.$zoomed.attr('src', self.$preloader.src);
}, self.isFF ? 1000 : 10);
loaded = true;
}

else{
self.$preloader.onload = function(){
if(loaded){
return;
}
self.$zoomed.attr('src', self.$preloader.src);
loaded = true;
};
}

self._allowChangeClone = false;
};


Expand Down Expand Up @@ -6288,8 +6319,8 @@ amp.stats.event = function(dom,type,event,value){
this._moveSpin(this.options.orientation == 'horz' ? dx : dy,e,sindex);

if(this.options.orientation == this.moveDir){
return false;
e.preventDefault();
return false;
}
},

Expand Down
Loading

0 comments on commit de66103

Please sign in to comment.