reinstate fill and change dashed shortcut

This commit is contained in:
abakkk 2019-03-27 00:59:48 +01:00
parent 27ea6a8be9
commit 05e6c7b33f
6 changed files with 25 additions and 9 deletions

13
draw.js
View File

@ -170,13 +170,11 @@ var DrawingArea = new Lang.Class({
} }
if (button == 1) { if (button == 1) {
this._startDrawing(x, y, false, shiftPressed); this._startDrawing(x, y, shiftPressed);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else if (button == 2) { } else if (button == 2) {
this.toggleShape(); this.toggleShape();
} else if (button == 3) { } else if (button == 3) {
/*this._startDrawing(x, y, true, shiftPressed);
return Clutter.EVENT_STOP;*/
this.menu.open(x, y); this.menu.open(x, y);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
@ -231,7 +229,7 @@ var DrawingArea = new Lang.Class({
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
}, },
_startDrawing: function(stageX, stageY, fill, eraser) { _startDrawing: function(stageX, stageY, eraser) {
let [success, startX, startY] = this.transform_stage_point(stageX, stageY); let [success, startX, startY] = this.transform_stage_point(stageX, stageY);
if (!success) if (!success)
@ -248,7 +246,7 @@ var DrawingArea = new Lang.Class({
color: this.currentColor.to_string(), color: this.currentColor.to_string(),
line: { lineWidth: this.currentLineWidth, lineJoin: this.currentLineJoin, lineCap: this.currentLineCap }, line: { lineWidth: this.currentLineWidth, lineJoin: this.currentLineJoin, lineCap: this.currentLineCap },
dash: { array: this.dashedLine ? this.dashArray : [0, 0] , offset: this.dashedLine ? this.dashOffset : 0 }, dash: { array: this.dashedLine ? this.dashArray : [0, 0] , offset: this.dashedLine ? this.dashOffset : 0 },
fill: fill, fill: this.fill,
eraser: eraser, eraser: eraser,
transform: { active: false, center: [0, 0], angle: 0, startAngle: 0, ratio: 1 }, transform: { active: false, center: [0, 0], angle: 0, startAngle: 0, ratio: 1 },
text: '', text: '',
@ -424,6 +422,11 @@ var DrawingArea = new Lang.Class({
this.selectShape((this.currentShape == Object.keys(Shapes).length - 1) ? 0 : this.currentShape + 1); this.selectShape((this.currentShape == Object.keys(Shapes).length - 1) ? 0 : this.currentShape + 1);
}, },
toggleFill: function() {
this.fill = !this.fill;
this.emitter.emit('show-osd', this.fill ? _("Fill") : _("Stroke"), null);
},
toggleDash: function() { toggleDash: function() {
this.dashedLine = !this.dashedLine; this.dashedLine = !this.dashedLine;
this.emitter.emit('show-osd', this.dashedLine ? _("Dashed line") : _("Full line"), null); this.emitter.emit('show-osd', this.dashedLine ? _("Dashed line") : _("Full line"), null);

View File

@ -150,6 +150,7 @@ var AreaManager = new Lang.Class({
'toggle-linejoin': this.activeArea.toggleLineJoin.bind(this.activeArea), 'toggle-linejoin': this.activeArea.toggleLineJoin.bind(this.activeArea),
'toggle-linecap': this.activeArea.toggleLineCap.bind(this.activeArea), 'toggle-linecap': this.activeArea.toggleLineCap.bind(this.activeArea),
'toggle-dash' : this.activeArea.toggleDash.bind(this.activeArea), 'toggle-dash' : this.activeArea.toggleDash.bind(this.activeArea),
'toggle-fill' : this.activeArea.toggleFill.bind(this.activeArea),
'select-none-shape': () => this.activeArea.selectShape(Draw.Shapes.NONE), 'select-none-shape': () => this.activeArea.selectShape(Draw.Shapes.NONE),
'select-line-shape': () => this.activeArea.selectShape(Draw.Shapes.LINE), 'select-line-shape': () => this.activeArea.selectShape(Draw.Shapes.LINE),
'select-ellipse-shape': () => this.activeArea.selectShape(Draw.Shapes.ELLIPSE), 'select-ellipse-shape': () => this.activeArea.selectShape(Draw.Shapes.ELLIPSE),

View File

@ -43,6 +43,12 @@ msgstr ""
msgid "Text" msgid "Text"
msgstr "" msgstr ""
msgid "Fill"
msgstr ""
msgid "Stroke"
msgstr ""
msgid "Dashed line" msgid "Dashed line"
msgstr "" msgstr ""
@ -81,9 +87,6 @@ msgstr ""
msgid "Smooth" msgid "Smooth"
msgstr "" msgstr ""
msgid "Fill"
msgstr ""
msgid "Dashed" msgid "Dashed"
msgstr "" msgstr ""
@ -148,6 +151,9 @@ msgstr ""
msgid "Unselect shape (free drawing)" msgid "Unselect shape (free drawing)"
msgstr "" msgstr ""
msgid "Select fill/stroke"
msgstr ""
msgid "Change font family (generic name)" msgid "Change font family (generic name)"
msgstr "" msgstr ""

View File

@ -56,6 +56,7 @@ var INTERNAL_KEYBINDINGS = {
'select-rectangle-shape': "Select rectangle", 'select-rectangle-shape': "Select rectangle",
'select-text-shape': "Select text", 'select-text-shape': "Select text",
'select-none-shape': "Unselect shape (free drawing)", 'select-none-shape': "Unselect shape (free drawing)",
'toggle-fill': "Select fill/stroke",
'-separator-3': '', '-separator-3': '',
'toggle-font-family': "Change font family (generic name)", 'toggle-font-family': "Change font family (generic name)",
'toggle-font-weight': "Change font weight", 'toggle-font-weight': "Change font weight",

Binary file not shown.

View File

@ -117,10 +117,15 @@
<description>toggle linecap</description> <description>toggle linecap</description>
</key> </key>
<key type="as" name="toggle-dash"> <key type="as" name="toggle-dash">
<default>["&lt;Primary&gt;a"]</default> <default>["&lt;Primary&gt;period"]</default>
<summary>toggle dash</summary> <summary>toggle dash</summary>
<description>toggle dash</description> <description>toggle dash</description>
</key> </key>
<key type="as" name="toggle-fill">
<default>["&lt;Primary&gt;a"]</default>
<summary>toggle fill</summary>
<description>toggle fill</description>
</key>
<key type="as" name="select-color1"> <key type="as" name="select-color1">
<default><![CDATA[['<Primary>KP_1','<Primary>1']]]></default> <default><![CDATA[['<Primary>KP_1','<Primary>1']]]></default>
<summary>select color1</summary> <summary>select color1</summary>