-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdropdownlist.js
94 lines (67 loc) · 1.66 KB
/
dropdownlist.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
var element;
var mouseupCallback;
var mousedownCallback;
var mousemoveCallback;
function init()
{
state = "enabled";
element = document.getElementById("canvas");
element.addEventListener("mousedown", mousedown, false);
}
function mousedown(evt)
{
evt.preventDefault();
if(mousedownCallback != undefined) {
mousedownCallback();
}
if(state == "enabled") {
element.setAttribute('viewBox', '0 0 200 100');
element.setAttribute('height', 100);
var backdrop = document.getElementById("backdrop");
console.log(backdrop);
backdrop.setAttribute('y', 485);
console.log(backdrop);
document.addEventListener("mousemove", mousemove, true);
document.addEventListener("mouseup", mouseup, true);
}
}
function mouseup(evt)
{
evt.preventDefault();
if(mouseupCallback != undefined) {
mouseupCallback();
}
element.setAttribute('viewBox', '0 0 200 25');
element.setAttribute('height', 25);
var backdrop = document.getElementById("backdrop");
backdrop.setAttribute('y', 495);
document.removeEventListener("mousemove", mousemove, true);
document.removeEventListener("mouseup", mouseup, true);
}
function mousemove(evt)
{
evt.preventDefault();
if(mousemoveCallback != undefined) {
mousemoveCallback();
}
}
function setText(text)
{
document.getElementById("active_text").textContent = text;
document.getElementById("press_text").textContent = text;
document.getElementById("disabled_text").textContent = text;
}
function getText()
{
return document.getElementById("active_text").textContent;
}
function disable()
{
state = "disabled";
element.viewBox.baseVal.y = 60;
}
function enable()
{
state = "enabled";
element.viewBox.baseVal.y = 0;
}