This repository was archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Expand file tree
/
Copy pathFontCommandsManager.js
More file actions
44 lines (36 loc) · 1.42 KB
/
FontCommandsManager.js
File metadata and controls
44 lines (36 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Brackets Themes Copyright (c) 2014 Miguel Castillo.
* @author Brad Gearon
*
* Licensed under MIT
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global $, define, require */
define(function (require) {
"use strict";
var Settings = require("themes/Settings"),
DefaultSettings = require("themes/DefaultSettings"),
ViewCommandHandlers = require("view/ViewCommandHandlers"),
PreferencesManager = require("preferences/PreferencesManager");
function ViewCommandsManager () {
$(ViewCommandHandlers).on("fontSizeChange", updateThemeFontSize);
$(Settings).on("change:fontSize", updateBracketsFontSize);
updateBracketsFontSize();
}
function updateThemeFontSize (evt, adjustment, fontSize /*, lineHeight*/) {
Settings.setValue("fontSize", fontSize);
}
function updateBracketsFontSize() {
var fontSize = Settings.getValue("fontSize"),
fontSizeNumeric = Number(fontSize.replace(/px|em/, "")),
fontSizeOffset = fontSizeNumeric - DefaultSettings.fontSize;
if(!isNaN(fontSizeOffset)) {
PreferencesManager.setViewState("fontSizeAdjustment", fontSizeOffset);
PreferencesManager.setViewState("fontSizeStyle", fontSize);
}
}
// Let's make sure we use Themes fonts by default
return {
init: ViewCommandsManager
};
});