[SSE] Bug 19378 (add Arrange, Align, Rotation to context menu)

This commit is contained in:
Julia Radzhabova 2019-02-27 12:52:19 +03:00
parent 57c70bbb02
commit d3bf9ff612
5 changed files with 171 additions and 28 deletions

View file

@ -182,7 +182,9 @@ define([
view.pmiAddComment.on('click', _.bind(me.onAddComment, me));
/** coauthoring end **/
view.pmiAddNamedRange.on('click', _.bind(me.onAddNamedRange, me));
view.imgMenu.on('item:click', _.bind(me.onImgMenu, me));
view.menuImageArrange.menu.on('item:click', _.bind(me.onImgMenu, me));
view.menuImgRotate.menu.on('item:click', _.bind(me.onImgMenu, me));
view.menuImageAlign.menu.on('item:click', _.bind(me.onImgMenuAlign, me));
view.menuParagraphVAlign.menu.on('item:click', _.bind(me.onParagraphVAlign, me));
view.menuParagraphDirection.menu.on('item:click', _.bind(me.onParagraphDirection, me));
view.menuParagraphBullets.menu.on('item:click', _.bind(me.onSelectNoneBullet, me));
@ -637,6 +639,41 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', (item.value == 'grouping') ? 'Grouping' : 'Ungrouping');
} else if (item.options.type == 'rotate') {
var properties = new Asc.asc_CImgProperty();
properties.asc_putRotAdd((item.value==1 ? 90 : 270) * 3.14159265358979 / 180);
this.api.asc_setGraphicObjectProps(properties);
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'Rotate');
} else if (item.options.type == 'flip') {
var properties = new Asc.asc_CImgProperty();
if (item.value==1)
properties.asc_putFlipHInvert(true);
else
properties.asc_putFlipVInvert(true);
this.api.asc_setGraphicObjectProps(properties);
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'Flip');
}
}
},
onImgMenuAlign: function(menu, item) {
if (this.api) {
if (item.value>-1 && item.value < 6) {
this.api.asc_setSelectedDrawingObjectAlign(item.value);
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'Objects Align');
} else if (item.value == 6) {
this.api.asc_DistributeSelectedDrawingObjectHor();
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'Distribute');
} else if (item.value == 7){
this.api.asc_DistributeSelectedDrawingObjectVer();
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'Distribute');
}
}
},
@ -1461,8 +1498,15 @@ define([
}
}
var cangroup = this.api.asc_canGroupGraphicsObjects();
documentHolder.mnuUnGroupImg.setDisabled(isObjLocked || !this.api.asc_canUnGroupGraphicsObjects());
documentHolder.mnuGroupImg.setDisabled(isObjLocked || !this.api.asc_canGroupGraphicsObjects());
documentHolder.mnuGroupImg.setDisabled(isObjLocked || !cangroup);
documentHolder.menuImageAlign.setDisabled(isObjLocked || !cangroup);
var objcount = this.api.asc_getSelectedDrawingObjectsCount();
documentHolder.menuImageAlign.menu.items[7].setDisabled(objcount<3);
documentHolder.menuImageAlign.menu.items[8].setDisabled(objcount<3);
documentHolder.mnuShapeAdvanced.setVisible(isshapemenu && !isimagemenu && !ischartmenu);
documentHolder.mnuShapeAdvanced.setDisabled(isObjLocked);
documentHolder.mnuChartEdit.setVisible(ischartmenu && !isimagemenu && !isshapemenu && has_chartprops);
@ -1478,10 +1522,10 @@ define([
var pluginGuid = (documentHolder.mnuImgAdvanced.imageInfo) ? documentHolder.mnuImgAdvanced.imageInfo.asc_getPluginGuid() : null;
documentHolder.menuImgReplace.setVisible(isimageonly && (pluginGuid===null || pluginGuid===undefined));
documentHolder.menuImgReplace.setDisabled(isObjLocked || pluginGuid===null);
documentHolder.mnuBringToFront.setDisabled(isObjLocked);
documentHolder.mnuSendToBack.setDisabled(isObjLocked);
documentHolder.mnuBringForward.setDisabled(isObjLocked);
documentHolder.mnuSendBackward.setDisabled(isObjLocked);
documentHolder.menuImageArrange.setDisabled(isObjLocked);
documentHolder.menuImgRotate.setVisible(!ischartmenu && (pluginGuid===null || pluginGuid===undefined));
documentHolder.menuImgRotate.setDisabled(isObjLocked);
var isInSign = !!signGuid;
documentHolder.menuSignatureEditSign.setVisible(isInSign);

View file

@ -607,28 +607,117 @@ define([
me.mnuBringToFront = new Common.UI.MenuItem({
caption : this.textArrangeFront,
iconCls : 'mnu-arrange-front',
iconCls : 'mnu-arrange-front',
type : 'arrange',
value : Asc.c_oAscDrawingLayerType.BringToFront
});
me.mnuSendToBack = new Common.UI.MenuItem({
caption : this.textArrangeBack,
iconCls : 'mnu-arrange-back',
type : 'arrange',
value : Asc.c_oAscDrawingLayerType.SendToBack
iconCls : 'mnu-arrange-back',
type : 'arrange',
value : Asc.c_oAscDrawingLayerType.SendToBack
});
me.mnuBringForward = new Common.UI.MenuItem({
caption : this.textArrangeForward,
iconCls : 'mnu-arrange-forward',
type : 'arrange',
value : Asc.c_oAscDrawingLayerType.BringForward
iconCls : 'mnu-arrange-forward',
type : 'arrange',
value : Asc.c_oAscDrawingLayerType.BringForward
});
me.mnuSendBackward = new Common.UI.MenuItem({
caption: this.textArrangeBackward,
iconCls : 'mnu-arrange-backward',
type : 'arrange',
value : Asc.c_oAscDrawingLayerType.SendBackward
iconCls : 'mnu-arrange-backward',
type : 'arrange',
value : Asc.c_oAscDrawingLayerType.SendBackward
});
me.menuImageArrange = new Common.UI.MenuItem({
caption : me.textArrange,
menu : new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [
me.mnuBringToFront,
me.mnuSendToBack,
me.mnuBringForward,
me.mnuSendBackward,
{ caption: '--' },
me.mnuGroupImg,
me.mnuUnGroupImg
]
})
});
me.menuImageAlign = new Common.UI.MenuItem({
caption : me.textAlign,
menu : new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [{
caption : me.textShapeAlignLeft,
iconCls : 'mnu-img-align-left',
value : 0
}, {
caption : me.textShapeAlignCenter,
iconCls : 'mnu-img-align-center',
value : 4
}, {
caption : me.textShapeAlignRight,
iconCls : 'mnu-img-align-right',
value : 1
}, {
caption : me.textShapeAlignTop,
iconCls : 'mnu-img-align-top',
value : 3
}, {
caption : me.textShapeAlignMiddle,
iconCls : 'mnu-img-align-middle',
value : 5
}, {
caption : me.textShapeAlignBottom,
iconCls : 'mnu-img-align-bottom',
value : 2
},
{caption: '--'},
{
caption: me.txtDistribHor,
iconCls: 'mnu-distrib-hor',
value: 6
},
{
caption: me.txtDistribVert,
iconCls: 'mnu-distrib-vert',
value: 7
}]
})
});
me.menuImgRotate = new Common.UI.MenuItem({
caption : me.textRotate,
menu : new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [
new Common.UI.MenuItem({
caption: me.textRotate270,
type : 'rotate',
value : 0
}),
new Common.UI.MenuItem({
caption: me.textRotate90,
type : 'rotate',
value : 1
}),
new Common.UI.MenuItem({
caption: me.textFlipH,
type : 'flip',
value : 1
}),
new Common.UI.MenuItem({
caption: me.textFlipV,
type : 'flip',
value : 0
})
]
})
});
this.imgMenu = new Common.UI.Menu({
items: [
me.pmiImgCut,
@ -638,13 +727,9 @@ define([
me.menuSignatureEditSign,
me.menuSignatureEditSetup,
me.menuEditSignSeparator,
me.mnuBringToFront,
me.mnuSendToBack,
me.mnuBringForward,
me.mnuSendBackward,
{caption: '--'},
me.mnuGroupImg,
me.mnuUnGroupImg,
me.menuImageArrange,
me.menuImageAlign,
me.menuImgRotate,
me.mnuShapeSeparator,
me.mnuChartEdit,
me.mnuShapeAdvanced,
@ -960,7 +1045,14 @@ define([
textShapeAlignBottom : 'Align Bottom',
textShapeAlignMiddle : 'Align Middle',
txtDistribHor: 'Distribute Horizontally',
txtDistribVert: 'Distribute Vertically'
txtDistribVert: 'Distribute Vertically',
textRotate270: 'Rotate Left 90°',
textRotate90: 'Rotate Right 90°',
textFlipV: 'Flip Vertically',
textFlipH: 'Flip Horizontally',
textRotate: 'Rotation',
textArrange: 'Arrange',
textAlign: 'Align'
}, SSE.Views.DocumentHolder || {}));
});

View file

@ -459,7 +459,7 @@ define([
textFlip: 'Flip',
textHint270: 'Rotate Left 90°',
textHint90: 'Rotate Right 90°',
textHintFlipV: 'Flip Vertical',
textHintFlipH: 'Flip Horizontal'
textHintFlipV: 'Flip Vertically',
textHintFlipH: 'Flip Horizontally'
}, SSE.Views.ImageSettings || {}));
});

