Commit bf45449b authored by Julia Radzhabova's avatar Julia Radzhabova

Refactoring window component.

parent ab125faf
...@@ -247,8 +247,8 @@ define([ ...@@ -247,8 +247,8 @@ define([
Common.UI.Menu.Manager.hideAll(); Common.UI.Menu.Manager.hideAll();
var zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1; var zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1;
this.dragging.enabled = true; this.dragging.enabled = true;
this.dragging.initx = event.pageX*zoom - parseInt(this.$window.css('left')); this.dragging.initx = event.pageX*zoom - this.getLeft();
this.dragging.inity = event.pageY*zoom - parseInt(this.$window.css('top')); this.dragging.inity = event.pageY*zoom - this.getTop();
if (window.innerHeight == undefined) { if (window.innerHeight == undefined) {
var main_width = document.documentElement.offsetWidth; var main_width = document.documentElement.offsetWidth;
...@@ -258,8 +258,8 @@ define([ ...@@ -258,8 +258,8 @@ define([
main_height = Common.Utils.innerHeight(); main_height = Common.Utils.innerHeight();
} }
this.dragging.maxx = main_width - parseInt(this.$window.css("width")); this.dragging.maxx = main_width - this.getWidth();
this.dragging.maxy = main_height - parseInt(this.$window.css("height")); this.dragging.maxy = main_height - this.getHeight();
$(document).on('mousemove', this.binding.drag); $(document).on('mousemove', this.binding.drag);
$(document).on('mouseup', this.binding.dragStop); $(document).on('mouseup', this.binding.dragStop);
...@@ -297,16 +297,16 @@ define([ ...@@ -297,16 +297,16 @@ define([
function _resizestart(event) { function _resizestart(event) {
Common.UI.Menu.Manager.hideAll(); Common.UI.Menu.Manager.hideAll();
var el = $(event.target), var el = $(event.target),
left = parseInt(this.$window.css('left')), left = this.getLeft(),
top = parseInt(this.$window.css('top')); top = this.getTop();
this.resizing.enabled = true; this.resizing.enabled = true;
this.resizing.initpage_x = event.pageX*Common.Utils.zoom(); this.resizing.initpage_x = event.pageX*Common.Utils.zoom();
this.resizing.initpage_y = event.pageY*Common.Utils.zoom(); this.resizing.initpage_y = event.pageY*Common.Utils.zoom();
this.resizing.initx = this.resizing.initpage_x - left; this.resizing.initx = this.resizing.initpage_x - left;
this.resizing.inity = this.resizing.initpage_y - top; this.resizing.inity = this.resizing.initpage_y - top;
this.resizing.initw = parseInt(this.$window.css("width")); this.resizing.initw = this.getWidth();
this.resizing.inith = parseInt(this.$window.css("height")); this.resizing.inith = this.getHeight();
this.resizing.type = [el.hasClass('left') ? -1 : (el.hasClass('right') ? 1 : 0), el.hasClass('top') ? -1 : (el.hasClass('bottom') ? 1 : 0)]; this.resizing.type = [el.hasClass('left') ? -1 : (el.hasClass('right') ? 1 : 0), el.hasClass('top') ? -1 : (el.hasClass('bottom') ? 1 : 0)];
var main_width = (window.innerHeight == undefined) ? document.documentElement.offsetWidth : Common.Utils.innerWidth(), var main_width = (window.innerHeight == undefined) ? document.documentElement.offsetWidth : Common.Utils.innerWidth(),
...@@ -826,6 +826,14 @@ define([ ...@@ -826,6 +826,14 @@ define([
return this.$window.find('> .header > .title').text(); return this.$window.find('> .header > .title').text();
}, },
getLeft: function() {
return parseInt(this.$window.css('left'));
},
getTop: function() {
return parseInt(this.$window.css('top'));
},
isVisible: function() { isVisible: function() {
return this.$window && this.$window.is(':visible'); return this.$window && this.$window.is(':visible');
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment