[PE] Add rotation to image and shape settings in the right panel

This commit is contained in:
Julia Radzhabova 2018-08-30 16:53:46 +03:00
parent 3dac3f0401
commit a345d02840
6 changed files with 207 additions and 2 deletions

View file

@ -22,6 +22,32 @@
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textRotation %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textRotate90 %></label>
<div>
<div id="image-button-270" style="display: inline-block;margin-right: 4px;"></div>
<div id="image-button-90" style="display: inline-block;"></div>
</div>
</td>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textFlip %></label>
<div>
<div id="image-button-fliph" style="display: inline-block;margin-right: 4px;"></div>
<div id="image-button-flipv" style="display: inline-block;"></div>
</div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2>
<label class="header" id="image-lbl-replace" ><%= scope.textInsert %></label>

View file

@ -116,6 +116,38 @@
</div>
</td>
</tr>
<tr class="shape-only">
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr class="shape-only">
<td class="padding-small">
<label class="header"><%= scope.textRotation %></label>
</td>
</tr>
<tr class="shape-only">
<td>
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textRotate90 %></label>
<div>
<div id="shape-button-270" style="display: inline-block;margin-right: 4px;"></div>
<div id="shape-button-90" style="display: inline-block;"></div>
</div>
</td>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textFlip %></label>
<div>
<div id="shape-button-fliph" style="display: inline-block;margin-right: 4px;"></div>
<div id="shape-button-flipv" style="display: inline-block;"></div>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr class="change-type">
<td class="padding-small">
<div class="separator horizontal"></div>

View file

@ -139,6 +139,46 @@ define([
this.fireEvent('editcomplete', this);
}, this));
this.btnRotate270 = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'rotate-270',
value: 0,
hint: this.textHint270
});
this.btnRotate270.render( $('#image-button-270', this.$el));
this.btnRotate270.on('click', _.bind(this.onBtnRotateClick, this));
this.lockedControls.push(this.btnRotate270);
this.btnRotate90 = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'rotate-90',
value: 1,
hint: this.textHint90
});
this.btnRotate90.render( $('#image-button-90', this.$el));
this.btnRotate90.on('click', _.bind(this.onBtnRotateClick, this));
this.lockedControls.push(this.btnRotate90);
this.btnFlipV = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'flip-vert',
value: 0,
hint: this.textHintFlipV
});
this.btnFlipV.render( $('#image-button-flipv', this.$el));
this.btnFlipV.on('click', _.bind(this.onBtnFlipClick, this));
this.lockedControls.push(this.btnFlipV);
this.btnFlipH = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'flip-hor',
value: 1,
hint: this.textHintFlipH
});
this.btnFlipH.render( $('#image-button-fliph', this.$el));
this.btnFlipH.on('click', _.bind(this.onBtnFlipClick, this));
this.lockedControls.push(this.btnFlipH);
this.linkAdvanced = $('#image-advanced-link');
this.lblReplace = $('#image-lbl-replace');
$(this.el).on('click', '#image-advanced-link', _.bind(this.openAdvancedSettings, this));
@ -268,6 +308,23 @@ define([
}
},
onBtnRotateClick: function(btn) {
var properties = new Asc.asc_CImgProperty();
properties.asc_putRot((btn.options.value==1 ? 90 : 270) * 3.14159265358979 / 180);
this.api.ImgApply(properties);
this.fireEvent('editcomplete', this);
},
onBtnFlipClick: function(btn) {
var properties = new Asc.asc_CImgProperty();
if (btn.options.value==1)
properties.asc_putFlipH(true);
else
properties.asc_putFlipV(true);
this.api.ImgApply(properties);
this.fireEvent('editcomplete', this);
},
setLocked: function (locked) {
this._locked = locked;
},
@ -293,7 +350,14 @@ define([
textFromFile: 'From File',
textAdvanced: 'Show advanced settings',
textEditObject: 'Edit Object',
textEdit: 'Edit'
textEdit: 'Edit',
textRotation: 'Rotation',
textRotate90: 'Rotate 90°',
textFlip: 'Flip',
textHint270: 'Rotate Left 90°',
textHint90: 'Rotate Right 90°',
textHintFlipV: 'Flip Vertical',
textHintFlipH: 'Flip Horizontal'
}, PE.Views.ImageSettings || {}));
});

View file

