-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfont.js
54 lines (48 loc) · 1.81 KB
/
font.js
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
45
46
47
48
49
50
51
52
53
54
// Font page
//
exports.View =
{
title: "Font",
elements:
[
{ control: "stackpanel", orientation: "Horizontal", contents: [
{ control: "button", width: 150, caption: "San Serif", binding: { command: "setFace", face: "SanSerif" } },
{ control: "button", width: 130, caption: "Serif", binding: { command: "setFace", face: "Serif" } },
{ control: "button", width: 170, caption: "Monospace", binding: { command: "setFace", face: "Monospace" } },
] },
{ control: "stackpanel", orientation: "Horizontal", contents: [
{ control: "text", value: "Size", fontsize: 10, width: 140 },
{ control: "slider", minimum: 10, maximum: 50, binding: "currFont.size", width: 300 },
] },
{ control: "stackpanel", orientation: "Horizontal", contents: [
{ control: "text", value: "Bold", fontsize: 10, width: 140 },
{ control: "toggle", binding: "currFont.bold", fontsize: 12 },
] },
{ control: "stackpanel", orientation: "Horizontal", contents: [
{ control: "text", value: "Italic", fontsize: 10, width: 140 },
{ control: "toggle", binding: "currFont.italic", fontsize: 12 },
] },
{ control: "text", value: "Testing {currFont.face}", width: "*", font: { face: "{currFont.face}", size: "{currFont.size}", bold: "{currFont.bold}", italic: "{currFont.italic}" } },
]
}
exports.InitializeViewModel = function(context, session)
{
var viewModel =
{
currFont:
{
face: "Monospace",
size: 24,
bold: false,
italic: false,
},
}
return viewModel;
}
exports.Commands =
{
setFace: function(context, session, viewModel, params)
{
viewModel.currFont.face = params.face;
},
}