comparison annotator_files/lib/widget.js @ 4:6979313586cf

new version of annotator.
author casties
date Mon, 27 Aug 2012 19:05:38 +0200
parents 6356e78ccf5c
children
comparison
equal deleted inserted replaced
3:6356e78ccf5c 4:6979313586cf
1 var __hasProp = Object.prototype.hasOwnProperty, 1 // Generated by CoffeeScript 1.3.3
2 __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; 2 var __hasProp = {}.hasOwnProperty,
3 __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
3 4
4 Annotator.Widget = (function(_super) { 5 Annotator.Widget = (function(_super) {
5 6
6 __extends(Widget, _super); 7 __extends(Widget, _super);
7 8
30 }; 31 };
31 current = { 32 current = {
32 top: offset.top, 33 top: offset.top,
33 right: offset.left + widget.width() 34 right: offset.left + widget.width()
34 }; 35 };
35 if ((current.top - viewport.top) < 0) this.invertY(); 36 if ((current.top - viewport.top) < 0) {
36 if ((current.right - viewport.right) > 0) this.invertX(); 37 this.invertY();
38 }
39 if ((current.right - viewport.right) > 0) {
40 this.invertX();
41 }
37 return this; 42 return this;
38 }; 43 };
39 44
40 Widget.prototype.resetOrientation = function() { 45 Widget.prototype.resetOrientation = function() {
41 this.element.removeClass(this.classes.invert.x).removeClass(this.classes.invert.y); 46 this.element.removeClass(this.classes.invert.x).removeClass(this.classes.invert.y);