// Generated by CoffeeScript 1.10.0 var bgViewer; bgViewer = (function() { var dn, move, up; dn = function(e) { this.isStop = false; this.sx = this.lx = e.pageX || (e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0] && e.originalEvent.touches[0].pageX) || 0; this.sy = this.ly = e.pageY || (e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0] && e.originalEvent.touches[0].pageY) || 0; setTimeout(function(){ $("#pan").removeClass("noclick"); }, 30); return false; }; up = function(e) { var open = $("#overlay_viewer #pan").length; if ( open ) { window.pgLoad.closePan(); // set timeout function prevents close aobe in dn function }else{ //document.openPan(); } this.isStop = true; return false; }; move = function(e) { var dx, dy, x, y; if (this.isStop) { return; } x = e.pageX || (e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0] && e.originalEvent.touches[0].pageX) || 0; y = e.pageY || (e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0] && e.originalEvent.touches[0].pageY) || 0; dx = x - this.lx; dy = y - this.ly; if (Math.abs(x - this.sx) < this.filter && Math.abs(y - this.sy) < this.filter) { return; } this.lx = x; this.ly = y; this.x = (this.x + dx) % this.w; this.y = (this.y + dy) % this.h; this.cnt.css({ 'background-position': this.x + 'px ' + this.y + 'px' }); $("#pan").addClass("noclick"); return false; }; bgViewer.prototype.free = function() { this.cnt.off('mousedown touchstart', this.dnxt).off('mouseup touchend', this.upxt).off('mousemove touchmove', this.movext); return this; }; bgViewer.prototype.url = function(src) { this.src = src; this.img = new Image; this.img.src = src; $(this.img).on('load', (function(_this) { return function(e) { _this.w = _this.img.width; return _this.h = _this.img.height; }; })(this)); this.cnt.css({ 'background-image': 'url(' + src + ')', 'background-position': '0px 0px' }); this.x = 0; this.y = 0; this.lx = 0; this.ly = 0; this.sx = 0; this.sx = 0; return this; }; function bgViewer(cnt, src1, filter) { var t; this.cnt = cnt; this.src = src1 != null ? src1 : ''; this.filter = filter != null ? filter : 5; this.cnt.css({ 'overflow': 'hidden', 'background-repeat': 'repeat', 'background-position': '0px 0px', 'cursor': 'move' }); this.x = 0; this.y = 0; this.lx = 0; this.ly = 0; this.sx = 0; this.sx = 0; this.isStop = true; t = this; this.dnxt = function(e) { return dn.call(t, e); }; this.upxt = function(e) { return up.call(t, e); }; this.movext = function(e) { return move.call(t, e); }; this.cnt.on('mousedown touchstart', this.dnxt).on('mousemove touchmove', this.movext).on('mouseup touchend', this.upxt); this.cnt[0].bgviewer = this; this.url(this.src); } return bgViewer; })(); //# sourceMappingURL=bgviewer.js.map