vis-rails 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vis/rails/version.rb +1 -1
- data/vendor/assets/javascripts/vis.js +26 -26
- metadata +16 -85
- data/vendor/assets/vis/DataSet.js +0 -926
- data/vendor/assets/vis/DataView.js +0 -283
- data/vendor/assets/vis/graph/Edge.js +0 -957
- data/vendor/assets/vis/graph/Graph.js +0 -2291
- data/vendor/assets/vis/graph/Groups.js +0 -80
- data/vendor/assets/vis/graph/Images.js +0 -41
- data/vendor/assets/vis/graph/Node.js +0 -966
- data/vendor/assets/vis/graph/Popup.js +0 -132
- data/vendor/assets/vis/graph/css/graph-manipulation.css +0 -128
- data/vendor/assets/vis/graph/css/graph-navigation.css +0 -66
- data/vendor/assets/vis/graph/dotparser.js +0 -829
- data/vendor/assets/vis/graph/graphMixins/ClusterMixin.js +0 -1143
- data/vendor/assets/vis/graph/graphMixins/HierarchicalLayoutMixin.js +0 -311
- data/vendor/assets/vis/graph/graphMixins/ManipulationMixin.js +0 -576
- data/vendor/assets/vis/graph/graphMixins/MixinLoader.js +0 -199
- data/vendor/assets/vis/graph/graphMixins/NavigationMixin.js +0 -205
- data/vendor/assets/vis/graph/graphMixins/SectorsMixin.js +0 -552
- data/vendor/assets/vis/graph/graphMixins/SelectionMixin.js +0 -648
- data/vendor/assets/vis/graph/graphMixins/physics/BarnesHut.js +0 -398
- data/vendor/assets/vis/graph/graphMixins/physics/HierarchialRepulsion.js +0 -64
- data/vendor/assets/vis/graph/graphMixins/physics/PhysicsMixin.js +0 -697
- data/vendor/assets/vis/graph/graphMixins/physics/Repulsion.js +0 -66
- data/vendor/assets/vis/graph/img/acceptDeleteIcon.png +0 -0
- data/vendor/assets/vis/graph/img/addNodeIcon.png +0 -0
- data/vendor/assets/vis/graph/img/backIcon.png +0 -0
- data/vendor/assets/vis/graph/img/connectIcon.png +0 -0
- data/vendor/assets/vis/graph/img/cross.png +0 -0
- data/vendor/assets/vis/graph/img/cross2.png +0 -0
- data/vendor/assets/vis/graph/img/deleteIcon.png +0 -0
- data/vendor/assets/vis/graph/img/downArrow.png +0 -0
- data/vendor/assets/vis/graph/img/editIcon.png +0 -0
- data/vendor/assets/vis/graph/img/leftArrow.png +0 -0
- data/vendor/assets/vis/graph/img/minus.png +0 -0
- data/vendor/assets/vis/graph/img/plus.png +0 -0
- data/vendor/assets/vis/graph/img/rightArrow.png +0 -0
- data/vendor/assets/vis/graph/img/upArrow.png +0 -0
- data/vendor/assets/vis/graph/img/zoomExtends.png +0 -0
- data/vendor/assets/vis/graph/shapes.js +0 -225
- data/vendor/assets/vis/graph3d/Graph3d.js +0 -3306
- data/vendor/assets/vis/module/exports.js +0 -65
- data/vendor/assets/vis/module/header.js +0 -24
- data/vendor/assets/vis/module/imports.js +0 -31
- data/vendor/assets/vis/shim.js +0 -252
- data/vendor/assets/vis/timeline/Range.js +0 -532
- data/vendor/assets/vis/timeline/TimeStep.js +0 -466
- data/vendor/assets/vis/timeline/Timeline.js +0 -851
- data/vendor/assets/vis/timeline/component/Component.js +0 -52
- data/vendor/assets/vis/timeline/component/CurrentTime.js +0 -128
- data/vendor/assets/vis/timeline/component/CustomTime.js +0 -182
- data/vendor/assets/vis/timeline/component/Group.js +0 -470
- data/vendor/assets/vis/timeline/component/ItemSet.js +0 -1332
- data/vendor/assets/vis/timeline/component/TimeAxis.js +0 -389
- data/vendor/assets/vis/timeline/component/css/animation.css +0 -33
- data/vendor/assets/vis/timeline/component/css/currenttime.css +0 -5
- data/vendor/assets/vis/timeline/component/css/customtime.css +0 -6
- data/vendor/assets/vis/timeline/component/css/item.css +0 -107
- data/vendor/assets/vis/timeline/component/css/itemset.css +0 -33
- data/vendor/assets/vis/timeline/component/css/labelset.css +0 -36
- data/vendor/assets/vis/timeline/component/css/panel.css +0 -71
- data/vendor/assets/vis/timeline/component/css/timeaxis.css +0 -48
- data/vendor/assets/vis/timeline/component/css/timeline.css +0 -2
- data/vendor/assets/vis/timeline/component/item/Item.js +0 -139
- data/vendor/assets/vis/timeline/component/item/ItemBox.js +0 -230
- data/vendor/assets/vis/timeline/component/item/ItemPoint.js +0 -190
- data/vendor/assets/vis/timeline/component/item/ItemRange.js +0 -262
- data/vendor/assets/vis/timeline/component/item/ItemRangeOverflow.js +0 -57
- data/vendor/assets/vis/timeline/img/delete.png +0 -0
- data/vendor/assets/vis/timeline/stack.js +0 -112
- data/vendor/assets/vis/util.js +0 -990
@@ -1,33 +0,0 @@
|
|
1
|
-
|
2
|
-
.vis.timeline .itemset {
|
3
|
-
position: relative;
|
4
|
-
padding: 0;
|
5
|
-
margin: 0;
|
6
|
-
|
7
|
-
box-sizing: border-box;
|
8
|
-
}
|
9
|
-
|
10
|
-
.vis.timeline .itemset .background,
|
11
|
-
.vis.timeline .itemset .foreground {
|
12
|
-
position: absolute;
|
13
|
-
width: 100%;
|
14
|
-
height: 100%;
|
15
|
-
}
|
16
|
-
|
17
|
-
.vis.timeline .axis {
|
18
|
-
position: absolute;
|
19
|
-
width: 100%;
|
20
|
-
height: 0;
|
21
|
-
left: 1px;
|
22
|
-
z-index: 1;
|
23
|
-
}
|
24
|
-
|
25
|
-
.vis.timeline .foreground .group {
|
26
|
-
position: relative;
|
27
|
-
box-sizing: border-box;
|
28
|
-
border-bottom: 1px solid #bfbfbf;
|
29
|
-
}
|
30
|
-
|
31
|
-
.vis.timeline .foreground .group:last-child {
|
32
|
-
border-bottom: none;
|
33
|
-
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
|
2
|
-
.vis.timeline .labelset {
|
3
|
-
position: relative;
|
4
|
-
width: 100%;
|
5
|
-
|
6
|
-
overflow: hidden;
|
7
|
-
|
8
|
-
box-sizing: border-box;
|
9
|
-
}
|
10
|
-
|
11
|
-
.vis.timeline .labelset .vlabel {
|
12
|
-
position: relative;
|
13
|
-
left: 0;
|
14
|
-
top: 0;
|
15
|
-
width: 100%;
|
16
|
-
color: #4d4d4d;
|
17
|
-
|
18
|
-
box-sizing: border-box;
|
19
|
-
}
|
20
|
-
|
21
|
-
.vis.timeline .labelset .vlabel {
|
22
|
-
border-bottom: 1px solid #bfbfbf;
|
23
|
-
}
|
24
|
-
|
25
|
-
.vis.timeline .labelset .vlabel:last-child {
|
26
|
-
border-bottom: none;
|
27
|
-
}
|
28
|
-
|
29
|
-
.vis.timeline .labelset .vlabel .inner {
|
30
|
-
display: inline-block;
|
31
|
-
padding: 5px;
|
32
|
-
}
|
33
|
-
|
34
|
-
.vis.timeline .labelset .vlabel .inner.hidden {
|
35
|
-
padding: 0;
|
36
|
-
}
|
@@ -1,71 +0,0 @@
|
|
1
|
-
|
2
|
-
.vis.timeline.root {
|
3
|
-
position: relative;
|
4
|
-
border: 1px solid #bfbfbf;
|
5
|
-
|
6
|
-
overflow: hidden;
|
7
|
-
padding: 0;
|
8
|
-
margin: 0;
|
9
|
-
|
10
|
-
box-sizing: border-box;
|
11
|
-
}
|
12
|
-
|
13
|
-
.vis.timeline .vispanel {
|
14
|
-
position: absolute;
|
15
|
-
|
16
|
-
padding: 0;
|
17
|
-
margin: 0;
|
18
|
-
|
19
|
-
box-sizing: border-box;
|
20
|
-
}
|
21
|
-
|
22
|
-
.vis.timeline .vispanel.center,
|
23
|
-
.vis.timeline .vispanel.left,
|
24
|
-
.vis.timeline .vispanel.right,
|
25
|
-
.vis.timeline .vispanel.top,
|
26
|
-
.vis.timeline .vispanel.bottom {
|
27
|
-
border: 1px #bfbfbf;
|
28
|
-
}
|
29
|
-
|
30
|
-
.vis.timeline .vispanel.center,
|
31
|
-
.vis.timeline .vispanel.left,
|
32
|
-
.vis.timeline .vispanel.right {
|
33
|
-
border-top-style: solid;
|
34
|
-
border-bottom-style: solid;
|
35
|
-
overflow: hidden;
|
36
|
-
}
|
37
|
-
|
38
|
-
.vis.timeline .vispanel.center,
|
39
|
-
.vis.timeline .vispanel.top,
|
40
|
-
.vis.timeline .vispanel.bottom {
|
41
|
-
border-left-style: solid;
|
42
|
-
border-right-style: solid;
|
43
|
-
}
|
44
|
-
|
45
|
-
.vis.timeline .background {
|
46
|
-
overflow: hidden;
|
47
|
-
}
|
48
|
-
|
49
|
-
.vis.timeline .vispanel > .content {
|
50
|
-
position: relative;
|
51
|
-
}
|
52
|
-
|
53
|
-
.vis.timeline .vispanel .shadow {
|
54
|
-
position: absolute;
|
55
|
-
width: 100%;
|
56
|
-
height: 1px;
|
57
|
-
box-shadow: 0 0 10px rgba(0,0,0,0.8);
|
58
|
-
/* TODO: find a nice way to ensure shadows are drawn on top of items
|
59
|
-
z-index: 1;
|
60
|
-
*/
|
61
|
-
}
|
62
|
-
|
63
|
-
.vis.timeline .vispanel .shadow.top {
|
64
|
-
top: -1px;
|
65
|
-
left: 0;
|
66
|
-
}
|
67
|
-
|
68
|
-
.vis.timeline .vispanel .shadow.bottom {
|
69
|
-
bottom: -1px;
|
70
|
-
left: 0;
|
71
|
-
}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
.vis.timeline .timeaxis {
|
2
|
-
position: relative;
|
3
|
-
overflow: hidden;
|
4
|
-
}
|
5
|
-
|
6
|
-
.vis.timeline .timeaxis.foreground {
|
7
|
-
top: 0;
|
8
|
-
left: 0;
|
9
|
-
width: 100%;
|
10
|
-
}
|
11
|
-
|
12
|
-
.vis.timeline .timeaxis.background {
|
13
|
-
position: absolute;
|
14
|
-
top: 0;
|
15
|
-
left: 0;
|
16
|
-
width: 100%;
|
17
|
-
height: 100%;
|
18
|
-
}
|
19
|
-
|
20
|
-
.vis.timeline .timeaxis .text {
|
21
|
-
position: absolute;
|
22
|
-
color: #4d4d4d;
|
23
|
-
padding: 3px;
|
24
|
-
white-space: nowrap;
|
25
|
-
}
|
26
|
-
|
27
|
-
.vis.timeline .timeaxis .text.measure {
|
28
|
-
position: absolute;
|
29
|
-
padding-left: 0;
|
30
|
-
padding-right: 0;
|
31
|
-
margin-left: 0;
|
32
|
-
margin-right: 0;
|
33
|
-
visibility: hidden;
|
34
|
-
}
|
35
|
-
|
36
|
-
.vis.timeline .timeaxis .grid.vertical {
|
37
|
-
position: absolute;
|
38
|
-
width: 0;
|
39
|
-
border-right: 1px solid;
|
40
|
-
}
|
41
|
-
|
42
|
-
.vis.timeline .timeaxis .grid.minor {
|
43
|
-
border-color: #e5e5e5;
|
44
|
-
}
|
45
|
-
|
46
|
-
.vis.timeline .timeaxis .grid.major {
|
47
|
-
border-color: #bfbfbf;
|
48
|
-
}
|
@@ -1,139 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @constructor Item
|
3
|
-
* @param {Object} data Object containing (optional) parameters type,
|
4
|
-
* start, end, content, group, className.
|
5
|
-
* @param {{toScreen: function, toTime: function}} conversion
|
6
|
-
* Conversion functions from time to screen and vice versa
|
7
|
-
* @param {Object} options Configuration options
|
8
|
-
* // TODO: describe available options
|
9
|
-
*/
|
10
|
-
function Item (data, conversion, options) {
|
11
|
-
this.id = null;
|
12
|
-
this.parent = null;
|
13
|
-
this.data = data;
|
14
|
-
this.dom = null;
|
15
|
-
this.conversion = conversion || {};
|
16
|
-
this.options = options || {};
|
17
|
-
|
18
|
-
this.selected = false;
|
19
|
-
this.displayed = false;
|
20
|
-
this.dirty = true;
|
21
|
-
|
22
|
-
this.top = null;
|
23
|
-
this.left = null;
|
24
|
-
this.width = null;
|
25
|
-
this.height = null;
|
26
|
-
}
|
27
|
-
|
28
|
-
/**
|
29
|
-
* Select current item
|
30
|
-
*/
|
31
|
-
Item.prototype.select = function() {
|
32
|
-
this.selected = true;
|
33
|
-
if (this.displayed) this.redraw();
|
34
|
-
};
|
35
|
-
|
36
|
-
/**
|
37
|
-
* Unselect current item
|
38
|
-
*/
|
39
|
-
Item.prototype.unselect = function() {
|
40
|
-
this.selected = false;
|
41
|
-
if (this.displayed) this.redraw();
|
42
|
-
};
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Set a parent for the item
|
46
|
-
* @param {ItemSet | Group} parent
|
47
|
-
*/
|
48
|
-
Item.prototype.setParent = function(parent) {
|
49
|
-
if (this.displayed) {
|
50
|
-
this.hide();
|
51
|
-
this.parent = parent;
|
52
|
-
if (this.parent) {
|
53
|
-
this.show();
|
54
|
-
}
|
55
|
-
}
|
56
|
-
else {
|
57
|
-
this.parent = parent;
|
58
|
-
}
|
59
|
-
};
|
60
|
-
|
61
|
-
/**
|
62
|
-
* Check whether this item is visible inside given range
|
63
|
-
* @returns {{start: Number, end: Number}} range with a timestamp for start and end
|
64
|
-
* @returns {boolean} True if visible
|
65
|
-
*/
|
66
|
-
Item.prototype.isVisible = function(range) {
|
67
|
-
// Should be implemented by Item implementations
|
68
|
-
return false;
|
69
|
-
};
|
70
|
-
|
71
|
-
/**
|
72
|
-
* Show the Item in the DOM (when not already visible)
|
73
|
-
* @return {Boolean} changed
|
74
|
-
*/
|
75
|
-
Item.prototype.show = function() {
|
76
|
-
return false;
|
77
|
-
};
|
78
|
-
|
79
|
-
/**
|
80
|
-
* Hide the Item from the DOM (when visible)
|
81
|
-
* @return {Boolean} changed
|
82
|
-
*/
|
83
|
-
Item.prototype.hide = function() {
|
84
|
-
return false;
|
85
|
-
};
|
86
|
-
|
87
|
-
/**
|
88
|
-
* Repaint the item
|
89
|
-
*/
|
90
|
-
Item.prototype.redraw = function() {
|
91
|
-
// should be implemented by the item
|
92
|
-
};
|
93
|
-
|
94
|
-
/**
|
95
|
-
* Reposition the Item horizontally
|
96
|
-
*/
|
97
|
-
Item.prototype.repositionX = function() {
|
98
|
-
// should be implemented by the item
|
99
|
-
};
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Reposition the Item vertically
|
103
|
-
*/
|
104
|
-
Item.prototype.repositionY = function() {
|
105
|
-
// should be implemented by the item
|
106
|
-
};
|
107
|
-
|
108
|
-
/**
|
109
|
-
* Repaint a delete button on the top right of the item when the item is selected
|
110
|
-
* @param {HTMLElement} anchor
|
111
|
-
* @protected
|
112
|
-
*/
|
113
|
-
Item.prototype._repaintDeleteButton = function (anchor) {
|
114
|
-
if (this.selected && this.options.editable.remove && !this.dom.deleteButton) {
|
115
|
-
// create and show button
|
116
|
-
var me = this;
|
117
|
-
|
118
|
-
var deleteButton = document.createElement('div');
|
119
|
-
deleteButton.className = 'delete';
|
120
|
-
deleteButton.title = 'Delete this item';
|
121
|
-
|
122
|
-
Hammer(deleteButton, {
|
123
|
-
preventDefault: true
|
124
|
-
}).on('tap', function (event) {
|
125
|
-
me.parent.removeFromDataSet(me);
|
126
|
-
event.stopPropagation();
|
127
|
-
});
|
128
|
-
|
129
|
-
anchor.appendChild(deleteButton);
|
130
|
-
this.dom.deleteButton = deleteButton;
|
131
|
-
}
|
132
|
-
else if (!this.selected && this.dom.deleteButton) {
|
133
|
-
// remove button
|
134
|
-
if (this.dom.deleteButton.parentNode) {
|
135
|
-
this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton);
|
136
|
-
}
|
137
|
-
this.dom.deleteButton = null;
|
138
|
-
}
|
139
|
-
};
|
@@ -1,230 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @constructor ItemBox
|
3
|
-
* @extends Item
|
4
|
-
* @param {Object} data Object containing parameters start
|
5
|
-
* content, className.
|
6
|
-
* @param {{toScreen: function, toTime: function}} conversion
|
7
|
-
* Conversion functions from time to screen and vice versa
|
8
|
-
* @param {Object} [options] Configuration options
|
9
|
-
* // TODO: describe available options
|
10
|
-
*/
|
11
|
-
function ItemBox (data, conversion, options) {
|
12
|
-
this.props = {
|
13
|
-
dot: {
|
14
|
-
width: 0,
|
15
|
-
height: 0
|
16
|
-
},
|
17
|
-
line: {
|
18
|
-
width: 0,
|
19
|
-
height: 0
|
20
|
-
}
|
21
|
-
};
|
22
|
-
|
23
|
-
// validate data
|
24
|
-
if (data) {
|
25
|
-
if (data.start == undefined) {
|
26
|
-
throw new Error('Property "start" missing in item ' + data);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
Item.call(this, data, conversion, options);
|
31
|
-
}
|
32
|
-
|
33
|
-
ItemBox.prototype = new Item (null, null, null);
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Check whether this item is visible inside given range
|
37
|
-
* @returns {{start: Number, end: Number}} range with a timestamp for start and end
|
38
|
-
* @returns {boolean} True if visible
|
39
|
-
*/
|
40
|
-
ItemBox.prototype.isVisible = function(range) {
|
41
|
-
// determine visibility
|
42
|
-
// TODO: account for the real width of the item. Right now we just add 1/4 to the window
|
43
|
-
var interval = (range.end - range.start) / 4;
|
44
|
-
return (this.data.start > range.start - interval) && (this.data.start < range.end + interval);
|
45
|
-
};
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Repaint the item
|
49
|
-
*/
|
50
|
-
ItemBox.prototype.redraw = function() {
|
51
|
-
var dom = this.dom;
|
52
|
-
if (!dom) {
|
53
|
-
// create DOM
|
54
|
-
this.dom = {};
|
55
|
-
dom = this.dom;
|
56
|
-
|
57
|
-
// create main box
|
58
|
-
dom.box = document.createElement('DIV');
|
59
|
-
|
60
|
-
// contents box (inside the background box). used for making margins
|
61
|
-
dom.content = document.createElement('DIV');
|
62
|
-
dom.content.className = 'content';
|
63
|
-
dom.box.appendChild(dom.content);
|
64
|
-
|
65
|
-
// line to axis
|
66
|
-
dom.line = document.createElement('DIV');
|
67
|
-
dom.line.className = 'line';
|
68
|
-
|
69
|
-
// dot on axis
|
70
|
-
dom.dot = document.createElement('DIV');
|
71
|
-
dom.dot.className = 'dot';
|
72
|
-
|
73
|
-
// attach this item as attribute
|
74
|
-
dom.box['timeline-item'] = this;
|
75
|
-
}
|
76
|
-
|
77
|
-
// append DOM to parent DOM
|
78
|
-
if (!this.parent) {
|
79
|
-
throw new Error('Cannot redraw item: no parent attached');
|
80
|
-
}
|
81
|
-
if (!dom.box.parentNode) {
|
82
|
-
var foreground = this.parent.dom.foreground;
|
83
|
-
if (!foreground) throw new Error('Cannot redraw time axis: parent has no foreground container element');
|
84
|
-
foreground.appendChild(dom.box);
|
85
|
-
}
|
86
|
-
if (!dom.line.parentNode) {
|
87
|
-
var background = this.parent.dom.background;
|
88
|
-
if (!background) throw new Error('Cannot redraw time axis: parent has no background container element');
|
89
|
-
background.appendChild(dom.line);
|
90
|
-
}
|
91
|
-
if (!dom.dot.parentNode) {
|
92
|
-
var axis = this.parent.dom.axis;
|
93
|
-
if (!background) throw new Error('Cannot redraw time axis: parent has no axis container element');
|
94
|
-
axis.appendChild(dom.dot);
|
95
|
-
}
|
96
|
-
this.displayed = true;
|
97
|
-
|
98
|
-
// update contents
|
99
|
-
if (this.data.content != this.content) {
|
100
|
-
this.content = this.data.content;
|
101
|
-
if (this.content instanceof Element) {
|
102
|
-
dom.content.innerHTML = '';
|
103
|
-
dom.content.appendChild(this.content);
|
104
|
-
}
|
105
|
-
else if (this.data.content != undefined) {
|
106
|
-
dom.content.innerHTML = this.content;
|
107
|
-
}
|
108
|
-
else {
|
109
|
-
throw new Error('Property "content" missing in item ' + this.data.id);
|
110
|
-
}
|
111
|
-
|
112
|
-
this.dirty = true;
|
113
|
-
}
|
114
|
-
|
115
|
-
// update class
|
116
|
-
var className = (this.data.className? ' ' + this.data.className : '') +
|
117
|
-
(this.selected ? ' selected' : '');
|
118
|
-
if (this.className != className) {
|
119
|
-
this.className = className;
|
120
|
-
dom.box.className = 'item box' + className;
|
121
|
-
dom.line.className = 'item line' + className;
|
122
|
-
dom.dot.className = 'item dot' + className;
|
123
|
-
|
124
|
-
this.dirty = true;
|
125
|
-
}
|
126
|
-
|
127
|
-
// recalculate size
|
128
|
-
if (this.dirty) {
|
129
|
-
this.props.dot.height = dom.dot.offsetHeight;
|
130
|
-
this.props.dot.width = dom.dot.offsetWidth;
|
131
|
-
this.props.line.width = dom.line.offsetWidth;
|
132
|
-
this.width = dom.box.offsetWidth;
|
133
|
-
this.height = dom.box.offsetHeight;
|
134
|
-
|
135
|
-
this.dirty = false;
|
136
|
-
}
|
137
|
-
|
138
|
-
this._repaintDeleteButton(dom.box);
|
139
|
-
};
|
140
|
-
|
141
|
-
/**
|
142
|
-
* Show the item in the DOM (when not already displayed). The items DOM will
|
143
|
-
* be created when needed.
|
144
|
-
*/
|
145
|
-
ItemBox.prototype.show = function() {
|
146
|
-
if (!this.displayed) {
|
147
|
-
this.redraw();
|
148
|
-
}
|
149
|
-
};
|
150
|
-
|
151
|
-
/**
|
152
|
-
* Hide the item from the DOM (when visible)
|
153
|
-
*/
|
154
|
-
ItemBox.prototype.hide = function() {
|
155
|
-
if (this.displayed) {
|
156
|
-
var dom = this.dom;
|
157
|
-
|
158
|
-
if (dom.box.parentNode) dom.box.parentNode.removeChild(dom.box);
|
159
|
-
if (dom.line.parentNode) dom.line.parentNode.removeChild(dom.line);
|
160
|
-
if (dom.dot.parentNode) dom.dot.parentNode.removeChild(dom.dot);
|
161
|
-
|
162
|
-
this.top = null;
|
163
|
-
this.left = null;
|
164
|
-
|
165
|
-
this.displayed = false;
|
166
|
-
}
|
167
|
-
};
|
168
|
-
|
169
|
-
/**
|
170
|
-
* Reposition the item horizontally
|
171
|
-
* @Override
|
172
|
-
*/
|
173
|
-
ItemBox.prototype.repositionX = function() {
|
174
|
-
var start = this.conversion.toScreen(this.data.start),
|
175
|
-
align = this.options.align,
|
176
|
-
left,
|
177
|
-
box = this.dom.box,
|
178
|
-
line = this.dom.line,
|
179
|
-
dot = this.dom.dot;
|
180
|
-
|
181
|
-
// calculate left position of the box
|
182
|
-
if (align == 'right') {
|
183
|
-
this.left = start - this.width;
|
184
|
-
}
|
185
|
-
else if (align == 'left') {
|
186
|
-
this.left = start;
|
187
|
-
}
|
188
|
-
else {
|
189
|
-
// default or 'center'
|
190
|
-
this.left = start - this.width / 2;
|
191
|
-
}
|
192
|
-
|
193
|
-
// reposition box
|
194
|
-
box.style.left = this.left + 'px';
|
195
|
-
|
196
|
-
// reposition line
|
197
|
-
line.style.left = (start - this.props.line.width / 2) + 'px';
|
198
|
-
|
199
|
-
// reposition dot
|
200
|
-
dot.style.left = (start - this.props.dot.width / 2) + 'px';
|
201
|
-
};
|
202
|
-
|
203
|
-
/**
|
204
|
-
* Reposition the item vertically
|
205
|
-
* @Override
|
206
|
-
*/
|
207
|
-
ItemBox.prototype.repositionY = function() {
|
208
|
-
var orientation = this.options.orientation,
|
209
|
-
box = this.dom.box,
|
210
|
-
line = this.dom.line,
|
211
|
-
dot = this.dom.dot;
|
212
|
-
|
213
|
-
if (orientation == 'top') {
|
214
|
-
box.style.top = (this.top || 0) + 'px';
|
215
|
-
|
216
|
-
line.style.top = '0';
|
217
|
-
line.style.height = (this.parent.top + this.top + 1) + 'px';
|
218
|
-
line.style.bottom = '';
|
219
|
-
}
|
220
|
-
else { // orientation 'bottom'
|
221
|
-
var itemSetHeight = this.parent.itemSet.props.height; // TODO: this is nasty
|
222
|
-
var lineHeight = itemSetHeight - this.parent.top - this.parent.height + this.top;
|
223
|
-
|
224
|
-
box.style.top = (this.parent.height - this.top - this.height || 0) + 'px';
|
225
|
-
line.style.top = (itemSetHeight - lineHeight) + 'px';
|
226
|
-
line.style.bottom = '0';
|
227
|
-
}
|
228
|
-
|
229
|
-
dot.style.top = (-this.props.dot.height / 2) + 'px';
|
230
|
-
};
|