iobroker.vis2-materialdesign 0.1.0
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/LICENSE +22 -0
- package/README.md +198 -0
- package/admin/admin.d.ts +93 -0
- package/admin/i18n/de.json +985 -0
- package/admin/i18n/en.json +985 -0
- package/admin/i18n/es.json +985 -0
- package/admin/i18n/fr.json +985 -0
- package/admin/i18n/it.json +985 -0
- package/admin/i18n/nl.json +985 -0
- package/admin/i18n/pl.json +985 -0
- package/admin/i18n/pt.json +985 -0
- package/admin/i18n/ru.json +985 -0
- package/admin/i18n/uk.json +985 -0
- package/admin/i18n/zh-cn.json +985 -0
- package/admin/img/info-big.png +0 -0
- package/admin/index_m.html +456 -0
- package/admin/index_m.js +1018 -0
- package/admin/lib/clipboard-polyfill.promise.js +16 -0
- package/admin/lib/colors.json +1304 -0
- package/admin/lib/colorsDark.json +1304 -0
- package/admin/lib/defaultcolors.json +22 -0
- package/admin/lib/defaultcolorsDark.json +22 -0
- package/admin/lib/defaultfontSizes.json +14 -0
- package/admin/lib/defaultfonts.json +14 -0
- package/admin/lib/fontSizes.json +380 -0
- package/admin/lib/fonts.json +386 -0
- package/admin/lib/monolith.min.css +1 -0
- package/admin/lib/pickr.min.js +5 -0
- package/admin/materialdesign-widgets-click-sound.mp3 +0 -0
- package/admin/style.css +31 -0
- package/admin/tsconfig.json +9 -0
- package/admin/vis-materialdesign.png +0 -0
- package/admin/vis-materialdesign_16_9.png +0 -0
- package/admin/words.js +11949 -0
- package/io-package.json +184 -0
- package/package.json +71 -0
- package/widgets/materialdesign/css/widgets.css +7174 -0
- package/widgets/materialdesign/css/widgets.min.css +1 -0
- package/widgets/materialdesign/img/IoBroker_Logo.png +0 -0
- package/widgets/materialdesign/img/bar_chart.png +0 -0
- package/widgets/materialdesign/img/calendar.png +0 -0
- package/widgets/materialdesign/img/pie_chart.png +0 -0
- package/widgets/materialdesign/img/prev_alerts.png +0 -0
- package/widgets/materialdesign/img/prev_autocomplete.png +0 -0
- package/widgets/materialdesign/img/prev_color_schemes.png +0 -0
- package/widgets/materialdesign/img/prev_dialog_view.png +0 -0
- package/widgets/materialdesign/img/prev_grid_views.png +0 -0
- package/widgets/materialdesign/img/prev_icon.png +0 -0
- package/widgets/materialdesign/img/prev_iconlist.png +0 -0
- package/widgets/materialdesign/img/prev_input.png +0 -0
- package/widgets/materialdesign/img/prev_json_chart.png +0 -0
- package/widgets/materialdesign/img/prev_line_history_chart.png +0 -0
- package/widgets/materialdesign/img/prev_list.png +0 -0
- package/widgets/materialdesign/img/prev_masonry_views.png +0 -0
- package/widgets/materialdesign/img/prev_select_bool.png +0 -0
- package/widgets/materialdesign/img/prev_select_value.png +0 -0
- package/widgets/materialdesign/img/prev_table.png +0 -0
- package/widgets/materialdesign/img/prev_top_app_bar_nav_drawer.png +0 -0
- package/widgets/materialdesign/img/prev_version.png +0 -0
- package/widgets/materialdesign/img/preview.jpg +0 -0
- package/widgets/materialdesign/js/materialdesign.js +56 -0
- package/widgets/materialdesign/js/widgets/materialdesign.00.helper.js +1229 -0
- package/widgets/materialdesign/js/widgets/materialdesign.00.vue.helper.js +710 -0
- package/widgets/materialdesign/js/widgets/materialdesign.alerts.js +177 -0
- package/widgets/materialdesign/js/widgets/materialdesign.autocomplete.js +263 -0
- package/widgets/materialdesign/js/widgets/materialdesign.button.js +1617 -0
- package/widgets/materialdesign/js/widgets/materialdesign.calendar.js +472 -0
- package/widgets/materialdesign/js/widgets/materialdesign.card.js +276 -0
- package/widgets/materialdesign/js/widgets/materialdesign.chart.bar.js +389 -0
- package/widgets/materialdesign/js/widgets/materialdesign.chart.helper.js +494 -0
- package/widgets/materialdesign/js/widgets/materialdesign.chart.json.js +621 -0
- package/widgets/materialdesign/js/widgets/materialdesign.chart.line.js +552 -0
- package/widgets/materialdesign/js/widgets/materialdesign.chart.pie.js +380 -0
- package/widgets/materialdesign/js/widgets/materialdesign.checkbox.js +281 -0
- package/widgets/materialdesign/js/widgets/materialdesign.colorschemes.js +129 -0
- package/widgets/materialdesign/js/widgets/materialdesign.dialog.js +384 -0
- package/widgets/materialdesign/js/widgets/materialdesign.iconList.js +873 -0
- package/widgets/materialdesign/js/widgets/materialdesign.list.js +503 -0
- package/widgets/materialdesign/js/widgets/materialdesign.materialdesignicons.js +7055 -0
- package/widgets/materialdesign/js/widgets/materialdesign.progress.js +413 -0
- package/widgets/materialdesign/js/widgets/materialdesign.roundslider.js +267 -0
- package/widgets/materialdesign/js/widgets/materialdesign.select.js +243 -0
- package/widgets/materialdesign/js/widgets/materialdesign.slider.js +363 -0
- package/widgets/materialdesign/js/widgets/materialdesign.switch.js +284 -0
- package/widgets/materialdesign/js/widgets/materialdesign.table.js +688 -0
- package/widgets/materialdesign/js/widgets/materialdesign.textfield.js +260 -0
- package/widgets/materialdesign/js/widgets/materialdesign.topappbarnav.js +747 -0
- package/widgets/materialdesign/js/widgets/materialdesign.value.js +369 -0
- package/widgets/materialdesign/js/widgets/materialdesign.views.js +827 -0
- package/widgets/materialdesign/js/widgets/materialdesign.viseditor.js +1088 -0
- package/widgets/materialdesign/js/widgets.min.js +1 -0
- package/widgets/materialdesign/lib/Chart.css +47 -0
- package/widgets/materialdesign/lib/Chart.js +16151 -0
- package/widgets/materialdesign/lib/VueTheMask.umd.js +556 -0
- package/widgets/materialdesign/lib/chartjs-plugin-datalabels.js +1385 -0
- package/widgets/materialdesign/lib/chroma.js +3225 -0
- package/widgets/materialdesign/lib/fonts/material-design-icons/materialdesignicons-webfont.ttf +0 -0
- package/widgets/materialdesign/lib/fonts/material-design-icons/materialdesignicons.css +27457 -0
- package/widgets/materialdesign/lib/fonts/material-design-icons/materialdesignicons.min.css +1 -0
- package/widgets/materialdesign/lib/fonts/material-icons/MaterialIcons-Regular.ttf +0 -0
- package/widgets/materialdesign/lib/fonts/material-icons/material-icons.css +31 -0
- package/widgets/materialdesign/lib/he.js +345 -0
- package/widgets/materialdesign/lib/jquery.initialize.js +156 -0
- package/widgets/materialdesign/lib/jquery.knob.js +820 -0
- package/widgets/materialdesign/lib/jquery.mobile-events.js +940 -0
- package/widgets/materialdesign/lib/material-components-web.css +10011 -0
- package/widgets/materialdesign/lib/material-components-web.js +22651 -0
- package/widgets/materialdesign/lib/math.js +41 -0
- package/widgets/materialdesign/lib/moment-duration-format.js +1737 -0
- package/widgets/materialdesign/lib/myUnderscore.js +1695 -0
- package/widgets/materialdesign/lib/raw/moment-with-locales.min.js +28 -0
- package/widgets/materialdesign/lib/raw/round-slider.js +271 -0
- package/widgets/materialdesign/lib/raw/sentry/bundle.min.js +3 -0
- package/widgets/materialdesign/lib/raw/sentry/captureconsole.min.js +2 -0
- package/widgets/materialdesign/lib/raw/sentry/dedupe.min.js +2 -0
- package/widgets/materialdesign/lib/svg-inject.js +697 -0
- package/widgets/materialdesign/lib/vue.js +11965 -0
- package/widgets/materialdesign/lib/vuetify.js +43729 -0
- package/widgets/materialdesign/lib.min.css +1 -0
- package/widgets/materialdesign/lib.min.js +6285 -0
- package/widgets/materialdesign.html +1063 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonAdition-BOasvewn.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonAditionVertical-CfxLrjtz.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonLink-DFOHalVe.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonLinkVertical-bLBc2Zj6.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonNavigation-loocTeHA.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonNavigationVertical-wKivh3mz.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonState-DyuzNIZY.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonStateMulti-D9YVumU3.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonStateMultiVertical-J7SUuXNA.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonStateVertical-EhVri-Bj.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonToggle-CLxaT9SA.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtonToggleVertical-4zI4T-cI.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignButtons-BHDA55zY.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignCheckbox-Dwl43BB6.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignIcon-07Jl1QSv.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonAdition-DkyLUAuu.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonLink-CFh_41FT.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonNavigation-CLvhcORZ.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonSlider-TfUJKNib.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonState-Con_l2iN.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonStateMulti-DuakGd7h.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonToggle-B3Yxo-Ii.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignSwitch-BPSYRrDe.js +1 -0
- package/widgets/vis2-materialdesign/assets/MaterialDesignValue-D5sJ-iyi.js +1 -0
- package/widgets/vis2-materialdesign/assets/_virtual_mf-localSharedImportMap___mfe_internal__vis2MaterialDesignWidgets-BFI0756z.js +1 -0
- package/widgets/vis2-materialdesign/assets/_virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadShare__react__loadShare__.js-4V-ZaKyJ.js +1 -0
- package/widgets/vis2-materialdesign/assets/_virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-Eu2aWCKd.js +1 -0
- package/widgets/vis2-materialdesign/assets/_virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadShare__react_mf_2_dom__loadShare__.js-D3wyrTEe.js +8 -0
- package/widgets/vis2-materialdesign/assets/hostInit-CP4jqDxy.js +1 -0
- package/widgets/vis2-materialdesign/assets/index-jMDUG1V1.js +1 -0
- package/widgets/vis2-materialdesign/assets/mf-entry-bootstrap-0-5bdbe7bd.js +35 -0
- package/widgets/vis2-materialdesign/assets/rolldown-runtime-CNC7AqOf.js +1 -0
- package/widgets/vis2-materialdesign/assets/translations-CYT3A7CQ.js +1 -0
- package/widgets/vis2-materialdesign/assets/virtualExposes-BFTZrXtp.js +1 -0
- package/widgets/vis2-materialdesign/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__vis2MaterialDesignWidgets__customWidgets_js-BOvf1QCd.js +4 -0
- package/widgets/vis2-materialdesign/assets/virtual_mf-exposes-ssr___mfe_internal__vis2MaterialDesignWidgets__customWidgets_js-vY7qHvFF.js +2 -0
- package/widgets/vis2-materialdesign/assets/virtual_mf-exposes___mfe_internal__vis2MaterialDesignWidgets__customWidgets_js-C28iDRsy.js +2 -0
- package/widgets/vis2-materialdesign/assets/vite-preload-helper-DuG8C5Si.js +1 -0
- package/widgets/vis2-materialdesign/assets/widgetUtils-D_-xivaB.js +1 -0
- package/widgets/vis2-materialdesign/customWidgets.js +1 -0
- package/widgets/vis2-materialdesign/customWidgets.ssr.js +1 -0
- package/widgets/vis2-materialdesign/materialdesign-widgets-click-sound.mp3 +0 -0
- package/widgets/vis2-materialdesign/mf-stats.json +1 -0
|
@@ -0,0 +1,820 @@
|
|
|
1
|
+
/*!jQuery Knob*/
|
|
2
|
+
/**
|
|
3
|
+
* Downward compatible, touchable dial
|
|
4
|
+
*
|
|
5
|
+
* Version: 1.2.11
|
|
6
|
+
* Requires: jQuery v1.7+
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) 2012 Anthony Terrien
|
|
9
|
+
* Under MIT License (http://www.opensource.org/licenses/mit-license.php)
|
|
10
|
+
*
|
|
11
|
+
* small modifications by bluefox in this version
|
|
12
|
+
*
|
|
13
|
+
* Thanks to vor, eskimoblood, spiffistan, FabrizioC
|
|
14
|
+
*/
|
|
15
|
+
(function (factory) {
|
|
16
|
+
if (typeof exports === 'object') {
|
|
17
|
+
// CommonJS
|
|
18
|
+
module.exports = factory(require('jquery'));
|
|
19
|
+
} else if (typeof define === 'function' && define.amd) {
|
|
20
|
+
// AMD. Register as an anonymous module.
|
|
21
|
+
define(['jquery'], factory);
|
|
22
|
+
} else {
|
|
23
|
+
// Browser globals
|
|
24
|
+
factory(jQuery);
|
|
25
|
+
}
|
|
26
|
+
}(function ($) {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Kontrol library
|
|
30
|
+
*/
|
|
31
|
+
"use strict";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Definition of globals and core
|
|
35
|
+
*/
|
|
36
|
+
var k = {}, // kontrol
|
|
37
|
+
max = Math.max,
|
|
38
|
+
min = Math.min;
|
|
39
|
+
|
|
40
|
+
k.c = {};
|
|
41
|
+
k.c.d = $(document);
|
|
42
|
+
k.c.t = function (e) {
|
|
43
|
+
return e.originalEvent.touches.length - 1;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Kontrol Object
|
|
48
|
+
*
|
|
49
|
+
* Definition of an abstract UI control
|
|
50
|
+
*
|
|
51
|
+
* Each concrete component must call this one.
|
|
52
|
+
* <code>
|
|
53
|
+
* k.o.call(this);
|
|
54
|
+
* </code>
|
|
55
|
+
*/
|
|
56
|
+
k.o = function () {
|
|
57
|
+
var s = this;
|
|
58
|
+
|
|
59
|
+
this.o = null; // array of options
|
|
60
|
+
this.$ = null; // jQuery wrapped element
|
|
61
|
+
this.i = null; // mixed HTMLInputElement or array of HTMLInputElement
|
|
62
|
+
this.g = null; // deprecated 2D graphics context for 'pre-rendering'
|
|
63
|
+
this.v = null; // value ; mixed array or integer
|
|
64
|
+
this.cv = null; // change value ; not commited value
|
|
65
|
+
this.x = 0; // canvas x position
|
|
66
|
+
this.y = 0; // canvas y position
|
|
67
|
+
this.w = 0; // canvas width
|
|
68
|
+
this.h = 0; // canvas height
|
|
69
|
+
this.$c = null; // jQuery canvas element
|
|
70
|
+
this.c = null; // rendered canvas context
|
|
71
|
+
this.t = 0; // touches index
|
|
72
|
+
this.isInit = false;
|
|
73
|
+
this.fgColor = null; // main color
|
|
74
|
+
this.pColor = null; // previous color
|
|
75
|
+
this.dH = null; // draw hook
|
|
76
|
+
this.cH = null; // change hook
|
|
77
|
+
this.eH = null; // cancel hook
|
|
78
|
+
this.rH = null; // release hook
|
|
79
|
+
this.scale = 1; // scale factor
|
|
80
|
+
this.relative = false;
|
|
81
|
+
this.relativeWidth = false;
|
|
82
|
+
this.relativeHeight = false;
|
|
83
|
+
this.$div = null; // component div
|
|
84
|
+
|
|
85
|
+
this.run = function () {
|
|
86
|
+
var cf = function (e, conf) {
|
|
87
|
+
var k;
|
|
88
|
+
for (k in conf) {
|
|
89
|
+
s.o[k] = conf[k];
|
|
90
|
+
}
|
|
91
|
+
s._carve().init();
|
|
92
|
+
s._configure()
|
|
93
|
+
._draw();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
if (this.$.data('kontroled')) return;
|
|
97
|
+
this.$.data('kontroled', true);
|
|
98
|
+
|
|
99
|
+
this.extend();
|
|
100
|
+
this.o = $.extend({
|
|
101
|
+
// Config
|
|
102
|
+
min: this.$.data('min') !== undefined ? this.$.data('min') : 0,
|
|
103
|
+
max: this.$.data('max') !== undefined ? this.$.data('max') : 100,
|
|
104
|
+
stopper: true,
|
|
105
|
+
readOnly: this.$.data('readonly') || (this.$.attr('readonly') === 'readonly'),
|
|
106
|
+
|
|
107
|
+
// UI
|
|
108
|
+
cursor: this.$.data('cursor') === true && 30
|
|
109
|
+
|| this.$.data('cursor') || 0,
|
|
110
|
+
thickness: this.$.data('thickness')
|
|
111
|
+
&& Math.max(Math.min(this.$.data('thickness'), 1), 0.01)
|
|
112
|
+
|| 0.35,
|
|
113
|
+
lineCap: this.$.data('linecap') || 'butt',
|
|
114
|
+
width: this.$.data('width') || 200,
|
|
115
|
+
height: this.$.data('height') || 200,
|
|
116
|
+
displayInput: this.$.data('displayinput') == null || this.$.data('displayinput'),
|
|
117
|
+
displayPrevious: this.$.data('displayprevious'),
|
|
118
|
+
fgColor: this.$.data('fgcolor') || '#87CEEB',
|
|
119
|
+
inputColor: this.$.data('inputcolor'),
|
|
120
|
+
font: this.$.data('font') || 'Arial',
|
|
121
|
+
fontWeight: this.$.data('font-weight') || 'bold',
|
|
122
|
+
inline: false,
|
|
123
|
+
step: this.$.data('step') || 1,
|
|
124
|
+
rotation: this.$.data('rotation'),
|
|
125
|
+
|
|
126
|
+
// Hooks
|
|
127
|
+
draw: null, // function () {}
|
|
128
|
+
change: null, // function (value) {}
|
|
129
|
+
cancel: null, // function () {}
|
|
130
|
+
release: null, // function (value) {}
|
|
131
|
+
|
|
132
|
+
// Output formatting, allows to add unit: %, ms ...
|
|
133
|
+
format: function(v) {
|
|
134
|
+
return v;
|
|
135
|
+
},
|
|
136
|
+
parse: function (v) {
|
|
137
|
+
return parseFloat(v);
|
|
138
|
+
},
|
|
139
|
+
colorize: function (color, v) {
|
|
140
|
+
return color;
|
|
141
|
+
}
|
|
142
|
+
}, this.o
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
// finalize options
|
|
146
|
+
this.o.flip = this.o.rotation === 'anticlockwise' || this.o.rotation === 'acw';
|
|
147
|
+
if (!this.o.inputColor) {
|
|
148
|
+
this.o.inputColor = this.o.fgColor;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// routing value
|
|
152
|
+
if (this.$.is('fieldset')) {
|
|
153
|
+
|
|
154
|
+
// fieldset = array of integer
|
|
155
|
+
this.v = {};
|
|
156
|
+
this.i = this.$.find('input');
|
|
157
|
+
this.i.each(function(k) {
|
|
158
|
+
var $this = $(this);
|
|
159
|
+
s.i[k] = $this;
|
|
160
|
+
s.v[k] = s.o.parse($this.val());
|
|
161
|
+
|
|
162
|
+
$this.bind(
|
|
163
|
+
'change blur',
|
|
164
|
+
function () {
|
|
165
|
+
var val = {};
|
|
166
|
+
var setByUser = false;
|
|
167
|
+
val[k] = $this.val();
|
|
168
|
+
if ($this.data('setByUser')) {
|
|
169
|
+
$this.data('setByUser', false);
|
|
170
|
+
setByUser = true;
|
|
171
|
+
}
|
|
172
|
+
s.val(s._validate(val), undefined, setByUser);
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
this.$.find('legend').remove();
|
|
177
|
+
} else {
|
|
178
|
+
|
|
179
|
+
// input = integer
|
|
180
|
+
this.i = this.$;
|
|
181
|
+
this.v = this.o.parse(this.$.val());
|
|
182
|
+
this.v === '' && (this.v = this.o.min);
|
|
183
|
+
this.$.bind(
|
|
184
|
+
'change blur',
|
|
185
|
+
function () {
|
|
186
|
+
var setByUser = false;
|
|
187
|
+
if (s.$.data('setByUser')) {
|
|
188
|
+
s.$.data('setByUser', false);
|
|
189
|
+
setByUser = true;
|
|
190
|
+
}
|
|
191
|
+
s.val(s._validate(s.o.parse(s.$.val())), undefined, setByUser);
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
!this.o.displayInput && this.$.hide();
|
|
198
|
+
|
|
199
|
+
// adds needed DOM elements (canvas, div)
|
|
200
|
+
this.$c = $(document.createElement('canvas')).attr({
|
|
201
|
+
width: this.o.width,
|
|
202
|
+
height: this.o.height
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// wraps all elements in a div
|
|
206
|
+
// add to DOM before Canvas init is triggered
|
|
207
|
+
this.$div = $('<div style="'
|
|
208
|
+
+ (this.o.inline ? 'display:inline;' : '')
|
|
209
|
+
+ 'width:' + this.o.width + 'px;height:' + this.o.height + 'px;'
|
|
210
|
+
+ '"></div>');
|
|
211
|
+
|
|
212
|
+
this.$.wrap(this.$div).before(this.$c);
|
|
213
|
+
this.$div = this.$.parent();
|
|
214
|
+
|
|
215
|
+
if (typeof G_vmlCanvasManager !== 'undefined') {
|
|
216
|
+
G_vmlCanvasManager.initElement(this.$c[0]);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
this.c = this.$c[0].getContext ? this.$c[0].getContext('2d') : null;
|
|
220
|
+
|
|
221
|
+
if (!this.c) {
|
|
222
|
+
throw {
|
|
223
|
+
name: "CanvasNotSupportedException",
|
|
224
|
+
message: "Canvas not supported. Please use excanvas on IE8.0.",
|
|
225
|
+
toString: function(){return this.name + ": " + this.message}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// hdpi support
|
|
230
|
+
this.scale = (window.devicePixelRatio || 1) / (
|
|
231
|
+
this.c.webkitBackingStorePixelRatio ||
|
|
232
|
+
this.c.mozBackingStorePixelRatio ||
|
|
233
|
+
this.c.msBackingStorePixelRatio ||
|
|
234
|
+
this.c.oBackingStorePixelRatio ||
|
|
235
|
+
this.c.backingStorePixelRatio || 1
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
// detects relative width / height
|
|
239
|
+
this.relativeWidth = this.o.width % 1 !== 0
|
|
240
|
+
&& this.o.width.indexOf('%');
|
|
241
|
+
this.relativeHeight = this.o.height % 1 !== 0
|
|
242
|
+
&& this.o.height.indexOf('%');
|
|
243
|
+
this.relative = this.relativeWidth || this.relativeHeight;
|
|
244
|
+
|
|
245
|
+
// computes size and carves the component
|
|
246
|
+
this._carve();
|
|
247
|
+
|
|
248
|
+
// prepares props for transaction
|
|
249
|
+
if (this.v instanceof Object) {
|
|
250
|
+
this.cv = {};
|
|
251
|
+
this.copy(this.v, this.cv);
|
|
252
|
+
} else {
|
|
253
|
+
this.cv = this.v;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// binds configure event
|
|
257
|
+
this.$
|
|
258
|
+
.bind("configure", cf)
|
|
259
|
+
.parent()
|
|
260
|
+
.bind("configure", cf);
|
|
261
|
+
|
|
262
|
+
// finalize init
|
|
263
|
+
this._listen()
|
|
264
|
+
._configure()
|
|
265
|
+
._xy()
|
|
266
|
+
.init();
|
|
267
|
+
|
|
268
|
+
this.isInit = true;
|
|
269
|
+
|
|
270
|
+
this.$.val(this.o.format(this.v));
|
|
271
|
+
this._draw();
|
|
272
|
+
|
|
273
|
+
return this;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
this._carve = function() {
|
|
277
|
+
if (this.relative) {
|
|
278
|
+
var w = this.relativeWidth ?
|
|
279
|
+
this.$div.parent().width() *
|
|
280
|
+
parseInt(this.o.width) / 100
|
|
281
|
+
: this.$div.parent().width(),
|
|
282
|
+
h = this.relativeHeight ?
|
|
283
|
+
this.$div.parent().height() *
|
|
284
|
+
parseInt(this.o.height) / 100
|
|
285
|
+
: this.$div.parent().height();
|
|
286
|
+
|
|
287
|
+
// apply relative
|
|
288
|
+
this.w = this.h = Math.min(w, h);
|
|
289
|
+
} else {
|
|
290
|
+
this.w = this.o.width;
|
|
291
|
+
this.h = this.o.height;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// finalize div
|
|
295
|
+
this.$div.css({
|
|
296
|
+
'width': this.w + 'px',
|
|
297
|
+
'height': this.h + 'px'
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// finalize canvas with computed width
|
|
301
|
+
this.$c.attr({
|
|
302
|
+
width: this.w,
|
|
303
|
+
height: this.h
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// scaling
|
|
307
|
+
if (this.scale !== 1) {
|
|
308
|
+
this.$c[0].width = this.$c[0].width * this.scale;
|
|
309
|
+
this.$c[0].height = this.$c[0].height * this.scale;
|
|
310
|
+
this.$c.width(this.w);
|
|
311
|
+
this.$c.height(this.h);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return this;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
this._draw = function () {
|
|
318
|
+
|
|
319
|
+
// canvas pre-rendering
|
|
320
|
+
var d = true;
|
|
321
|
+
|
|
322
|
+
s.g = s.c;
|
|
323
|
+
|
|
324
|
+
s.clear();
|
|
325
|
+
|
|
326
|
+
s.dH && (d = s.dH());
|
|
327
|
+
|
|
328
|
+
d !== false && s.draw();
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
this._touch = function (e, x, y) {
|
|
332
|
+
var touchMove = function (e) {
|
|
333
|
+
var v = s.xy2val(
|
|
334
|
+
e.originalEvent.touches[s.t].pageX,
|
|
335
|
+
e.originalEvent.touches[s.t].pageY
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
if (v == s.cv) return;
|
|
339
|
+
|
|
340
|
+
if (s.cH && s.cH(v) === false) return;
|
|
341
|
+
|
|
342
|
+
s.change(s._validate(v));
|
|
343
|
+
s._draw();
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// get touches index
|
|
347
|
+
this.t = k.c.t(e);
|
|
348
|
+
|
|
349
|
+
// First touch
|
|
350
|
+
touchMove(e);
|
|
351
|
+
|
|
352
|
+
// Touch events listeners
|
|
353
|
+
k.c.d
|
|
354
|
+
.bind("touchmove.k", touchMove)
|
|
355
|
+
.bind(
|
|
356
|
+
"touchend.k",
|
|
357
|
+
function () {
|
|
358
|
+
k.c.d.unbind('touchmove.k touchend.k');
|
|
359
|
+
s.val(s.cv, undefined, true);
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
|
|
363
|
+
return this;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
this._mouse = function (e) {
|
|
367
|
+
var mouseMove = function (e) {
|
|
368
|
+
var v = s.xy2val(e.pageX, e.pageY);
|
|
369
|
+
|
|
370
|
+
if (v == s.cv) return;
|
|
371
|
+
|
|
372
|
+
if (s.cH && (s.cH(v) === false)) return;
|
|
373
|
+
|
|
374
|
+
s.change(s._validate(v));
|
|
375
|
+
s._draw();
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
// First click
|
|
379
|
+
mouseMove(e);
|
|
380
|
+
|
|
381
|
+
// Mouse events listeners
|
|
382
|
+
k.c.d
|
|
383
|
+
.bind("mousemove.k", mouseMove)
|
|
384
|
+
.bind(
|
|
385
|
+
// Escape key cancel current change
|
|
386
|
+
"keyup.k",
|
|
387
|
+
function (e) {
|
|
388
|
+
if (e.keyCode === 27) {
|
|
389
|
+
k.c.d.unbind("mouseup.k mousemove.k keyup.k");
|
|
390
|
+
|
|
391
|
+
if (s.eH && s.eH() === false)
|
|
392
|
+
return;
|
|
393
|
+
|
|
394
|
+
s.cancel();
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
.bind(
|
|
399
|
+
"mouseup.k",
|
|
400
|
+
function (e) {
|
|
401
|
+
k.c.d.unbind('mousemove.k mouseup.k keyup.k');
|
|
402
|
+
s.val(s.cv, undefined, true);
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
|
|
406
|
+
return this;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
this._xy = function () {
|
|
410
|
+
var o = this.$c.offset();
|
|
411
|
+
this.x = o.left;
|
|
412
|
+
this.y = o.top;
|
|
413
|
+
|
|
414
|
+
return this;
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
this._listen = function () {
|
|
418
|
+
if (!this.o.readOnly) {
|
|
419
|
+
this.$c
|
|
420
|
+
.bind(
|
|
421
|
+
"mousedown",
|
|
422
|
+
function (e) {
|
|
423
|
+
e.preventDefault();
|
|
424
|
+
s._xy()._mouse(e);
|
|
425
|
+
}
|
|
426
|
+
)
|
|
427
|
+
.bind(
|
|
428
|
+
"touchstart",
|
|
429
|
+
function (e) {
|
|
430
|
+
e.preventDefault();
|
|
431
|
+
s._xy()._touch(e);
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
this.listen();
|
|
436
|
+
} else {
|
|
437
|
+
this.$.attr('readonly', 'readonly');
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (this.relative) {
|
|
441
|
+
$(window).resize(function() {
|
|
442
|
+
s._carve().init();
|
|
443
|
+
s._draw();
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return this;
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
this._configure = function () {
|
|
451
|
+
|
|
452
|
+
// Hooks
|
|
453
|
+
if (this.o.draw) this.dH = this.o.draw;
|
|
454
|
+
if (this.o.change) this.cH = this.o.change;
|
|
455
|
+
if (this.o.cancel) this.eH = this.o.cancel;
|
|
456
|
+
if (this.o.release) this.rH = this.o.release;
|
|
457
|
+
|
|
458
|
+
if (this.o.displayPrevious) {
|
|
459
|
+
this.pColor = this.h2rgba(this.o.fgColor, "0.4");
|
|
460
|
+
this.fgColor = this.h2rgba(this.o.fgColor, "0.6");
|
|
461
|
+
} else {
|
|
462
|
+
this.fgColor = this.o.fgColor;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
return this;
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
this._clear = function () {
|
|
469
|
+
this.$c[0].width = this.$c[0].width;
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
this._validate = function (v) {
|
|
473
|
+
var val = (~~ (((v < 0) ? -0.5 : 0.5) + (v/this.o.step))) * this.o.step;
|
|
474
|
+
return Math.round(val * 100) / 100;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
// Abstract methods
|
|
478
|
+
this.listen = function () {}; // on start, one time
|
|
479
|
+
this.extend = function () {}; // each time configure triggered
|
|
480
|
+
this.init = function () {}; // each time configure triggered
|
|
481
|
+
this.change = function (v) {}; // on change
|
|
482
|
+
this.val = function (v) {}; // on release
|
|
483
|
+
this.xy2val = function (x, y) {}; //
|
|
484
|
+
this.draw = function () {}; // on change / on release
|
|
485
|
+
this.clear = function () { this._clear(); };
|
|
486
|
+
|
|
487
|
+
// Utils
|
|
488
|
+
this.h2rgba = function (h, a) {
|
|
489
|
+
var rgb;
|
|
490
|
+
h = h.substring(1,7)
|
|
491
|
+
rgb = [
|
|
492
|
+
parseInt(h.substring(0,2), 16),
|
|
493
|
+
parseInt(h.substring(2,4), 16),
|
|
494
|
+
parseInt(h.substring(4,6), 16)
|
|
495
|
+
];
|
|
496
|
+
|
|
497
|
+
return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + a + ")";
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
this.copy = function (f, t) {
|
|
501
|
+
for (var i in f) {
|
|
502
|
+
t[i] = f[i];
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* k.Dial
|
|
510
|
+
*/
|
|
511
|
+
k.Dial = function () {
|
|
512
|
+
k.o.call(this);
|
|
513
|
+
|
|
514
|
+
this.startAngle = null;
|
|
515
|
+
this.xy = null;
|
|
516
|
+
this.radius = null;
|
|
517
|
+
this.lineWidth = null;
|
|
518
|
+
this.cursorExt = null;
|
|
519
|
+
this.w2 = null;
|
|
520
|
+
this.PI2 = 2*Math.PI;
|
|
521
|
+
|
|
522
|
+
this.extend = function () {
|
|
523
|
+
this.o = $.extend({
|
|
524
|
+
bgColor: this.$.data('bgcolor') || '#EEEEEE',
|
|
525
|
+
angleOffset: this.$.data('angleoffset') || 0,
|
|
526
|
+
angleArc: this.$.data('anglearc') || 360,
|
|
527
|
+
inline: true
|
|
528
|
+
}, this.o);
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
this.val = function (v, triggerRelease, setByUser) {
|
|
532
|
+
if (null != v) {
|
|
533
|
+
|
|
534
|
+
// reverse format
|
|
535
|
+
v = this.o.parse(v);
|
|
536
|
+
|
|
537
|
+
if (triggerRelease !== false
|
|
538
|
+
&& v != this.v
|
|
539
|
+
&& this.rH
|
|
540
|
+
&& this.rH(v, setByUser) === false) { return; }
|
|
541
|
+
|
|
542
|
+
this.cv = this.o.stopper ? max(min(v, this.o.max), this.o.min) : v;
|
|
543
|
+
this.v = this.cv;
|
|
544
|
+
this.$.val(this.o.format(this.v));
|
|
545
|
+
this._draw();
|
|
546
|
+
} else {
|
|
547
|
+
return this.v;
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
this.xy2val = function (x, y) {
|
|
552
|
+
var a, ret;
|
|
553
|
+
|
|
554
|
+
a = Math.atan2(
|
|
555
|
+
x - (this.x + this.w2),
|
|
556
|
+
- (y - this.y - this.w2)
|
|
557
|
+
) - this.angleOffset;
|
|
558
|
+
|
|
559
|
+
if (this.o.flip) {
|
|
560
|
+
a = this.angleArc - a - this.PI2;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (this.angleArc != this.PI2 && (a < 0) && (a > -0.5)) {
|
|
564
|
+
|
|
565
|
+
// if isset angleArc option, set to min if .5 under min
|
|
566
|
+
a = 0;
|
|
567
|
+
} else if (a < 0) {
|
|
568
|
+
a += this.PI2;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
ret = (a * (this.o.max - this.o.min) / this.angleArc) + this.o.min;
|
|
572
|
+
|
|
573
|
+
this.o.stopper && (ret = max(min(ret, this.o.max), this.o.min));
|
|
574
|
+
|
|
575
|
+
return ret;
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
this.listen = function () {
|
|
579
|
+
|
|
580
|
+
// bind MouseWheel
|
|
581
|
+
var s = this, mwTimerStop,
|
|
582
|
+
mwTimerRelease,
|
|
583
|
+
mw = function (e) {
|
|
584
|
+
e.preventDefault();
|
|
585
|
+
|
|
586
|
+
var ori = e.originalEvent,
|
|
587
|
+
deltaX = ori.detail || ori.wheelDeltaX,
|
|
588
|
+
deltaY = ori.detail || ori.wheelDeltaY,
|
|
589
|
+
v = s._validate(s.o.parse(s.$.val()))
|
|
590
|
+
+ (
|
|
591
|
+
deltaX > 0 || deltaY > 0
|
|
592
|
+
? s.o.step
|
|
593
|
+
: deltaX < 0 || deltaY < 0 ? -s.o.step : 0
|
|
594
|
+
);
|
|
595
|
+
|
|
596
|
+
v = max(min(v, s.o.max), s.o.min);
|
|
597
|
+
|
|
598
|
+
s.val(v, false);
|
|
599
|
+
|
|
600
|
+
if (s.rH) {
|
|
601
|
+
// Handle mousewheel stop
|
|
602
|
+
clearTimeout(mwTimerStop);
|
|
603
|
+
mwTimerStop = setTimeout(function () {
|
|
604
|
+
s.rH(v, true);
|
|
605
|
+
mwTimerStop = null;
|
|
606
|
+
}, 100);
|
|
607
|
+
|
|
608
|
+
// Handle mousewheel releases
|
|
609
|
+
if (!mwTimerRelease) {
|
|
610
|
+
mwTimerRelease = setTimeout(function () {
|
|
611
|
+
if (mwTimerStop)
|
|
612
|
+
s.rH(v, true);
|
|
613
|
+
mwTimerRelease = null;
|
|
614
|
+
}, 200);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
kval,
|
|
619
|
+
to,
|
|
620
|
+
m = 1,
|
|
621
|
+
kv = {
|
|
622
|
+
37: -s.o.step,
|
|
623
|
+
38: s.o.step,
|
|
624
|
+
39: s.o.step,
|
|
625
|
+
40: -s.o.step
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
this.$
|
|
629
|
+
.bind(
|
|
630
|
+
"keydown",
|
|
631
|
+
function (e) {
|
|
632
|
+
var kc = e.keyCode;
|
|
633
|
+
|
|
634
|
+
// numpad support
|
|
635
|
+
if (kc >= 96 && kc <= 105) {
|
|
636
|
+
kc = e.keyCode = kc - 48;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
kval = parseInt(String.fromCharCode(kc));
|
|
640
|
+
|
|
641
|
+
if (isNaN(kval)) {
|
|
642
|
+
(kc !== 13) // enter
|
|
643
|
+
&& kc !== 8 // bs
|
|
644
|
+
&& kc !== 9 // tab
|
|
645
|
+
&& kc !== 189 // -
|
|
646
|
+
&& (kc !== 190
|
|
647
|
+
|| s.$.val().match(/\./)) // . allowed once
|
|
648
|
+
&& e.preventDefault();
|
|
649
|
+
|
|
650
|
+
// arrows
|
|
651
|
+
if ($.inArray(kc,[37,38,39,40]) > -1) {
|
|
652
|
+
e.preventDefault();
|
|
653
|
+
|
|
654
|
+
var v = s.o.parse(s.$.val()) + kv[kc] * m;
|
|
655
|
+
s.o.stopper && (v = max(min(v, s.o.max), s.o.min));
|
|
656
|
+
|
|
657
|
+
s.change(s._validate(v));
|
|
658
|
+
s._draw();
|
|
659
|
+
|
|
660
|
+
// long time keydown speed-up
|
|
661
|
+
to = window.setTimeout(function () {
|
|
662
|
+
m *= 2;
|
|
663
|
+
}, 30);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
)
|
|
668
|
+
.bind(
|
|
669
|
+
"keyup",
|
|
670
|
+
function (e) {
|
|
671
|
+
if (isNaN(kval)) {
|
|
672
|
+
if (to) {
|
|
673
|
+
window.clearTimeout(to);
|
|
674
|
+
to = null;
|
|
675
|
+
m = 1;
|
|
676
|
+
s.val(s.$.val(), undefined, true);
|
|
677
|
+
}
|
|
678
|
+
} else {
|
|
679
|
+
// kval postcond
|
|
680
|
+
(s.$.val() > s.o.max && s.$.val(s.o.max))
|
|
681
|
+
|| (s.$.val() < s.o.min && s.$.val(s.o.min));
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
);
|
|
685
|
+
|
|
686
|
+
this.$c.bind("mousewheel DOMMouseScroll", mw);
|
|
687
|
+
this.$.bind("mousewheel DOMMouseScroll", mw)
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
this.init = function () {
|
|
691
|
+
if (this.v < this.o.min
|
|
692
|
+
|| this.v > this.o.max) { this.v = this.o.min; }
|
|
693
|
+
|
|
694
|
+
this.$.val(this.o.format(this.v));
|
|
695
|
+
this.w2 = this.w / 2;
|
|
696
|
+
this.cursorExt = this.o.cursor / 100;
|
|
697
|
+
this.xy = this.w2 * this.scale;
|
|
698
|
+
this.lineWidth = this.xy * this.o.thickness;
|
|
699
|
+
this.lineCap = this.o.lineCap;
|
|
700
|
+
this.radius = this.xy - this.lineWidth / 2;
|
|
701
|
+
|
|
702
|
+
this.o.angleOffset
|
|
703
|
+
&& (this.o.angleOffset = isNaN(this.o.angleOffset) ? 0 : this.o.angleOffset);
|
|
704
|
+
|
|
705
|
+
this.o.angleArc
|
|
706
|
+
&& (this.o.angleArc = isNaN(this.o.angleArc) ? this.PI2 : this.o.angleArc);
|
|
707
|
+
|
|
708
|
+
// deg to rad
|
|
709
|
+
this.angleOffset = this.o.angleOffset * Math.PI / 180;
|
|
710
|
+
this.angleArc = this.o.angleArc * Math.PI / 180;
|
|
711
|
+
|
|
712
|
+
// compute start and end angles
|
|
713
|
+
this.startAngle = 1.5 * Math.PI + this.angleOffset;
|
|
714
|
+
this.endAngle = 1.5 * Math.PI + this.angleOffset + this.angleArc;
|
|
715
|
+
|
|
716
|
+
var s = max(
|
|
717
|
+
String(Math.abs(this.o.max)).length,
|
|
718
|
+
String(Math.abs(this.o.min)).length,
|
|
719
|
+
2
|
|
720
|
+
) + 2;
|
|
721
|
+
|
|
722
|
+
this.o.displayInput
|
|
723
|
+
&& this.i.css({
|
|
724
|
+
'width' : ((this.w / 2 + 4) >> 0) + 'px',
|
|
725
|
+
'height' : ((this.w / 3) >> 0) + 'px',
|
|
726
|
+
'position' : 'absolute',
|
|
727
|
+
'vertical-align' : 'middle',
|
|
728
|
+
'margin-top' : ((this.w / 3) >> 0) + 'px',
|
|
729
|
+
'margin-left' : '-' + ((this.w * 3 / 4 + 2) >> 0) + 'px',
|
|
730
|
+
'border' : 0,
|
|
731
|
+
'background' : 'none',
|
|
732
|
+
'font' : this.o.fontWeight + ' ' + ((this.w / s) >> 0) + 'px ' + this.o.font,
|
|
733
|
+
'text-align' : 'center',
|
|
734
|
+
'color' : this.o.inputColor || this.o.fgColor,
|
|
735
|
+
'padding' : '0px',
|
|
736
|
+
'-webkit-appearance': 'none'
|
|
737
|
+
}) || this.i.css({
|
|
738
|
+
'width': '0px',
|
|
739
|
+
'visibility': 'hidden'
|
|
740
|
+
});
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
this.change = function (v) {
|
|
744
|
+
this.cv = v;
|
|
745
|
+
this.$.val(this.o.format(v));
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
this.angle = function (v) {
|
|
749
|
+
return (v - this.o.min) * this.angleArc / (this.o.max - this.o.min);
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
this.arc = function (v) {
|
|
753
|
+
var sa, ea;
|
|
754
|
+
v = this.angle(v);
|
|
755
|
+
if (this.o.flip) {
|
|
756
|
+
sa = this.endAngle + 0.00001;
|
|
757
|
+
ea = sa - v - 0.00001;
|
|
758
|
+
} else {
|
|
759
|
+
sa = this.startAngle - 0.00001;
|
|
760
|
+
ea = sa + v + 0.00001;
|
|
761
|
+
}
|
|
762
|
+
this.o.cursor
|
|
763
|
+
&& (sa = ea - this.cursorExt)
|
|
764
|
+
&& (ea = ea + this.cursorExt);
|
|
765
|
+
|
|
766
|
+
return {
|
|
767
|
+
s: sa,
|
|
768
|
+
e: ea,
|
|
769
|
+
d: this.o.flip && !this.o.cursor
|
|
770
|
+
};
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
this.draw = function () {
|
|
774
|
+
var c = this.g, // context
|
|
775
|
+
a = this.arc(this.cv), // Arc
|
|
776
|
+
pa, // Previous arc
|
|
777
|
+
r = 1;
|
|
778
|
+
|
|
779
|
+
c.lineWidth = this.lineWidth;
|
|
780
|
+
c.lineCap = this.lineCap;
|
|
781
|
+
|
|
782
|
+
if (this.o.bgColor !== "none") {
|
|
783
|
+
c.beginPath();
|
|
784
|
+
c.strokeStyle = this.o.bgColor;
|
|
785
|
+
c.arc(this.xy, this.xy, this.radius, this.endAngle - 0.00001, this.startAngle + 0.00001, true);
|
|
786
|
+
c.stroke();
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
if (this.o.displayPrevious) {
|
|
790
|
+
pa = this.arc(this.v);
|
|
791
|
+
c.beginPath();
|
|
792
|
+
c.strokeStyle = this.o.colorize(this.pColor, this.v, true);
|
|
793
|
+
c.arc(this.xy, this.xy, this.radius, pa.s, pa.e, pa.d);
|
|
794
|
+
c.stroke();
|
|
795
|
+
r = this.cv == this.v;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
c.beginPath();
|
|
799
|
+
c.strokeStyle = r ? this.o.colorize(this.o.fgColor, this.cv, true) : this.o.colorize(this.o.fgColor, this.cv, false);
|
|
800
|
+
c.arc(this.xy, this.xy, this.radius, a.s, a.e, a.d);
|
|
801
|
+
c.stroke();
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
this.cancel = function () {
|
|
805
|
+
this.val(this.v);
|
|
806
|
+
};
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
$.fn.dial = $.fn.knobHQ = function (o) {
|
|
810
|
+
return this.each(
|
|
811
|
+
function () {
|
|
812
|
+
var d = new k.Dial();
|
|
813
|
+
d.o = o;
|
|
814
|
+
d.$ = $(this);
|
|
815
|
+
d.run();
|
|
816
|
+
}
|
|
817
|
+
).parent();
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
}));
|