inviton-powerduck 0.0.224 → 0.0.225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/css/ladda-themeless-zoomin.min.css +89 -89
- package/common/query-string-utils.ts +67 -0
- package/components/chart-js/thirdparty/flot/jquery.flot.categories.min.js +93 -93
- package/components/chart-js/thirdparty/flot/jquery.flot.crosshair.min.js +83 -83
- package/components/chart-js/thirdparty/flot/jquery.flot.navigate.min.js +270 -270
- package/components/chart-js/thirdparty/flot/jquery.flot.pie.min.js +507 -507
- package/components/chart-js/thirdparty/flot/jquery.flot.stack.min.js +104 -104
- package/components/image-crop/vendor/jquery.Jcrop.min.css +344 -344
- package/components/svg/skilift-svg.tsx +6 -6
- package/package.json +1 -1
|
@@ -1,270 +1,270 @@
|
|
|
1
|
-
/* Javascript plotting library for jQuery, version 0.8.3.
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
|
4
|
-
Licensed under the MIT license.
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
(function (a) {
|
|
8
|
-
function e(h) {
|
|
9
|
-
var k,
|
|
10
|
-
j = this,
|
|
11
|
-
l = h.data || {};
|
|
12
|
-
if (l.elem)
|
|
13
|
-
(j = h.dragTarget = l.elem),
|
|
14
|
-
(h.dragProxy = d.proxy || j),
|
|
15
|
-
(h.cursorOffsetX = l.pageX - l.left),
|
|
16
|
-
(h.cursorOffsetY = l.pageY - l.top),
|
|
17
|
-
(h.offsetX = h.pageX - h.cursorOffsetX),
|
|
18
|
-
(h.offsetY = h.pageY - h.cursorOffsetY);
|
|
19
|
-
else if (d.dragging || (l.which > 0 && h.which != l.which) || a(h.target).is(l.not)) return;
|
|
20
|
-
switch (h.type) {
|
|
21
|
-
case "mousedown":
|
|
22
|
-
return a.extend(l, a(j).offset(), { elem: j, target: h.target, pageX: h.pageX, pageY: h.pageY }), b.add(document, "mousemove mouseup", e, l), i(j, !1), (d.dragging = null), !1;
|
|
23
|
-
case !d.dragging && "mousemove":
|
|
24
|
-
if (g(h.pageX - l.pageX) + g(h.pageY - l.pageY) < l.distance) break;
|
|
25
|
-
(h.target = l.target), (k = f(h, "dragstart", j)), k !== !1 && ((d.dragging = j), (d.proxy = h.dragProxy = a(k || j)[0]));
|
|
26
|
-
case "mousemove":
|
|
27
|
-
if (d.dragging) {
|
|
28
|
-
if (((k = f(h, "drag", j)), c.drop && ((c.drop.allowed = k !== !1), c.drop.handler(h)), k !== !1)) break;
|
|
29
|
-
h.type = "mouseup";
|
|
30
|
-
}
|
|
31
|
-
case "mouseup":
|
|
32
|
-
b.remove(document, "mousemove mouseup", e), d.dragging && (c.drop && c.drop.handler(h), f(h, "dragend", j)), i(j, !0), (d.dragging = d.proxy = l.elem = !1);
|
|
33
|
-
}
|
|
34
|
-
return !0;
|
|
35
|
-
}
|
|
36
|
-
function f(b, c, d) {
|
|
37
|
-
b.type = c;
|
|
38
|
-
var e = a.event.dispatch.call(d, b);
|
|
39
|
-
return e === !1 ? !1 : e || b.result;
|
|
40
|
-
}
|
|
41
|
-
function g(a) {
|
|
42
|
-
return Math.pow(a, 2);
|
|
43
|
-
}
|
|
44
|
-
function h() {
|
|
45
|
-
return d.dragging === !1;
|
|
46
|
-
}
|
|
47
|
-
function i(a, b) {
|
|
48
|
-
a &&
|
|
49
|
-
((a.unselectable = b ? "off" : "on"),
|
|
50
|
-
(a.onselectstart = function () {
|
|
51
|
-
return b;
|
|
52
|
-
}),
|
|
53
|
-
a.style && (a.style.MozUserSelect = b ? "" : "none"));
|
|
54
|
-
}
|
|
55
|
-
a.fn.drag = function (a, b, c) {
|
|
56
|
-
return b && this.bind("dragstart", a), c && this.bind("dragend", c), a ? this.bind("drag", b ? b : a) : this.trigger("drag");
|
|
57
|
-
};
|
|
58
|
-
var b = a.event,
|
|
59
|
-
c = b.special,
|
|
60
|
-
d = (c.drag = {
|
|
61
|
-
not: ":input",
|
|
62
|
-
distance: 0,
|
|
63
|
-
which: 1,
|
|
64
|
-
dragging: !1,
|
|
65
|
-
setup: function (c) {
|
|
66
|
-
(c = a.extend({ distance: d.distance, which: d.which, not: d.not }, c || {})),
|
|
67
|
-
(c.distance = g(c.distance)),
|
|
68
|
-
b.add(this, "mousedown", e, c),
|
|
69
|
-
this.attachEvent && this.attachEvent("ondragstart", h);
|
|
70
|
-
},
|
|
71
|
-
teardown: function () {
|
|
72
|
-
b.remove(this, "mousedown", e), this === d.dragging && (d.dragging = d.proxy = !1), i(this, !0), this.detachEvent && this.detachEvent("ondragstart", h);
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
c.dragstart = c.dragend = { setup: function () {}, teardown: function () {} };
|
|
76
|
-
})(jQuery);
|
|
77
|
-
(function (d) {
|
|
78
|
-
function e(a) {
|
|
79
|
-
var b = a || window.event,
|
|
80
|
-
c = [].slice.call(arguments, 1),
|
|
81
|
-
f = 0,
|
|
82
|
-
e = 0,
|
|
83
|
-
g = 0,
|
|
84
|
-
a = d.event.fix(b);
|
|
85
|
-
a.type = "mousewheel";
|
|
86
|
-
b.wheelDelta && (f = b.wheelDelta / 120);
|
|
87
|
-
b.detail && (f = -b.detail / 3);
|
|
88
|
-
g = f;
|
|
89
|
-
void 0 !== b.axis && b.axis === b.HORIZONTAL_AXIS && ((g = 0), (e = -1 * f));
|
|
90
|
-
void 0 !== b.wheelDeltaY && (g = b.wheelDeltaY / 120);
|
|
91
|
-
void 0 !== b.wheelDeltaX && (e = (-1 * b.wheelDeltaX) / 120);
|
|
92
|
-
c.unshift(a, f, e, g);
|
|
93
|
-
return (d.event.dispatch || d.event.handle).apply(this, c);
|
|
94
|
-
}
|
|
95
|
-
var c = ["DOMMouseScroll", "mousewheel"];
|
|
96
|
-
if (d.event.fixHooks) for (var h = c.length; h; ) d.event.fixHooks[c[--h]] = d.event.mouseHooks;
|
|
97
|
-
d.event.special.mousewheel = {
|
|
98
|
-
setup: function () {
|
|
99
|
-
if (this.addEventListener) for (var a = c.length; a; ) this.addEventListener(c[--a], e, !1);
|
|
100
|
-
else this.onmousewheel = e;
|
|
101
|
-
},
|
|
102
|
-
teardown: function () {
|
|
103
|
-
if (this.removeEventListener) for (var a = c.length; a; ) this.removeEventListener(c[--a], e, !1);
|
|
104
|
-
else this.onmousewheel = null;
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
d.fn.extend({
|
|
108
|
-
mousewheel: function (a) {
|
|
109
|
-
return a ? this.bind("mousewheel", a) : this.trigger("mousewheel");
|
|
110
|
-
},
|
|
111
|
-
unmousewheel: function (a) {
|
|
112
|
-
return this.unbind("mousewheel", a);
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
})(jQuery);
|
|
116
|
-
(function ($) {
|
|
117
|
-
var options = {
|
|
118
|
-
xaxis: { zoomRange: null, panRange: null },
|
|
119
|
-
zoom: { interactive: false, trigger: "dblclick", amount: 1.5 },
|
|
120
|
-
pan: { interactive: false, cursor: "move", frameRate: 20 },
|
|
121
|
-
};
|
|
122
|
-
function init(plot) {
|
|
123
|
-
function onZoomClick(e, zoomOut) {
|
|
124
|
-
var c = plot.offset();
|
|
125
|
-
c.left = e.pageX - c.left;
|
|
126
|
-
c.top = e.pageY - c.top;
|
|
127
|
-
if (zoomOut) plot.zoomOut({ center: c });
|
|
128
|
-
else plot.zoom({ center: c });
|
|
129
|
-
}
|
|
130
|
-
function onMouseWheel(e, delta) {
|
|
131
|
-
e.preventDefault();
|
|
132
|
-
onZoomClick(e, delta < 0);
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
var prevCursor = "default",
|
|
136
|
-
prevPageX = 0,
|
|
137
|
-
prevPageY = 0,
|
|
138
|
-
panTimeout = null;
|
|
139
|
-
function onDragStart(e) {
|
|
140
|
-
if (e.which != 1) return false;
|
|
141
|
-
var c = plot.getPlaceholder().css("cursor");
|
|
142
|
-
if (c) prevCursor = c;
|
|
143
|
-
plot.getPlaceholder().css("cursor", plot.getOptions().pan.cursor);
|
|
144
|
-
prevPageX = e.pageX;
|
|
145
|
-
prevPageY = e.pageY;
|
|
146
|
-
}
|
|
147
|
-
function onDrag(e) {
|
|
148
|
-
var frameRate = plot.getOptions().pan.frameRate;
|
|
149
|
-
if (panTimeout || !frameRate) return;
|
|
150
|
-
panTimeout = setTimeout(function () {
|
|
151
|
-
plot.pan({ left: prevPageX - e.pageX, top: prevPageY - e.pageY });
|
|
152
|
-
prevPageX = e.pageX;
|
|
153
|
-
prevPageY = e.pageY;
|
|
154
|
-
panTimeout = null;
|
|
155
|
-
}, (1 / frameRate) * 1e3);
|
|
156
|
-
}
|
|
157
|
-
function onDragEnd(e) {
|
|
158
|
-
if (panTimeout) {
|
|
159
|
-
clearTimeout(panTimeout);
|
|
160
|
-
panTimeout = null;
|
|
161
|
-
}
|
|
162
|
-
plot.getPlaceholder().css("cursor", prevCursor);
|
|
163
|
-
plot.pan({ left: prevPageX - e.pageX, top: prevPageY - e.pageY });
|
|
164
|
-
}
|
|
165
|
-
function bindEvents(plot, eventHolder) {
|
|
166
|
-
var o = plot.getOptions();
|
|
167
|
-
if (o.zoom.interactive) {
|
|
168
|
-
eventHolder[o.zoom.trigger](onZoomClick);
|
|
169
|
-
eventHolder.mousewheel(onMouseWheel);
|
|
170
|
-
}
|
|
171
|
-
if (o.pan.interactive) {
|
|
172
|
-
eventHolder.bind("dragstart", { distance: 10 }, onDragStart);
|
|
173
|
-
eventHolder.bind("drag", onDrag);
|
|
174
|
-
eventHolder.bind("dragend", onDragEnd);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
plot.zoomOut = function (args) {
|
|
178
|
-
if (!args) args = {};
|
|
179
|
-
if (!args.amount) args.amount = plot.getOptions().zoom.amount;
|
|
180
|
-
args.amount = 1 / args.amount;
|
|
181
|
-
plot.zoom(args);
|
|
182
|
-
};
|
|
183
|
-
plot.zoom = function (args) {
|
|
184
|
-
if (!args) args = {};
|
|
185
|
-
var c = args.center,
|
|
186
|
-
amount = args.amount || plot.getOptions().zoom.amount,
|
|
187
|
-
w = plot.width(),
|
|
188
|
-
h = plot.height();
|
|
189
|
-
if (!c) c = { left: w / 2, top: h / 2 };
|
|
190
|
-
var xf = c.left / w,
|
|
191
|
-
yf = c.top / h,
|
|
192
|
-
minmax = {
|
|
193
|
-
x: { min: c.left - (xf * w) / amount, max: c.left + ((1 - xf) * w) / amount },
|
|
194
|
-
y: { min: c.top - (yf * h) / amount, max: c.top + ((1 - yf) * h) / amount },
|
|
195
|
-
};
|
|
196
|
-
$.each(plot.getAxes(), function (_, axis) {
|
|
197
|
-
var opts = axis.options,
|
|
198
|
-
min = minmax[axis.direction].min,
|
|
199
|
-
max = minmax[axis.direction].max,
|
|
200
|
-
zr = opts.zoomRange,
|
|
201
|
-
pr = opts.panRange;
|
|
202
|
-
if (zr === false) return;
|
|
203
|
-
min = axis.c2p(min);
|
|
204
|
-
max = axis.c2p(max);
|
|
205
|
-
if (min > max) {
|
|
206
|
-
var tmp = min;
|
|
207
|
-
min = max;
|
|
208
|
-
max = tmp;
|
|
209
|
-
}
|
|
210
|
-
if (pr) {
|
|
211
|
-
if (pr[0] != null && min < pr[0]) {
|
|
212
|
-
min = pr[0];
|
|
213
|
-
}
|
|
214
|
-
if (pr[1] != null && max > pr[1]) {
|
|
215
|
-
max = pr[1];
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
var range = max - min;
|
|
219
|
-
if (zr && ((zr[0] != null && range < zr[0] && amount > 1) || (zr[1] != null && range > zr[1] && amount < 1))) return;
|
|
220
|
-
opts.min = min;
|
|
221
|
-
opts.max = max;
|
|
222
|
-
});
|
|
223
|
-
plot.setupGrid();
|
|
224
|
-
plot.draw();
|
|
225
|
-
if (!args.preventEvent) plot.getPlaceholder().trigger("plotzoom", [plot, args]);
|
|
226
|
-
};
|
|
227
|
-
plot.pan = function (args) {
|
|
228
|
-
var delta = { x: +args.left, y: +args.top };
|
|
229
|
-
if (isNaN(delta.x)) delta.x = 0;
|
|
230
|
-
if (isNaN(delta.y)) delta.y = 0;
|
|
231
|
-
$.each(plot.getAxes(), function (_, axis) {
|
|
232
|
-
var opts = axis.options,
|
|
233
|
-
min,
|
|
234
|
-
max,
|
|
235
|
-
d = delta[axis.direction];
|
|
236
|
-
(min = axis.c2p(axis.p2c(axis.min) + d)), (max = axis.c2p(axis.p2c(axis.max) + d));
|
|
237
|
-
var pr = opts.panRange;
|
|
238
|
-
if (pr === false) return;
|
|
239
|
-
if (pr) {
|
|
240
|
-
if (pr[0] != null && pr[0] > min) {
|
|
241
|
-
d = pr[0] - min;
|
|
242
|
-
min += d;
|
|
243
|
-
max += d;
|
|
244
|
-
}
|
|
245
|
-
if (pr[1] != null && pr[1] < max) {
|
|
246
|
-
d = pr[1] - max;
|
|
247
|
-
min += d;
|
|
248
|
-
max += d;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
opts.min = min;
|
|
252
|
-
opts.max = max;
|
|
253
|
-
});
|
|
254
|
-
plot.setupGrid();
|
|
255
|
-
plot.draw();
|
|
256
|
-
if (!args.preventEvent) plot.getPlaceholder().trigger("plotpan", [plot, args]);
|
|
257
|
-
};
|
|
258
|
-
function shutdown(plot, eventHolder) {
|
|
259
|
-
eventHolder.unbind(plot.getOptions().zoom.trigger, onZoomClick);
|
|
260
|
-
eventHolder.unbind("mousewheel", onMouseWheel);
|
|
261
|
-
eventHolder.unbind("dragstart", onDragStart);
|
|
262
|
-
eventHolder.unbind("drag", onDrag);
|
|
263
|
-
eventHolder.unbind("dragend", onDragEnd);
|
|
264
|
-
if (panTimeout) clearTimeout(panTimeout);
|
|
265
|
-
}
|
|
266
|
-
plot.hooks.bindEvents.push(bindEvents);
|
|
267
|
-
plot.hooks.shutdown.push(shutdown);
|
|
268
|
-
}
|
|
269
|
-
$.plot.plugins.push({ init: init, options: options, name: "navigate", version: "1.3" });
|
|
270
|
-
})(jQuery);
|
|
1
|
+
/* Javascript plotting library for jQuery, version 0.8.3.
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
|
4
|
+
Licensed under the MIT license.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
(function (a) {
|
|
8
|
+
function e(h) {
|
|
9
|
+
var k,
|
|
10
|
+
j = this,
|
|
11
|
+
l = h.data || {};
|
|
12
|
+
if (l.elem)
|
|
13
|
+
(j = h.dragTarget = l.elem),
|
|
14
|
+
(h.dragProxy = d.proxy || j),
|
|
15
|
+
(h.cursorOffsetX = l.pageX - l.left),
|
|
16
|
+
(h.cursorOffsetY = l.pageY - l.top),
|
|
17
|
+
(h.offsetX = h.pageX - h.cursorOffsetX),
|
|
18
|
+
(h.offsetY = h.pageY - h.cursorOffsetY);
|
|
19
|
+
else if (d.dragging || (l.which > 0 && h.which != l.which) || a(h.target).is(l.not)) return;
|
|
20
|
+
switch (h.type) {
|
|
21
|
+
case "mousedown":
|
|
22
|
+
return a.extend(l, a(j).offset(), { elem: j, target: h.target, pageX: h.pageX, pageY: h.pageY }), b.add(document, "mousemove mouseup", e, l), i(j, !1), (d.dragging = null), !1;
|
|
23
|
+
case !d.dragging && "mousemove":
|
|
24
|
+
if (g(h.pageX - l.pageX) + g(h.pageY - l.pageY) < l.distance) break;
|
|
25
|
+
(h.target = l.target), (k = f(h, "dragstart", j)), k !== !1 && ((d.dragging = j), (d.proxy = h.dragProxy = a(k || j)[0]));
|
|
26
|
+
case "mousemove":
|
|
27
|
+
if (d.dragging) {
|
|
28
|
+
if (((k = f(h, "drag", j)), c.drop && ((c.drop.allowed = k !== !1), c.drop.handler(h)), k !== !1)) break;
|
|
29
|
+
h.type = "mouseup";
|
|
30
|
+
}
|
|
31
|
+
case "mouseup":
|
|
32
|
+
b.remove(document, "mousemove mouseup", e), d.dragging && (c.drop && c.drop.handler(h), f(h, "dragend", j)), i(j, !0), (d.dragging = d.proxy = l.elem = !1);
|
|
33
|
+
}
|
|
34
|
+
return !0;
|
|
35
|
+
}
|
|
36
|
+
function f(b, c, d) {
|
|
37
|
+
b.type = c;
|
|
38
|
+
var e = a.event.dispatch.call(d, b);
|
|
39
|
+
return e === !1 ? !1 : e || b.result;
|
|
40
|
+
}
|
|
41
|
+
function g(a) {
|
|
42
|
+
return Math.pow(a, 2);
|
|
43
|
+
}
|
|
44
|
+
function h() {
|
|
45
|
+
return d.dragging === !1;
|
|
46
|
+
}
|
|
47
|
+
function i(a, b) {
|
|
48
|
+
a &&
|
|
49
|
+
((a.unselectable = b ? "off" : "on"),
|
|
50
|
+
(a.onselectstart = function () {
|
|
51
|
+
return b;
|
|
52
|
+
}),
|
|
53
|
+
a.style && (a.style.MozUserSelect = b ? "" : "none"));
|
|
54
|
+
}
|
|
55
|
+
a.fn.drag = function (a, b, c) {
|
|
56
|
+
return b && this.bind("dragstart", a), c && this.bind("dragend", c), a ? this.bind("drag", b ? b : a) : this.trigger("drag");
|
|
57
|
+
};
|
|
58
|
+
var b = a.event,
|
|
59
|
+
c = b.special,
|
|
60
|
+
d = (c.drag = {
|
|
61
|
+
not: ":input",
|
|
62
|
+
distance: 0,
|
|
63
|
+
which: 1,
|
|
64
|
+
dragging: !1,
|
|
65
|
+
setup: function (c) {
|
|
66
|
+
(c = a.extend({ distance: d.distance, which: d.which, not: d.not }, c || {})),
|
|
67
|
+
(c.distance = g(c.distance)),
|
|
68
|
+
b.add(this, "mousedown", e, c),
|
|
69
|
+
this.attachEvent && this.attachEvent("ondragstart", h);
|
|
70
|
+
},
|
|
71
|
+
teardown: function () {
|
|
72
|
+
b.remove(this, "mousedown", e), this === d.dragging && (d.dragging = d.proxy = !1), i(this, !0), this.detachEvent && this.detachEvent("ondragstart", h);
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
c.dragstart = c.dragend = { setup: function () {}, teardown: function () {} };
|
|
76
|
+
})(jQuery);
|
|
77
|
+
(function (d) {
|
|
78
|
+
function e(a) {
|
|
79
|
+
var b = a || window.event,
|
|
80
|
+
c = [].slice.call(arguments, 1),
|
|
81
|
+
f = 0,
|
|
82
|
+
e = 0,
|
|
83
|
+
g = 0,
|
|
84
|
+
a = d.event.fix(b);
|
|
85
|
+
a.type = "mousewheel";
|
|
86
|
+
b.wheelDelta && (f = b.wheelDelta / 120);
|
|
87
|
+
b.detail && (f = -b.detail / 3);
|
|
88
|
+
g = f;
|
|
89
|
+
void 0 !== b.axis && b.axis === b.HORIZONTAL_AXIS && ((g = 0), (e = -1 * f));
|
|
90
|
+
void 0 !== b.wheelDeltaY && (g = b.wheelDeltaY / 120);
|
|
91
|
+
void 0 !== b.wheelDeltaX && (e = (-1 * b.wheelDeltaX) / 120);
|
|
92
|
+
c.unshift(a, f, e, g);
|
|
93
|
+
return (d.event.dispatch || d.event.handle).apply(this, c);
|
|
94
|
+
}
|
|
95
|
+
var c = ["DOMMouseScroll", "mousewheel"];
|
|
96
|
+
if (d.event.fixHooks) for (var h = c.length; h; ) d.event.fixHooks[c[--h]] = d.event.mouseHooks;
|
|
97
|
+
d.event.special.mousewheel = {
|
|
98
|
+
setup: function () {
|
|
99
|
+
if (this.addEventListener) for (var a = c.length; a; ) this.addEventListener(c[--a], e, !1);
|
|
100
|
+
else this.onmousewheel = e;
|
|
101
|
+
},
|
|
102
|
+
teardown: function () {
|
|
103
|
+
if (this.removeEventListener) for (var a = c.length; a; ) this.removeEventListener(c[--a], e, !1);
|
|
104
|
+
else this.onmousewheel = null;
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
d.fn.extend({
|
|
108
|
+
mousewheel: function (a) {
|
|
109
|
+
return a ? this.bind("mousewheel", a) : this.trigger("mousewheel");
|
|
110
|
+
},
|
|
111
|
+
unmousewheel: function (a) {
|
|
112
|
+
return this.unbind("mousewheel", a);
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
})(jQuery);
|
|
116
|
+
(function ($) {
|
|
117
|
+
var options = {
|
|
118
|
+
xaxis: { zoomRange: null, panRange: null },
|
|
119
|
+
zoom: { interactive: false, trigger: "dblclick", amount: 1.5 },
|
|
120
|
+
pan: { interactive: false, cursor: "move", frameRate: 20 },
|
|
121
|
+
};
|
|
122
|
+
function init(plot) {
|
|
123
|
+
function onZoomClick(e, zoomOut) {
|
|
124
|
+
var c = plot.offset();
|
|
125
|
+
c.left = e.pageX - c.left;
|
|
126
|
+
c.top = e.pageY - c.top;
|
|
127
|
+
if (zoomOut) plot.zoomOut({ center: c });
|
|
128
|
+
else plot.zoom({ center: c });
|
|
129
|
+
}
|
|
130
|
+
function onMouseWheel(e, delta) {
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
onZoomClick(e, delta < 0);
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
var prevCursor = "default",
|
|
136
|
+
prevPageX = 0,
|
|
137
|
+
prevPageY = 0,
|
|
138
|
+
panTimeout = null;
|
|
139
|
+
function onDragStart(e) {
|
|
140
|
+
if (e.which != 1) return false;
|
|
141
|
+
var c = plot.getPlaceholder().css("cursor");
|
|
142
|
+
if (c) prevCursor = c;
|
|
143
|
+
plot.getPlaceholder().css("cursor", plot.getOptions().pan.cursor);
|
|
144
|
+
prevPageX = e.pageX;
|
|
145
|
+
prevPageY = e.pageY;
|
|
146
|
+
}
|
|
147
|
+
function onDrag(e) {
|
|
148
|
+
var frameRate = plot.getOptions().pan.frameRate;
|
|
149
|
+
if (panTimeout || !frameRate) return;
|
|
150
|
+
panTimeout = setTimeout(function () {
|
|
151
|
+
plot.pan({ left: prevPageX - e.pageX, top: prevPageY - e.pageY });
|
|
152
|
+
prevPageX = e.pageX;
|
|
153
|
+
prevPageY = e.pageY;
|
|
154
|
+
panTimeout = null;
|
|
155
|
+
}, (1 / frameRate) * 1e3);
|
|
156
|
+
}
|
|
157
|
+
function onDragEnd(e) {
|
|
158
|
+
if (panTimeout) {
|
|
159
|
+
clearTimeout(panTimeout);
|
|
160
|
+
panTimeout = null;
|
|
161
|
+
}
|
|
162
|
+
plot.getPlaceholder().css("cursor", prevCursor);
|
|
163
|
+
plot.pan({ left: prevPageX - e.pageX, top: prevPageY - e.pageY });
|
|
164
|
+
}
|
|
165
|
+
function bindEvents(plot, eventHolder) {
|
|
166
|
+
var o = plot.getOptions();
|
|
167
|
+
if (o.zoom.interactive) {
|
|
168
|
+
eventHolder[o.zoom.trigger](onZoomClick);
|
|
169
|
+
eventHolder.mousewheel(onMouseWheel);
|
|
170
|
+
}
|
|
171
|
+
if (o.pan.interactive) {
|
|
172
|
+
eventHolder.bind("dragstart", { distance: 10 }, onDragStart);
|
|
173
|
+
eventHolder.bind("drag", onDrag);
|
|
174
|
+
eventHolder.bind("dragend", onDragEnd);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
plot.zoomOut = function (args) {
|
|
178
|
+
if (!args) args = {};
|
|
179
|
+
if (!args.amount) args.amount = plot.getOptions().zoom.amount;
|
|
180
|
+
args.amount = 1 / args.amount;
|
|
181
|
+
plot.zoom(args);
|
|
182
|
+
};
|
|
183
|
+
plot.zoom = function (args) {
|
|
184
|
+
if (!args) args = {};
|
|
185
|
+
var c = args.center,
|
|
186
|
+
amount = args.amount || plot.getOptions().zoom.amount,
|
|
187
|
+
w = plot.width(),
|
|
188
|
+
h = plot.height();
|
|
189
|
+
if (!c) c = { left: w / 2, top: h / 2 };
|
|
190
|
+
var xf = c.left / w,
|
|
191
|
+
yf = c.top / h,
|
|
192
|
+
minmax = {
|
|
193
|
+
x: { min: c.left - (xf * w) / amount, max: c.left + ((1 - xf) * w) / amount },
|
|
194
|
+
y: { min: c.top - (yf * h) / amount, max: c.top + ((1 - yf) * h) / amount },
|
|
195
|
+
};
|
|
196
|
+
$.each(plot.getAxes(), function (_, axis) {
|
|
197
|
+
var opts = axis.options,
|
|
198
|
+
min = minmax[axis.direction].min,
|
|
199
|
+
max = minmax[axis.direction].max,
|
|
200
|
+
zr = opts.zoomRange,
|
|
201
|
+
pr = opts.panRange;
|
|
202
|
+
if (zr === false) return;
|
|
203
|
+
min = axis.c2p(min);
|
|
204
|
+
max = axis.c2p(max);
|
|
205
|
+
if (min > max) {
|
|
206
|
+
var tmp = min;
|
|
207
|
+
min = max;
|
|
208
|
+
max = tmp;
|
|
209
|
+
}
|
|
210
|
+
if (pr) {
|
|
211
|
+
if (pr[0] != null && min < pr[0]) {
|
|
212
|
+
min = pr[0];
|
|
213
|
+
}
|
|
214
|
+
if (pr[1] != null && max > pr[1]) {
|
|
215
|
+
max = pr[1];
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
var range = max - min;
|
|
219
|
+
if (zr && ((zr[0] != null && range < zr[0] && amount > 1) || (zr[1] != null && range > zr[1] && amount < 1))) return;
|
|
220
|
+
opts.min = min;
|
|
221
|
+
opts.max = max;
|
|
222
|
+
});
|
|
223
|
+
plot.setupGrid();
|
|
224
|
+
plot.draw();
|
|
225
|
+
if (!args.preventEvent) plot.getPlaceholder().trigger("plotzoom", [plot, args]);
|
|
226
|
+
};
|
|
227
|
+
plot.pan = function (args) {
|
|
228
|
+
var delta = { x: +args.left, y: +args.top };
|
|
229
|
+
if (isNaN(delta.x)) delta.x = 0;
|
|
230
|
+
if (isNaN(delta.y)) delta.y = 0;
|
|
231
|
+
$.each(plot.getAxes(), function (_, axis) {
|
|
232
|
+
var opts = axis.options,
|
|
233
|
+
min,
|
|
234
|
+
max,
|
|
235
|
+
d = delta[axis.direction];
|
|
236
|
+
(min = axis.c2p(axis.p2c(axis.min) + d)), (max = axis.c2p(axis.p2c(axis.max) + d));
|
|
237
|
+
var pr = opts.panRange;
|
|
238
|
+
if (pr === false) return;
|
|
239
|
+
if (pr) {
|
|
240
|
+
if (pr[0] != null && pr[0] > min) {
|
|
241
|
+
d = pr[0] - min;
|
|
242
|
+
min += d;
|
|
243
|
+
max += d;
|
|
244
|
+
}
|
|
245
|
+
if (pr[1] != null && pr[1] < max) {
|
|
246
|
+
d = pr[1] - max;
|
|
247
|
+
min += d;
|
|
248
|
+
max += d;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
opts.min = min;
|
|
252
|
+
opts.max = max;
|
|
253
|
+
});
|
|
254
|
+
plot.setupGrid();
|
|
255
|
+
plot.draw();
|
|
256
|
+
if (!args.preventEvent) plot.getPlaceholder().trigger("plotpan", [plot, args]);
|
|
257
|
+
};
|
|
258
|
+
function shutdown(plot, eventHolder) {
|
|
259
|
+
eventHolder.unbind(plot.getOptions().zoom.trigger, onZoomClick);
|
|
260
|
+
eventHolder.unbind("mousewheel", onMouseWheel);
|
|
261
|
+
eventHolder.unbind("dragstart", onDragStart);
|
|
262
|
+
eventHolder.unbind("drag", onDrag);
|
|
263
|
+
eventHolder.unbind("dragend", onDragEnd);
|
|
264
|
+
if (panTimeout) clearTimeout(panTimeout);
|
|
265
|
+
}
|
|
266
|
+
plot.hooks.bindEvents.push(bindEvents);
|
|
267
|
+
plot.hooks.shutdown.push(shutdown);
|
|
268
|
+
}
|
|
269
|
+
$.plot.plugins.push({ init: init, options: options, name: "navigate", version: "1.3" });
|
|
270
|
+
})(jQuery);
|