X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/78644811ca0c6042212788dc67add42bc41fb74c..7c8d3ac9807cf36af4c16aa26841104914c2033e:/platforma/static/js/views/view.js diff --git a/platforma/static/js/views/view.js b/platforma/static/js/views/view.js index e9ff938e..d0c6d170 100644 --- a/platforma/static/js/views/view.js +++ b/platforma/static/js/views/view.js @@ -34,28 +34,22 @@ var View = Editor.Object.extend({ if (this.frozen()) { this.unfreeze(); } - this.overlay = this.overlay - || $('
' + message + '
') - .addClass(this.overlayClass) + this.overlay = this.overlay || $('
' + message + '
'); + + this.overlay.addClass(this.overlayClass) .css({ - position: 'absolute', - width: this.element.width(), - height: this.element.height(), - top: this.element.position().top, - left: this.element.position().left, - 'user-select': 'none', - '-webkit-user-select': 'none', - '-khtml-user-select': 'none', - '-moz-user-select': 'none', - overflow: 'hidden' - }) - .attr('unselectable', 'on') - .appendTo(this.element.parent()); + }).attr('unselectable', 'on') + + this.overlay.appendTo(this.element); + + var ovc = this.overlay.children('div'); + var padV = (this.overlay.height() - ovc.outerHeight())/2; + var padH = (this.overlay.width() - ovc.outerWidth())/2; + this.overlay.children('div').css({ - position: 'relative', - top: this.overlay.height() / 2 - 20 - }); + top: padV, left: padH + }); }, unfreeze: function() { @@ -66,16 +60,14 @@ var View = Editor.Object.extend({ }, resized: function(event) { - if (this.frozen()) { - this.overlay.css({ - position: 'absolute', - width: this.element.width(), - height: this.element.height(), - top: this.element.position().top, - left: this.element.position().left - }).children('div').css({ - position: 'relative', - top: this.overlay.height() / 2 - 20 + if(this.overlay) { + var ovc = this.overlay.children('div'); + var padV = (this.overlay.height() - ovc.outerHeight())/2; + var padH = (this.overlay.width() - ovc.outerWidth())/2; + + this.overlay.children('div').css({ + top: padV, + left: padH }); } }, @@ -87,4 +79,4 @@ var View = Editor.Object.extend({ this.unfreeze(); this.element.html(''); } -}); +}); \ No newline at end of file