@ -1290,6 +1290,46 @@ define([
this.btnChangeShape.render( $('#shape-btn-change')) ;
this.lockedControls.push(this.btnChangeShape);
this.btnRotate270 = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'rotate-270',
value: 0,
hint: this.textHint270
});
this.btnRotate270.render( $('#shape-button-270', me.$el));
this.btnRotate270.on('click', _.bind(this.onBtnRotateClick, this));
this.lockedControls.push(this.btnRotate270);
this.btnRotate90 = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'rotate-90',
value: 1,
hint: this.textHint90
});
this.btnRotate90.render( $('#shape-button-90', me.$el));
this.btnRotate90.on('click', _.bind(this.onBtnRotateClick, this));
this.lockedControls.push(this.btnRotate90);
this.btnFlipV = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'flip-vert',
value: 0,
hint: this.textHintFlipV
});
this.btnFlipV.render( $('#shape-button-flipv', me.$el));
this.btnFlipV.on('click', _.bind(this.onBtnFlipClick, this));
this.lockedControls.push(this.btnFlipV);
this.btnFlipH = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'flip-hor',
value: 1,
hint: this.textHintFlipH
});
this.btnFlipH.render( $('#shape-button-fliph', me.$el));
this.btnFlipH.on('click', _.bind(this.onBtnFlipClick, this));
this.lockedControls.push(this.btnFlipH);
this.linkAdvanced = $('#shape-advanced-link');
$(this.el).on('click', '#shape-advanced-link', _.bind(this.openAdvancedSettings, this));
},
@ -1544,6 +1584,23 @@ define([
this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
},
onBtnRotateClick: function(btn) {
var properties = new Asc.asc_CShapeProperty();
properties.asc_putRot((btn.options.value==1 ? 90 : 270) * 3.14159265358979 / 180);
this.api.ShapeApply(properties);
this.fireEvent('editcomplete', this);
},
onBtnFlipClick: function(btn) {
var properties = new Asc.asc_CShapeProperty();
if (btn.options.value==1)
properties.asc_putFlipH(true);
else
properties.asc_putFlipV(true);
this.api.ShapeApply(properties);
this.fireEvent('editcomplete', this);
},
_pt2mm: function(value) {
return (value * 25.4 / 72.0);
},
@ -1643,6 +1700,13 @@ define([
textStyle: 'Style',
textGradient: 'Gradient',
textBorderSizeErr: 'The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt.',
strType: 'Type'
strType: 'Type',
textRotation: 'Rotation',
textRotate90: 'Rotate 90°',
textFlip: 'Flip',
textHint270: 'Rotate Left 90°',
textHint90: 'Rotate Right 90°',
textHintFlipV: 'Flip Vertical',
textHintFlipH: 'Flip Horizontal'
}, PE.Views.ShapeSettings || {}));
});

View file

@ -1037,6 +1037,13 @@
"PE.Views.ImageSettings.textOriginalSize": "Default Size",
"PE.Views.ImageSettings.textSize": "Size",
"PE.Views.ImageSettings.textWidth": "Width",
"PE.Views.ImageSettings.textRotation": "Rotation",
"PE.Views.ImageSettings.textRotate90": "Rotate 90°",
"PE.Views.ImageSettings.textFlip": "Flip",
"PE.Views.ImageSettings.textHint270": "Rotate Left 90°",
"PE.Views.ImageSettings.textHint90": "Rotate Right 90°",
"PE.Views.ImageSettings.textHintFlipV": "Flip Vertical",
"PE.Views.ImageSettings.textHintFlipH": "Flip Horizontal",
"PE.Views.ImageSettingsAdvanced.cancelButtonText": "Cancel",
"PE.Views.ImageSettingsAdvanced.okButtonText": "OK",
"PE.Views.ImageSettingsAdvanced.textAlt": "Alternative Text",
@ -1148,6 +1155,13 @@
"PE.Views.ShapeSettings.txtNoBorders": "No Line",
"PE.Views.ShapeSettings.txtPapyrus": "Papyrus",
"PE.Views.ShapeSettings.txtWood": "Wood",
"PE.Views.ShapeSettings.textRotation": "Rotation",
"PE.Views.ShapeSettings.textRotate90": "Rotate 90°",
"PE.Views.ShapeSettings.textFlip": "Flip",
"PE.Views.ShapeSettings.textHint270": "Rotate Left 90°",
"PE.Views.ShapeSettings.textHint90": "Rotate Right 90°",
"PE.Views.ShapeSettings.textHintFlipV": "Flip Vertical",
"PE.Views.ShapeSettings.textHintFlipH": "Flip Horizontal",
"PE.Views.ShapeSettingsAdvanced.cancelButtonText": "Cancel",
"PE.Views.ShapeSettingsAdvanced.okButtonText": "OK",
"PE.Views.ShapeSettingsAdvanced.strColumns": "Columns",

View file

@ -289,6 +289,11 @@
.toolbar-btn-icon(btn-save-coauth, 69, @toolbar-icon-size);
//.toolbar-btn-icon(btn-insertequation, 74, @toolbar-icon-size);
//.toolbar-btn-icon(rotate-90, 79, @toolbar-icon-size);
//.toolbar-btn-icon(rotate-270, 80, @toolbar-icon-size);
//.toolbar-btn-icon(flip-hor, 81, @toolbar-icon-size);
//.toolbar-btn-icon(flip-vert, 82, @toolbar-icon-size);
// add slide
//.btn-toolbar .btn-addslide {background-position: 0 -120px;}
//.btn-toolbar.active > .btn-addslide,