diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 5d1f5824e..b9e68a11f 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -536,7 +536,7 @@ define([ var innerEl = $(this.el).find('.inner'), inner_top = innerEl.offset().top, idx = _.indexOf(this.store.models, record), - div = (idx>=0 && this.dataViewItems.length>0) ? $(this.dataViewItems[idx].el) : innerEl.find('#' + record.get('id')); + div = (idx>=0 && this.dataViewItems.length>idx) ? $(this.dataViewItems[idx].el) : innerEl.find('#' + record.get('id')); if (div.length<=0) return; var div_top = div.offset().top; @@ -676,7 +676,7 @@ define([ ? this.parentMenu.cmpEl : this.parentMenu.cmpEl.find('[role=menu]'), innerEl = $(this.el).find('.inner').andSelf().filter('.inner'), - docH = $(document).height(), + docH = Common.Utils.innerHeight(), menuH = menuRoot.outerHeight(), top = parseInt(menuRoot.css('top')); diff --git a/apps/common/main/lib/component/DimensionPicker.js b/apps/common/main/lib/component/DimensionPicker.js index 7e5a475b5..22fb1bd98 100644 --- a/apps/common/main/lib/component/DimensionPicker.js +++ b/apps/common/main/lib/component/DimensionPicker.js @@ -58,8 +58,8 @@ define([ var onMouseMove = function(event){ me.setTableSize( - Math.ceil((event.offsetX === undefined ? event.originalEvent.layerX : event.offsetX) / me.itemSize), - Math.ceil((event.offsetY === undefined ? event.originalEvent.layerY : event.offsetY) / me.itemSize), + Math.ceil((event.offsetX === undefined ? event.originalEvent.layerX : event.offsetX*Common.Utils.zoom()) / me.itemSize), + Math.ceil((event.offsetY === undefined ? event.originalEvent.layerY : event.offsetY*Common.Utils.zoom()) / me.itemSize), event ); }; diff --git a/apps/common/main/lib/component/HSBColorPicker.js b/apps/common/main/lib/component/HSBColorPicker.js index e943b62f2..d704f0a2b 100644 --- a/apps/common/main/lib/component/HSBColorPicker.js +++ b/apps/common/main/lib/component/HSBColorPicker.js @@ -134,8 +134,8 @@ define([ var onSBAreaMouseMove = function(event, element, eOpts){ if (arrowSatBrightness.length>0 && areaSatBrightness.length>0) { var pos = [ - Math.max(0, Math.min(100, (parseInt((event.pageX - areaSatBrightness.offset().left) / areaSatBrightness.width() * 100)))), - Math.max(0, Math.min(100, (parseInt((event.pageY - areaSatBrightness.offset().top) / areaSatBrightness.height() * 100)))) + Math.max(0, Math.min(100, (parseInt((event.pageX*Common.Utils.zoom() - areaSatBrightness.offset().left) / areaSatBrightness.width() * 100)))), + Math.max(0, Math.min(100, (parseInt((event.pageY*Common.Utils.zoom() - areaSatBrightness.offset().top) / areaSatBrightness.height() * 100)))) ]; arrowSatBrightness.css('left', pos[0] + '%'); @@ -154,7 +154,7 @@ define([ var onHueAreaMouseMove = function(event, element, eOpts){ if (arrowHue&& areaHue) { - var pos = Math.max(0, Math.min(100, (parseInt((event.pageY - areaHue.offset().top) / areaHue.height() * 100)))); + var pos = Math.max(0, Math.min(100, (parseInt((event.pageY*Common.Utils.zoom() - areaHue.offset().top) / areaHue.height() * 100)))); arrowHue.css('top', pos + '%'); hueVal = parseInt(360 * pos / 100.0); diff --git a/apps/common/main/lib/component/Layout.js b/apps/common/main/lib/component/Layout.js index 3c874347b..1243aed97 100644 --- a/apps/common/main/lib/component/Layout.js +++ b/apps/common/main/lib/component/Layout.js @@ -249,24 +249,25 @@ define([ if (e.data.type == 'vertical') { this.resize.height = parseInt(this.resize.$el.css('height')); this.resize.max = (panel.maxpos > 0 ? panel.maxpos : this.resize.$el.parent().height() + panel.maxpos) - this.resize.height; - this.resize.inity = e.pageY - parseInt(e.currentTarget.style.top); + this.resize.inity = e.pageY*Common.Utils.zoom() - parseInt(e.currentTarget.style.top); } else if (e.data.type == 'horizontal') { this.resize.width = parseInt(this.resize.$el.css('width')); this.resize.max = (panel.maxpos > 0 ? panel.maxpos : this.resize.$el.parent().height() + panel.maxpos) - this.resize.width; - this.resize.initx = e.pageX - parseInt(e.currentTarget.style.left); + this.resize.initx = e.pageX*Common.Utils.zoom() - parseInt(e.currentTarget.style.left); } Common.NotificationCenter.trigger('layout:resizestart'); }, resizeMove: function(e) { + var zoom = (e instanceof jQuery.Event) ? Common.Utils.zoom() : 1; if (this.resize.type == 'vertical') { var prop = 'top', - value = e.pageY - this.resize.inity; + value = e.pageY*zoom - this.resize.inity; } else if (this.resize.type == 'horizontal') { prop = 'left'; - value = e.pageX - this.resize.initx; + value = e.pageX*zoom - this.resize.initx; } if (this.resize.fmin && this.resize.fmax) { @@ -296,13 +297,14 @@ define([ if (!this.resize.$el) return; + var zoom = (e instanceof jQuery.Event) ? Common.Utils.zoom() : 1; if (this.resize.type == 'vertical') { var prop = 'height'; - var value = e.pageY - this.resize.inity; + var value = e.pageY*zoom - this.resize.inity; } else if (this.resize.type == 'horizontal') { prop = 'width'; - value = e.pageX - this.resize.initx; + value = e.pageX*zoom - this.resize.initx; } if (this.resize.fmin && this.resize.fmax) { diff --git a/apps/common/main/lib/component/Menu.js b/apps/common/main/lib/component/Menu.js index e84794244..61bd4b5a4 100644 --- a/apps/common/main/lib/component/Menu.js +++ b/apps/common/main/lib/component/Menu.js @@ -531,8 +531,8 @@ define([ menuParent = this.menuAlignEl || menuRoot.parent(), m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/), offset = menuParent.offset(), - docW = Math.min($(document).width(), $('body').width()), - docH = $(document).height() - 10, // Yep, it's magic number + docW = Common.Utils.innerWidth(), + docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number menuW = menuRoot.outerWidth(), menuH = menuRoot.outerHeight(), parentW = menuParent.outerWidth(), diff --git a/apps/common/main/lib/component/Slider.js b/apps/common/main/lib/component/Slider.js index 3279c75cb..0dd1faeb5 100644 --- a/apps/common/main/lib/component/Slider.js +++ b/apps/common/main/lib/component/Slider.js @@ -146,7 +146,7 @@ define([ e.preventDefault(); e.stopPropagation(); - var pos = Math.max(0, Math.min(100, (Math.round((e.pageX - me.cmpEl.offset().left - me._dragstart) / me.width * 100)))); + var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left - me._dragstart) / me.width * 100)))); me.setThumbPosition(pos); me.lastValue = me.value; @@ -167,7 +167,7 @@ define([ e.preventDefault(); e.stopPropagation(); - var pos = Math.max(0, Math.min(100, (Math.round((e.pageX - me.cmpEl.offset().left - me._dragstart) / me.width * 100)))); + var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left - me._dragstart) / me.width * 100)))); me.setThumbPosition(pos); me.lastValue = me.value; @@ -179,7 +179,7 @@ define([ var onMouseDown = function (e) { if ( me.disabled ) return; - me._dragstart = e.pageX - me.thumb.offset().left - 7; + me._dragstart = e.pageX*Common.Utils.zoom() - me.thumb.offset().left - 7; me.thumb.addClass('active'); $(document).on('mouseup', onMouseUp); @@ -192,7 +192,7 @@ define([ var onTrackMouseDown = function (e) { if ( me.disabled ) return; - var pos = Math.max(0, Math.min(100, (Math.round((e.pageX - me.cmpEl.offset().left) / me.width * 100)))); + var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))); me.setThumbPosition(pos); me.lastValue = me.value; @@ -342,7 +342,7 @@ define([ lastValue = me.thumbs[index].value, minValue = (index-1<0) ? 0 : me.thumbs[index-1].position, maxValue = (index+1 -me.delta) : (pos > me.delta); me.cmpEl.toggleClass('on', me.value); me.thumb.css({left: '', right: ''}); @@ -127,7 +127,7 @@ define([ e.preventDefault(); e.stopPropagation(); - var pos = Math.round((e.pageX - me._dragstart)); + var pos = Math.round((e.pageX*Common.Utils.zoom() - me._dragstart)); if (me.value) { me.thumb.css({right: (pos<1) ? Math.min(me.width-me.thumbWidth - 2, -pos) : 0, left: 'auto'}); } else { @@ -138,7 +138,7 @@ define([ var onMouseDown = function (e) { if ( me.disabled ) return; - me._dragstart = e.pageX; + me._dragstart = e.pageX*Common.Utils.zoom(); me._isMouseMove = false; $(document).on('mouseup.switcher', onMouseUp); diff --git a/apps/common/main/lib/component/SynchronizeTip.js b/apps/common/main/lib/component/SynchronizeTip.js index 4c20654a4..756196099 100644 --- a/apps/common/main/lib/component/SynchronizeTip.js +++ b/apps/common/main/lib/component/SynchronizeTip.js @@ -95,7 +95,7 @@ define([ applyPlacement: function () { var showxy = this.target.offset(); - (this.placement == 'top') ? tipEl.css({bottom : $(document).height() - showxy.top + 'px', right: $(document).width() - showxy.left - this.target.width()/2 + 'px'}) + (this.placement == 'top') ? tipEl.css({bottom : Common.Utils.innerHeight() - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'}) : tipEl.css({top : showxy.top + this.target.height()/2 + 'px', left: showxy.left + this.target.width() + 'px'}); }, diff --git a/apps/common/main/lib/component/TabBar.js b/apps/common/main/lib/component/TabBar.js index 5487891c0..5ef92ba98 100644 --- a/apps/common/main/lib/component/TabBar.js +++ b/apps/common/main/lib/component/TabBar.js @@ -234,8 +234,8 @@ define([ function dragMove (e) { if (!_.isUndefined(me.drag)) { - me.drag.moveX = e.clientX; - var leftPos = Math.max(e.clientX - me.drag.anchorX - me.tabBarLeft - me.scrollLeft, 0); + me.drag.moveX = e.clientX*Common.Utils.zoom(); + var leftPos = Math.max(me.drag.moveX - me.drag.anchorX - me.tabBarLeft - me.scrollLeft, 0); leftPos = Math.min(leftPos, me.tabBarRight - me.tabBarLeft - me.drag.tabWidth - me.scrollLeft); me.drag.tab.$el.css('left', leftPos + 'px'); @@ -250,16 +250,17 @@ define([ } if (!_.isUndefined(bar) && !_.isUndefined(tab) && bar.tabs.length > 1) { - var index = bar.tabs.indexOf(tab); + var index = bar.tabs.indexOf(tab), + _clientX = e.clientX*Common.Utils.zoom(); me.bar = bar; me.drag = {tab: tab, index: index}; this.calculateBounds(); this.setAbsTabs(); - me.drag.moveX = e.clientX; - me.drag.mouseX = e.clientX; - me.drag.anchorX = e.clientX - this.bounds[index].left; + me.drag.moveX = _clientX; + me.drag.mouseX = _clientX; + me.drag.anchorX = _clientX - this.bounds[index].left; me.drag.tabWidth = this.bounds[index].width; document.addEventListener('dragstart',dragDropText); diff --git a/apps/common/main/lib/component/TableStyler.js b/apps/common/main/lib/component/TableStyler.js index 4736d4e1e..0541e169a 100644 --- a/apps/common/main/lib/component/TableStyler.js +++ b/apps/common/main/lib/component/TableStyler.js @@ -144,8 +144,8 @@ define([ this.cmpEl.on('click', function(event){ var pos = { - x: event.pageX - me.cmpEl.offset().left, - y: event.pageY - me.cmpEl.offset().top + x: event.pageX*Common.Utils.zoom() - me.cmpEl.offset().left, + y: event.pageY*Common.Utils.zoom() - me.cmpEl.offset().top }; var ptInPoly = function(npol, xp, yp, x, y) { diff --git a/apps/common/main/lib/component/ThemeColorPalette.js b/apps/common/main/lib/component/ThemeColorPalette.js index 7a6361078..cedc96e69 100644 --- a/apps/common/main/lib/component/ThemeColorPalette.js +++ b/apps/common/main/lib/component/ThemeColorPalette.js @@ -365,6 +365,12 @@ define([ aEffectIdx++; } } + + var selected = $(this.el).find('a.' + this.selectedCls); + if (selected.length && selected.hasClass('palette-color-effect')) { + this.value = selected[0].className.match(this.colorRe)[1].toUpperCase(); + } + this.options.updateColorsArr = undefined; }, diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index 68c6cf7a4..4459ec1bd 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -211,8 +211,8 @@ define([ var main_width = document.documentElement.offsetWidth; var main_height = document.documentElement.offsetHeight; } else { - main_width = window.innerWidth; - main_height = window.innerHeight; + main_width = Common.Utils.innerWidth(); + main_height = Common.Utils.innerHeight(); } if (this.initConfig.height == 'auto') { @@ -244,16 +244,17 @@ define([ function _dragstart(event) { if ( $(event.target).hasClass('close') ) return; Common.UI.Menu.Manager.hideAll(); + var zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1; this.dragging.enabled = true; - this.dragging.initx = event.pageX - parseInt(this.$window.css('left')); - this.dragging.inity = event.pageY - parseInt(this.$window.css('top')); + this.dragging.initx = event.pageX*zoom - parseInt(this.$window.css('left')); + this.dragging.inity = event.pageY*zoom - parseInt(this.$window.css('top')); if (window.innerHeight == undefined) { var main_width = document.documentElement.offsetWidth; var main_height = document.documentElement.offsetHeight; } else { - main_width = window.innerWidth; - main_height = window.innerHeight; + main_width = Common.Utils.innerWidth(); + main_height = Common.Utils.innerHeight(); } this.dragging.maxx = main_width - parseInt(this.$window.css("width")); @@ -280,8 +281,9 @@ define([ function _mousemove(event) { if (this.dragging.enabled) { - var left = event.pageX - this.dragging.initx, - top = event.pageY - this.dragging.inity; + var zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1, + left = event.pageX*zoom - this.dragging.initx, + top = event.pageY*zoom - this.dragging.inity; left < 0 ? (left = 0) : left > this.dragging.maxx && (left = this.dragging.maxx); top < 0 ? (top = 0) : top > this.dragging.maxy && (top = this.dragging.maxy); @@ -298,16 +300,16 @@ define([ top = parseInt(this.$window.css('top')); this.resizing.enabled = true; - this.resizing.initpage_x = event.pageX; - this.resizing.initpage_y = event.pageY; - this.resizing.initx = event.pageX - left; - this.resizing.inity = event.pageY - top; + this.resizing.initpage_x = event.pageX*Common.Utils.zoom(); + this.resizing.initpage_y = event.pageY*Common.Utils.zoom(); + this.resizing.initx = this.resizing.initpage_x - left; + this.resizing.inity = this.resizing.initpage_y - top; this.resizing.initw = parseInt(this.$window.css("width")); this.resizing.inith = parseInt(this.$window.css("height")); 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 : window.innerWidth, - main_height = (window.innerHeight == undefined) ? document.documentElement.offsetHeight : window.innerHeight, + var main_width = (window.innerHeight == undefined) ? document.documentElement.offsetWidth : Common.Utils.innerWidth(), + main_height = (window.innerHeight == undefined) ? document.documentElement.offsetHeight : Common.Utils.innerHeight(), maxwidth = (this.initConfig.maxwidth) ? this.initConfig.maxwidth : main_width, maxheight = (this.initConfig.maxheight) ? this.initConfig.maxheight : main_height; @@ -337,17 +339,20 @@ define([ function _resize(event) { if (this.resizing.enabled) { - var resized = false; - if (this.resizing.type[0] && event.pageXthis.resizing.minx) { + var resized = false, + zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1, + pageX = event.pageX*zoom, + pageY = event.pageY*zoom; + if (this.resizing.type[0] && pageXthis.resizing.minx) { if (this.resizing.type[0]<0) - this.$window.css({left: event.pageX - this.resizing.initx}); - this.setWidth(this.resizing.initw + (event.pageX - this.resizing.initpage_x) * this.resizing.type[0]); + this.$window.css({left: pageX - this.resizing.initx}); + this.setWidth(this.resizing.initw + (pageX - this.resizing.initpage_x) * this.resizing.type[0]); resized = true; } - if (this.resizing.type[1] && event.pageYthis.resizing.miny) { + if (this.resizing.type[1] && pageYthis.resizing.miny) { if (this.resizing.type[1]<0) - this.$window.css({top: event.pageY - this.resizing.inity}); - this.setHeight(this.resizing.inith + (event.pageY - this.resizing.initpage_y) * this.resizing.type[1]); + this.$window.css({top: pageY - this.resizing.inity}); + this.setHeight(this.resizing.inith + (pageY - this.resizing.initpage_y) * this.resizing.type[1]); resized = true; } if (resized) this.fireEvent('resizing'); diff --git a/apps/common/main/lib/controller/ExternalDiagramEditor.js b/apps/common/main/lib/controller/ExternalDiagramEditor.js index 876c5f6a5..62810e19e 100644 --- a/apps/common/main/lib/controller/ExternalDiagramEditor.js +++ b/apps/common/main/lib/controller/ExternalDiagramEditor.js @@ -97,9 +97,10 @@ define([ externalEditor.serviceCommand('window:drag', state == 'start'); },this), 'show': _.bind(function(cmp){ - var h = this.diagramEditorView.getHeight(); - if (window.innerHeight>h && h<700 || window.innerHeighth && h<700 || innerHeighth && h<700 || window.innerHeighth && h<700 || innerHeight window.innerWidth) { - tp.left = window.innerWidth - $tip.width() - 30; + if (tp.left + $tip.width() > innerWidth) { + tp.left = innerWidth - $tip.width() - 30; } $tip.offset(tp).addClass('in'); diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 406f230c8..00be00ea2 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -101,7 +101,21 @@ Common.Utils = _.extend(new(function() { Chart : 6, MailMerge : 7, TextArt : 8 + }, + me = this, + checkSize = function() { + if (isChrome && !isOpera && document && document.firstElementChild && document.body) { + document.firstElementChild.style.zoom = "reset"; + me.zoom = document.body.clientWidth / window.innerWidth; + } + me.innerWidth = window.innerWidth * me.zoom; + me.innerHeight = window.innerHeight * me.zoom; }; + me.zoom = 1; + me.innerWidth = window.innerWidth; + me.innerHeight = window.innerHeight; + checkSize(); + $(window).on('resize', checkSize); return { userAgent: userAgent, @@ -162,7 +176,10 @@ Common.Utils = _.extend(new(function() { emailStrongRe: emailStrongRe, ipStrongRe: ipStrongRe, hostnameStrongRe: hostnameStrongRe, - documentSettingsType: documentSettingsType + documentSettingsType: documentSettingsType, + zoom: function() {return me.zoom;}, + innerWidth: function() {return me.innerWidth;}, + innerHeight: function() {return me.innerHeight;} } })(), Common.Utils || {}); diff --git a/apps/common/main/lib/view/ExternalDiagramEditor.js b/apps/common/main/lib/view/ExternalDiagramEditor.js index eeb341695..f1dc2ccc5 100644 --- a/apps/common/main/lib/view/ExternalDiagramEditor.js +++ b/apps/common/main/lib/view/ExternalDiagramEditor.js @@ -48,7 +48,7 @@ define([ _.extend(_options, { title: this.textTitle, width: 910, - height: (window.innerHeight-700)<0 ? window.innerHeight: 700, + height: (Common.Utils.innerHeight()-700)<0 ? Common.Utils.innerHeight(): 700, cls: 'advanced-settings-dlg', header: true, toolclose: 'hide', @@ -134,8 +134,8 @@ define([ this.$window.find('> .body').css('height', height-header_height); this.$window.find('> .body > .box').css('height', height-85); - var top = ((parseInt(window.innerHeight) - parseInt(height)) / 2) * 0.9; - var left = (parseInt(window.innerWidth) - parseInt(this.initConfig.width)) / 2; + var top = ((Common.Utils.innerHeight() - parseInt(height)) / 2) * 0.9; + var left = (Common.Utils.innerWidth() - parseInt(this.initConfig.width)) / 2; this.$window.css('left',left); this.$window.css('top',top); diff --git a/apps/common/main/lib/view/ExternalMergeEditor.js b/apps/common/main/lib/view/ExternalMergeEditor.js index 6e693f21d..417379bc1 100644 --- a/apps/common/main/lib/view/ExternalMergeEditor.js +++ b/apps/common/main/lib/view/ExternalMergeEditor.js @@ -48,7 +48,7 @@ define([ _.extend(_options, { title: this.textTitle, width: 910, - height: (window.innerHeight-700)<0 ? window.innerHeight: 700, + height: (Common.Utils.innerHeight()-700)<0 ? Common.Utils.innerHeight(): 700, cls: 'advanced-settings-dlg', header: true, toolclose: 'hide', @@ -134,8 +134,8 @@ define([ this.$window.find('> .body').css('height', height-header_height); this.$window.find('> .body > .box').css('height', height-85); - var top = ((parseInt(window.innerHeight) - parseInt(height)) / 2) * 0.9; - var left = (parseInt(window.innerWidth) - parseInt(this.initConfig.width)) / 2; + var top = ((Common.Utils.innerHeight() - parseInt(height)) / 2) * 0.9; + var left = (Common.Utils.innerWidth() - parseInt(this.initConfig.width)) / 2; this.$window.css('left',left); this.$window.css('top',top); diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index ed8360c4f..676738275 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -194,7 +194,7 @@ define([ if (e.which == 3) { // right button click Common.UI.Menu.Manager.hideAll(); var me = this, - showPoint = [e.pageX, e.pageY], + showPoint = [e.pageX*Common.Utils.zoom(), e.pageY*Common.Utils.zoom()], menuContainer = $(this.el).find(Common.Utils.String.format('#menu-container-{0}', this.gotoDocsMenu.id)); if (!this.gotoDocsMenu.rendered) { // Prepare menu container diff --git a/apps/common/main/lib/view/Plugins.js b/apps/common/main/lib/view/Plugins.js index 4f82c5c78..3289dbba2 100644 --- a/apps/common/main/lib/view/Plugins.js +++ b/apps/common/main/lib/view/Plugins.js @@ -202,9 +202,9 @@ define([ }, options); var header_footer = (_options.buttons && _.size(_options.buttons)>0) ? 85 : 34; - _options.width = (window.innerWidth-_options.width)<0 ? window.innerWidth: _options.width, + _options.width = (Common.Utils.innerWidth()-_options.width)<0 ? Common.Utils.innerWidth(): _options.width, _options.height += header_footer; - _options.height = (window.innerHeight-_options.height)<0 ? window.innerHeight: _options.height; + _options.height = (Common.Utils.innerHeight()-_options.height)<0 ? Common.Utils.innerHeight(): _options.height; this.template = [ '
', @@ -268,8 +268,8 @@ define([ }, setInnerSize: function(width, height) { - var maxHeight = parseInt(window.innerHeight), - maxWidth = parseInt(window.innerWidth), + var maxHeight = Common.Utils.innerHeight(), + maxWidth = Common.Utils.innerWidth(), borders_width = (parseInt(this.$window.css('border-left-width')) + parseInt(this.$window.css('border-right-width'))); if (maxHeight .@{icon-class} {background-position: -1*@icon-size -@index*@icon-size;} // .btn-group.open > .@{icon-class}, button.active > .@{icon-class}, diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 53aa0c365..30c7ee918 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -1759,11 +1759,11 @@ define([ menu.items[3].setDisabled(isAllDefailtNotModifaed); menu.items[4].setDisabled(isAllCustomDeleted); - var top = e.clientY; + var top = e.clientY*Common.Utils.zoom(); if ($('#header-container').is(":visible")) { top -= $('#header-container').height() } - showPoint = [e.clientX, top]; + showPoint = [e.clientX*Common.Utils.zoom(), top]; if (record != undefined) { //itemMenu diff --git a/apps/documenteditor/main/app/view/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index 1a85cb76e..2a5a4f7db 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -676,6 +676,7 @@ define([ } this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + this.btnBorderColor.setColor(this.borderColor.getColor()); }, _onInitTemplates: function(Templates){ diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 7903cb8ba..309bba1ae 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1559,7 +1559,7 @@ define([ } }).on('show:after', function(btn, e) { var mnu = $(this.el).find('.dropdown-menu '), - docH = $(document).height(), + docH = Common.Utils.innerHeight(), menuH = mnu.outerHeight(), top = parseInt(mnu.css('top')); diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index b9c9fea48..00b3f7d00 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -685,6 +685,11 @@ define([ me.slidesCount = count; }; + var onApiCurrentPages = function(number) { + if (me.currentMenu && me.currentMenu.isVisible()) + me.currentMenu.hide(); + }; + this.setApi = function(o) { me.api = o; @@ -695,6 +700,7 @@ define([ me.api.asc_registerCallback('asc_onPaintSlideNum', _.bind(onPaintSlideNum, me)); me.api.asc_registerCallback('asc_onEndPaintSlideNum', _.bind(onEndPaintSlideNum, me)); me.api.asc_registerCallback('asc_onCountPages', _.bind(onApiCountPages, me)); + me.api.asc_registerCallback('asc_onCurrentPage', _.bind(onApiCurrentPages, me)); me.slidesCount = me.api.getCountPages(); //hyperlink diff --git a/apps/presentationeditor/main/app/view/TableSettings.js b/apps/presentationeditor/main/app/view/TableSettings.js index 9f9b2220d..138a59e38 100644 --- a/apps/presentationeditor/main/app/view/TableSettings.js +++ b/apps/presentationeditor/main/app/view/TableSettings.js @@ -583,8 +583,10 @@ define([ UpdateThemeColors: function() { if (this.colorsBack) this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); - if (this.borderColor) + if (this.borderColor) { this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + this.btnBorderColor.setColor(this.borderColor.getColor()); + } }, _onInitTemplates: function(Templates){ diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 1e2682647..353d45ffa 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -791,7 +791,7 @@ define([ }); }).on('show:after', function(btn, e) { var mnu = $(this.el).find('.dropdown-menu '), - docH = $(document).height(), + docH = Common.Utils.innerHeight(), menuH = mnu.outerHeight(), top = parseInt(mnu.css('top')); diff --git a/apps/presentationeditor/main/resources/img/toolbar-menu@2x.png b/apps/presentationeditor/main/resources/img/toolbar-menu@2x.png index 2675cf91a..6ab014c93 100644 Binary files a/apps/presentationeditor/main/resources/img/toolbar-menu@2x.png and b/apps/presentationeditor/main/resources/img/toolbar-menu@2x.png differ diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index d90ec45e8..88ddb8a58 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -1001,9 +1001,8 @@ define([ rect = config.asc_getCellCoord(), x = rect.asc_getX() + rect.asc_getWidth() +offset.left, y = rect.asc_getY() + rect.asc_getHeight() + offset.top; - var doc = $(document), - docwidth = doc.width(), - docheight = doc.height(); + var docwidth = Common.Utils.innerWidth(), + docheight = Common.Utils.innerHeight(); if (x+me.dlgFilter.options.width > docwidth) x = docwidth - me.dlgFilter.options.width - 5; if (y+me.dlgFilter.options.height > docheight) @@ -1339,7 +1338,7 @@ define([ var me = this, documentHolderView = me.documentHolder, - showPoint = [event.pageX - documentHolderView.cmpEl.offset().left, event.pageY - documentHolderView.cmpEl.offset().top], + showPoint = [event.pageX*Common.Utils.zoom() - documentHolderView.cmpEl.offset().left, event.pageY*Common.Utils.zoom() - documentHolderView.cmpEl.offset().top], menuContainer = documentHolderView.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)); if (!menu.rendered) { diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index c5ecf1497..cd30c1fda 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -621,7 +621,7 @@ define([ } } if (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed || - ($(e.target).parents('#left-menu').length || this.leftMenu.btnPlugins.pressed) && this.api.isCellEdited!==true) { + ($(e.target).parents('#left-menu').length || this.leftMenu.btnPlugins.pressed || this.leftMenu.btnComments.pressed) && this.api.isCellEdited!==true) { this.leftMenu.close(); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); return false; diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index dfe11889f..e5decace2 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -369,6 +369,13 @@ define([ } }, + onSelectionChanged: function(info){ + if (!this._isChartDataReady){ + this._isChartDataReady = true; + Common.Gateway.internalMessage('chartDataReady'); + } + }, + onLongActionBegin: function(type, id) { var action = {id: id, type: type}; this.stackLongActions.push(action); @@ -799,7 +806,7 @@ define([ }) .mousemove($.proxy(function(e){ if (this.isDiagramDrag) { - Common.Gateway.internalMessage('processMouse', {event: 'mouse:move', pagex: e.pageX, pagey: e.pageY}); + Common.Gateway.internalMessage('processMouse', {event: 'mouse:move', pagex: e.pageX*Common.Utils.zoom(), pagey: e.pageY*Common.Utils.zoom()}); } },this)); } @@ -908,6 +915,8 @@ define([ me.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me)); me.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me)); /** coauthoring end **/ + if (me.appOptions.isEditDiagram) + me.api.asc_registerCallback('asc_onSelectionChanged', _.bind(me.onSelectionChanged, me)); if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) { me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], ApplyEditRights); diff --git a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js index c72f8d68e..de1452a3e 100644 --- a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js @@ -976,8 +976,10 @@ define([ if (target.length) { bound = target.get(0).getBoundingClientRect(); - if (bound.left < event.clientX && event.clientX < bound.right && - bound.top < event.clientY && event.clientY < bound.bottom) { + var _clientX = event.clientX*Common.Utils.zoom(), + _clientY = event.clientY*Common.Utils.zoom(); + if (bound.left < _clientX && _clientX < bound.right && + bound.top < _clientY && _clientY < bound.bottom) { isLabel = true; } } diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js index e32358a51..5200a82ae 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js @@ -90,6 +90,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.horAxisProps = null; this.currentAxisProps = null; this.dataRangeValid = ''; + this.currentChartType = this._state.ChartType; }, render: function() { @@ -839,6 +840,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.updateAxisProps(rawData.type, true); this.vertAxisProps = this.chartSettings.getVertAxisProps(); this.horAxisProps = this.chartSettings.getHorAxisProps(); + this.updateDataLabels(rawData.type, this.cmbDataLabels.getValue()); + this.currentChartType = rawData.type; }, updateAxisProps: function(type, isDefault) { @@ -881,6 +884,44 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.btnsCategory[3].options.contentTarget = (value || type == Asc.c_oAscChartTypeSettings.scatter) ? 'id-chart-settings-dlg-vert' : 'id-chart-settings-dlg-hor'; }, + updateDataLabels: function(chartType, labelPos) { + if (chartType !== this.currentChartType) { + var data = [{ value: Asc.c_oAscChartDataLabelsPos.none, displayValue: this.textNone }, + { value: Asc.c_oAscChartDataLabelsPos.ctr, displayValue: this.textCenter }]; + + if (chartType == Asc.c_oAscChartTypeSettings.barNormal || chartType == Asc.c_oAscChartTypeSettings.hBarNormal) + data.push({ value: Asc.c_oAscChartDataLabelsPos.inBase, displayValue: this.textInnerBottom }, + { value: Asc.c_oAscChartDataLabelsPos.inEnd, displayValue: this.textInnerTop }, + { value: Asc.c_oAscChartDataLabelsPos.outEnd, displayValue: this.textOuterTop }); + else if ( chartType == Asc.c_oAscChartTypeSettings.barStacked || chartType == Asc.c_oAscChartTypeSettings.barStackedPer || + chartType == Asc.c_oAscChartTypeSettings.hBarStacked || chartType == Asc.c_oAscChartTypeSettings.hBarStackedPer ) + data.push({ value: Asc.c_oAscChartDataLabelsPos.inBase, displayValue: this.textInnerBottom }, + { value: Asc.c_oAscChartDataLabelsPos.inEnd, displayValue: this.textInnerTop }); + else if (chartType == Asc.c_oAscChartTypeSettings.lineNormal || chartType == Asc.c_oAscChartTypeSettings.lineStacked || chartType == Asc.c_oAscChartTypeSettings.lineStackedPer || + chartType == Asc.c_oAscChartTypeSettings.stock || chartType == Asc.c_oAscChartTypeSettings.scatter) + data.push({ value: Asc.c_oAscChartDataLabelsPos.l, displayValue: this.textLeft }, + { value: Asc.c_oAscChartDataLabelsPos.r, displayValue: this.textRight }, + { value: Asc.c_oAscChartDataLabelsPos.t, displayValue: this.textTop }, + { value: Asc.c_oAscChartDataLabelsPos.b, displayValue: this.textBottom }); + else if (chartType == Asc.c_oAscChartTypeSettings.pie || chartType == Asc.c_oAscChartTypeSettings.pie3d) + data.push({ value: Asc.c_oAscChartDataLabelsPos.bestFit, displayValue: this.textFit }, + { value: Asc.c_oAscChartDataLabelsPos.inEnd, displayValue: this.textInnerTop }, + { value: Asc.c_oAscChartDataLabelsPos.outEnd, displayValue: this.textOuterTop }); + + this.cmbDataLabels.setData(data); + } + + if (labelPos!==undefined) { + var rec = this.cmbDataLabels.store.findWhere({value: labelPos}); + if (!rec) + labelPos = Asc.c_oAscChartDataLabelsPos.ctr; + } else + labelPos = Asc.c_oAscChartDataLabelsPos.none; + + this.cmbDataLabels.setValue(labelPos); + this.onSelectDataLabels(this.cmbDataLabels, {value:labelPos}); + }, + onVCategoryClick: function() { (this.vertAxisProps.getAxisType()==Asc.c_oAscAxisType.val) ? this.fillVProps(this.vertAxisProps) : this.fillHProps(this.vertAxisProps); }, @@ -1083,8 +1124,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.cmbChartTitle.setValue(props.getTitle()); this.cmbLegendPos.setValue(props.getLegendPos()); - this.cmbDataLabels.setValue(props.getDataLabelsPos()); - this.onSelectDataLabels(this.cmbDataLabels, {value:props.getDataLabelsPos()}); + this.updateDataLabels(this._state.ChartType, props.getDataLabelsPos()); this.chSeriesName.setValue(this.chartSettings.getShowSerName(), true); this.chCategoryName.setValue(this.chartSettings.getShowCatName(), true); @@ -1100,6 +1140,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' this.horAxisProps = props.getHorAxisProps(); this.updateAxisProps(this._state.ChartType); + this.currentChartType = this._state.ChartType; } }, @@ -1330,6 +1371,11 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' textAxisSettings: 'Axis Settings', textGridLines: 'Gridlines', textShow: 'Show', - textHide: 'Hide' + textHide: 'Hide', + textLeft: 'Left', + textRight: 'Right', + textTop: 'Top', + textBottom: 'Bottom', + textFit: 'Fit Width' }, SSE.Views.ChartSettingsDlg || {})); }); diff --git a/apps/spreadsheeteditor/main/app/view/FormulaDialog.js b/apps/spreadsheeteditor/main/app/view/FormulaDialog.js index 14153458d..0ba1f53fc 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaDialog.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaDialog.js @@ -130,8 +130,8 @@ define([ main_width = document.documentElement.offsetWidth; main_height = document.documentElement.offsetHeight; } else { - main_width = window.innerWidth; - main_height = window.innerHeight; + main_width = Common.Utils.innerWidth(); + main_height = Common.Utils.innerHeight(); } top = ((parseInt(main_height, 10) - parseInt(win_height, 10)) / 2) * 0.9; diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 26b8d8cdc..c1a815423 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1204,7 +1204,7 @@ define([ }); }).on('show:after', function(btn, e) { var mnu = $(this.el).find('.dropdown-menu '), - docH = $(document).height(), + docH = Common.Utils.innerHeight(), menuH = mnu.outerHeight(), top = parseInt(mnu.css('top')); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 35bbe540b..7cfa3161f 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -411,6 +411,11 @@ "SSE.Views.ChartSettingsDlg.textXAxisTitle": "X Axis Title", "SSE.Views.ChartSettingsDlg.textYAxisTitle": "Y Axis Title", "SSE.Views.ChartSettingsDlg.txtEmpty": "This field is required", + "SSE.Views.ChartSettingsDlg.textLeft": "Left", + "SSE.Views.ChartSettingsDlg.textRight": "Right", + "SSE.Views.ChartSettingsDlg.textTop": "Top", + "SSE.Views.ChartSettingsDlg.textBottom": "Bottom", + "SSE.Views.ChartSettingsDlg.textFit": "Fit Width", "SSE.Views.DigitalFilterDialog.cancelButtonText": "Cancel", "SSE.Views.DigitalFilterDialog.capAnd": "And", "SSE.Views.DigitalFilterDialog.capCondition1": "equals",