View file

@ -1737,7 +1737,7 @@ define([
textFlip: 'Flip',
textHint270: 'Rotate Left 90°',
textHint90: 'Rotate Right 90°',
textHintFlipV: 'Flip Vertical',
textHintFlipH: 'Flip Horizontal'
textHintFlipV: 'Flip Vertically',
textHintFlipH: 'Flip Horizontally'
}, SSE.Views.ShapeSettings || {}));
});

View file

@ -1439,6 +1439,13 @@
"SSE.Views.DocumentHolder.txtUngroup": "Ungroup",
"SSE.Views.DocumentHolder.txtWidth": "Width",
"SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
"SSE.Views.DocumentHolder.textRotate270": "Rotate Left 90°",
"SSE.Views.DocumentHolder.textRotate90": "Rotate Right 90°",
"SSE.Views.DocumentHolder.textFlipV": "Flip Vertically",
"SSE.Views.DocumentHolder.textFlipH": "Flip Horizontally",
"SSE.Views.DocumentHolder.textRotate": "Rotation",
"SSE.Views.DocumentHolder.textArrange": "Arrange",
"SSE.Views.DocumentHolder.textAlign": "Align",
"SSE.Views.FileMenu.btnBackCaption": "Go to Documents",
"SSE.Views.FileMenu.btnCloseMenuCaption": "Close Menu",
"SSE.Views.FileMenu.btnCreateNewCaption": "Create New",