-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwrap.js
50 lines (47 loc) · 3.13 KB
/
wrap.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
// Wrappanel page
//
exports.View =
{
title: "WrapPanel",
elements:
[
{ control: "stackpanel", orientation: "Vertical", width: "*", height: "*", contents: [
{ control: "stackpanel", orientation: "Horizontal", contents: [
{ control: "button", caption: "Horizontal", binding: { command: "setOrientation", orientation: "Horizontal" } },
{ control: "button", caption: "Vertical", binding: { command: "setOrientation", orientation: "Vertical" } },
] },
//{ control: "wrappanel", width: "*", height: "*", itemHeight: 100, itemWidth: 100, padding: 10, background: "Gray", orientation: "{orientation}", contents: [
{ control: "wrappanel", width: "*", height: "*", padding: 12.5, background: "Gray", orientation: "{orientation}", contents: [
{ control: "rectangle", width: 50, height: 50, margin: 12.5, color: "Green", horizontalAlignment: "{itemHorizontalAlignment}", verticalAlignment: "{itemVerticalAlignment}" },
{ control: "rectangle", width: 75, height: 50, margin: 12.5, color: "Green", horizontalAlignment: "{itemHorizontalAlignment}", verticalAlignment: "{itemVerticalAlignment}" },
{ control: "rectangle", width: 50, height: 75, margin: 12.5, color: "Green", horizontalAlignment: "{itemHorizontalAlignment}", verticalAlignment: "{itemVerticalAlignment}" },
{ control: "rectangle", width: 75, height: 75, margin: 12.5, color: "Green", horizontalAlignment: "{itemHorizontalAlignment}", verticalAlignment: "{itemVerticalAlignment}" },
{ control: "rectangle", width: 25, height: 50, margin: 12.5, color: "Green", horizontalAlignment: "{itemHorizontalAlignment}", verticalAlignment: "{itemVerticalAlignment}" },
{ control: "rectangle", width: 50, height: 50, margin: 12.5, color: "Green", horizontalAlignment: "{itemHorizontalAlignment}", verticalAlignment: "{itemVerticalAlignment}" },
{ control: "rectangle", width: 75, height: 50, margin: 12.5, color: "Green", horizontalAlignment: "{itemHorizontalAlignment}", verticalAlignment: "{itemVerticalAlignment}" },
{ control: "rectangle", width: 50, height: 75, margin: 12.5, color: "Green", horizontalAlignment: "{itemHorizontalAlignment}", verticalAlignment: "{itemVerticalAlignment}" },
{ control: "rectangle", width: 75, height: 75, margin: 12.5, color: "Green", horizontalAlignment: "{itemHorizontalAlignment}", verticalAlignment: "{itemVerticalAlignment}" },
{ control: "rectangle", width: 25, height: 50, margin: 12.5, color: "Green", horizontalAlignment: "{itemHorizontalAlignment}", verticalAlignment: "{itemVerticalAlignment}" },
]
},
]
},
]
}
exports.InitializeViewModel = function (context, session)
{
var viewModel =
{
orientation: "Horizontal",
itemVerticalAlignment: "Center",
itemHorizontalAlignment: "Center",
}
return viewModel;
}
exports.Commands =
{
setOrientation: function(context, session, viewModel, params)
{
viewModel.orientation = params.orientation;
},
}