Mercurial > hg > OKFNAnnotator
comparison annotator_files/lib/editor.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 // Generated by CoffeeScript 1.3.3 | |
1 var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | 2 var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, |
2 __hasProp = Object.prototype.hasOwnProperty, | 3 __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; }; | 4 __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; }; |
4 | 5 |
5 Annotator.Editor = (function(_super) { | 6 Annotator.Editor = (function(_super) { |
6 | 7 |
7 __extends(Editor, _super); | 8 __extends(Editor, _super); |
8 | 9 |
23 | 24 |
24 Editor.prototype.options = {}; | 25 Editor.prototype.options = {}; |
25 | 26 |
26 function Editor(options) { | 27 function Editor(options) { |
27 this.onCancelButtonMouseover = __bind(this.onCancelButtonMouseover, this); | 28 this.onCancelButtonMouseover = __bind(this.onCancelButtonMouseover, this); |
29 | |
28 this.processKeypress = __bind(this.processKeypress, this); | 30 this.processKeypress = __bind(this.processKeypress, this); |
31 | |
29 this.submit = __bind(this.submit, this); | 32 this.submit = __bind(this.submit, this); |
33 | |
30 this.load = __bind(this.load, this); | 34 this.load = __bind(this.load, this); |
35 | |
31 this.hide = __bind(this.hide, this); | 36 this.hide = __bind(this.hide, this); |
32 this.show = __bind(this.show, this); Editor.__super__.constructor.call(this, $(this.html)[0], options); | 37 |
38 this.show = __bind(this.show, this); | |
39 Editor.__super__.constructor.call(this, $(this.html)[0], options); | |
33 this.fields = []; | 40 this.fields = []; |
34 this.annotation = {}; | 41 this.annotation = {}; |
35 } | 42 } |
36 | 43 |
37 Editor.prototype.show = function(event) { | 44 Editor.prototype.show = function(event) { |
187 width = textarea.outerWidth(); | 194 width = textarea.outerWidth(); |
188 directionX = editor.hasClass(classes.invert.x) ? -1 : 1; | 195 directionX = editor.hasClass(classes.invert.x) ? -1 : 1; |
189 directionY = editor.hasClass(classes.invert.y) ? 1 : -1; | 196 directionY = editor.hasClass(classes.invert.y) ? 1 : -1; |
190 textarea.height(height + (diff.top * directionY)); | 197 textarea.height(height + (diff.top * directionY)); |
191 textarea.width(width + (diff.left * directionX)); | 198 textarea.width(width + (diff.left * directionX)); |
192 if (textarea.outerHeight() !== height) mousedown.top = event.pageY; | 199 if (textarea.outerHeight() !== height) { |
193 if (textarea.outerWidth() !== width) mousedown.left = event.pageX; | 200 mousedown.top = event.pageY; |
201 } | |
202 if (textarea.outerWidth() !== width) { | |
203 mousedown.left = event.pageX; | |
204 } | |
194 } else if (mousedown.element === controls[0]) { | 205 } else if (mousedown.element === controls[0]) { |
195 editor.css({ | 206 editor.css({ |
196 top: parseInt(editor.css('top'), 10) + diff.top, | 207 top: parseInt(editor.css('top'), 10) + diff.top, |
197 left: parseInt(editor.css('left'), 10) + diff.left | 208 left: parseInt(editor.css('left'), 10) + diff.left |
198 }); | 209 }); |