forked from andrewalbers/CardCreator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal_functions.pde
59 lines (51 loc) · 1.1 KB
/
global_functions.pde
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
55
56
57
58
59
void zoom(float zm)
{
zoom *= zm;
canvas.x += int(25 * ( zm - 1 ));
canvas.y += int(25 * ( zm - 1 ));
canvas.wid = int(canvas.canvasWid * zoom);
canvas.hei = int(canvas.canvasHei * zoom);
constrainOffsets();
}
void constrainOffsets()
{
canvas.x = constrain(canvas.x , int(-0.8 * canvas.wid), width - 50);
canvas.y = constrain(canvas.y , int(-0.8 * canvas.hei), height - 50);
}
void addElement()
{
Element e = new Element("New Element", IMG, 2, 2, 200, 250);
listbox.addItem(e);
content.table.addColumn(e.name);
}
void removeElement()
{
int selectedId = listbox.selectedItem;
if (selectedId != NONE)
{
Element e = listbox.items.get(selectedId);
content.table.removeColumn(e.name);
listbox.removeItem(e);
}
}
public void handleArrowPress( )
{
int selectedId = listbox.selectedItem;
canvas.handleArrowPress( selectedId );
}
public void toggleDrawHighlights()
{
canvas.toggleHighlight();
}
void toggleDrawContent()
{
canvas.toggleContent();
}
void saveTemplate()
{
template.saveTemplate();
}
public void itemClicked ( int i, Object item )
{
lastItemClicked = item;
}