Add font family reversed switching
This commit is contained in:
parent
39ec1ba888
commit
a1ce4aaf79
7
area.js
7
area.js
|
|
@ -930,9 +930,12 @@ var DrawingArea = new Lang.Class({
|
|||
`${_(FontStyleNames[this.currentFontStyle])}</span>`, "", -1, false);
|
||||
},
|
||||
|
||||
switchFontFamily: function() {
|
||||
switchFontFamily: function(reverse) {
|
||||
let index = Math.max(0, this.fontFamilies.indexOf(this.currentFontFamily));
|
||||
this.currentFontFamily = (index == this.fontFamilies.length - 1) ? 0 : this.fontFamilies[index + 1];
|
||||
if (reverse)
|
||||
this.currentFontFamily = (index == 0) ? this.fontFamilies[this.fontFamilies.length - 1] : this.fontFamilies[index - 1];
|
||||
else
|
||||
this.currentFontFamily = (index == this.fontFamilies.length - 1) ? this.fontFamilies[0] : this.fontFamilies[index + 1];
|
||||
if (this.currentElement && this.currentElement.font) {
|
||||
this.currentElement.font.family = this.currentFontFamily;
|
||||
this._redisplay();
|
||||
|
|
|
|||
|
|
@ -215,7 +215,8 @@ var AreaManager = new Lang.Class({
|
|||
'toggle-background': this.activeArea.toggleBackground.bind(this.activeArea),
|
||||
'toggle-grid': this.activeArea.toggleGrid.bind(this.activeArea),
|
||||
'toggle-square-area': this.activeArea.toggleSquareArea.bind(this.activeArea),
|
||||
'switch-font-family': this.activeArea.switchFontFamily.bind(this.activeArea),
|
||||
'reverse-switch-font-family': this.activeArea.switchFontFamily.bind(this.activeArea, true),
|
||||
'switch-font-family': this.activeArea.switchFontFamily.bind(this.activeArea, false),
|
||||
'switch-font-weight': this.activeArea.switchFontWeight.bind(this.activeArea),
|
||||
'switch-font-style': this.activeArea.switchFontStyle.bind(this.activeArea),
|
||||
'switch-text-alignment': this.activeArea.switchTextAlignment.bind(this.activeArea),
|
||||
|
|
|
|||
|
|
@ -218,7 +218,10 @@ msgstr ""
|
|||
msgid "Toggle fill rule"
|
||||
msgstr ""
|
||||
|
||||
msgid "Change font family (generic name)"
|
||||
msgid "Change font family"
|
||||
msgstr ""
|
||||
|
||||
msgid "Change font family (reverse)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Change font weight"
|
||||
|
|
|
|||
3
prefs.js
3
prefs.js
|
|
@ -70,7 +70,8 @@ var INTERNAL_KEYBINDINGS = {
|
|||
'switch-linecap': "Change linecap",
|
||||
'switch-dash': "Dashed line",
|
||||
'-separator-4': '',
|
||||
'switch-font-family': "Change font family (generic name)",
|
||||
'switch-font-family': "Change font family",
|
||||
'reverse-switch-font-family': "Change font family (reverse)",
|
||||
'switch-font-weight': "Change font weight",
|
||||
'switch-font-style': "Change font style",
|
||||
'switch-text-alignment': "Toggle text alignment",
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -226,6 +226,11 @@
|
|||
<summary>switch font family</summary>
|
||||
<description>switch font family</description>
|
||||
</key>
|
||||
<key type="as" name="reverse-switch-font-family">
|
||||
<default>["<Primary><Shift>f"]</default>
|
||||
<summary>switch font family (reverse)</summary>
|
||||
<description>switch font family (reverse)</description>
|
||||
</key>
|
||||
<key type="as" name="switch-font-weight">
|
||||
<default>["<Primary>w"]</default>
|
||||
<summary>switch font weight</summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue