From 57c70bbb022e8e7c19ed320461a60ed7e24d5673 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 26 Feb 2019 19:36:02 +0300 Subject: [PATCH] [PE] Bug 19378 (add rotation to context menu) --- .../main/app/view/DocumentHolder.js | 54 ++++++++++++++++++- .../main/app/view/ImageSettings.js | 4 +- .../main/app/view/ShapeSettings.js | 4 +- apps/presentationeditor/main/locale/en.json | 5 ++ 4 files changed, 62 insertions(+), 5 deletions(-) diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index 64694a9a97..4c3e5baeb6 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -2777,6 +2777,48 @@ define([ }) }); + var onImgRotate = function(item) { + var properties = new Asc.asc_CShapeProperty(); + properties.asc_putRotAdd((item.value==1 ? 90 : 270) * 3.14159265358979 / 180); + me.api.ShapeApply(properties); + me.fireEvent('editcomplete', me); + }; + + var onImgFlip = function(item) { + var properties = new Asc.asc_CShapeProperty(); + if (item.value==1) + properties.asc_putFlipHInvert(true); + else + properties.asc_putFlipVInvert(true); + me.api.ShapeApply(properties); + me.fireEvent('editcomplete', me); + }; + + var menuImgShapeRotate = new Common.UI.MenuItem({ + caption : me.textRotate, + menu : new Common.UI.Menu({ + menuAlign: 'tl-tr', + items: [ + new Common.UI.MenuItem({ + caption: me.textRotate270, + value : 0 + }).on('click', _.bind(onImgRotate, me)), + new Common.UI.MenuItem({ + caption: me.textRotate90, + value : 1 + }).on('click', _.bind(onImgRotate, me)), + new Common.UI.MenuItem({ + caption: me.textFlipH, + value : 1 + }).on('click', _.bind(onImgFlip, me)), + new Common.UI.MenuItem({ + caption: me.textFlipV, + value : 0 + }).on('click', _.bind(onImgFlip, me)) + ] + }) + }); + /** coauthoring begin **/ var menuAddCommentPara = new Common.UI.MenuItem({ caption : me.addCommentText @@ -3178,6 +3220,10 @@ define([ disabled = imgdisabled || shapedisabled || chartdisabled || (value.slideProps!==undefined && value.slideProps.locked), pluginGuid = (value.imgProps) ? value.imgProps.value.asc_getPluginGuid() : null; + menuImgShapeRotate.setVisible(_.isUndefined(value.chartProps) && (pluginGuid===null || pluginGuid===undefined)); + if (menuImgShapeRotate.isVisible()) + menuImgShapeRotate.setDisabled(disabled); + // image properties menuImgOriginalSize.setVisible(isimage); if (menuImgOriginalSize.isVisible()) @@ -3218,6 +3264,7 @@ define([ { caption: '--' }, menuImgShapeArrange, menuImgShapeAlign, + menuImgShapeRotate, menuImgShapeSeparator, menuImgOriginalSize, menuImgReplace, @@ -3479,7 +3526,12 @@ define([ textDistributeCols: 'Distribute columns', textReplace: 'Replace image', textFromUrl: 'From URL', - textFromFile: 'From File' + textFromFile: 'From File', + textRotate270: 'Rotate Left 90°', + textRotate90: 'Rotate Right 90°', + textFlipV: 'Flip Vertically', + textFlipH: 'Flip Horizontally', + textRotate: 'Rotation' }, PE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/view/ImageSettings.js b/apps/presentationeditor/main/app/view/ImageSettings.js index 5edcc5c636..f338ff6ab8 100644 --- a/apps/presentationeditor/main/app/view/ImageSettings.js +++ b/apps/presentationeditor/main/app/view/ImageSettings.js @@ -360,8 +360,8 @@ define([ textFlip: 'Flip', textHint270: 'Rotate Left 90°', textHint90: 'Rotate Right 90°', - textHintFlipV: 'Flip Vertical', - textHintFlipH: 'Flip Horizontal' + textHintFlipV: 'Flip Vertically', + textHintFlipH: 'Flip Horizontally' }, PE.Views.ImageSettings || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index 0c731a4d49..32ce9c75e9 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -1710,7 +1710,7 @@ define([ textFlip: 'Flip', textHint270: 'Rotate Left 90°', textHint90: 'Rotate Right 90°', - textHintFlipV: 'Flip Vertical', - textHintFlipH: 'Flip Horizontal' + textHintFlipV: 'Flip Vertically', + textHintFlipH: 'Flip Horizontally' }, PE.Views.ShapeSettings || {})); }); diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 6f7bbedfeb..094f5ac0a1 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1104,6 +1104,11 @@ "PE.Views.DocumentHolder.txtUnderbar": "Bar under text", "PE.Views.DocumentHolder.txtUngroup": "Ungroup", "PE.Views.DocumentHolder.vertAlignText": "Vertical Alignment", + "PE.Views.DocumentHolder.textRotate270": "Rotate Left 90°", + "PE.Views.DocumentHolder.textRotate90": "Rotate Right 90°", + "PE.Views.DocumentHolder.textFlipV": "Flip Vertically", + "PE.Views.DocumentHolder.textFlipH": "Flip Horizontally", + "PE.Views.DocumentHolder.textRotate": "Rotation", "PE.Views.DocumentPreview.goToSlideText": "Go to Slide", "PE.Views.DocumentPreview.slideIndexText": "Slide {0} of {1}", "PE.Views.DocumentPreview.txtClose": "Close slideshow",