1 | (function webpackUniversalModuleDefinition(root, factory) {
|
2 | if(typeof exports === 'object' && typeof module === 'object')
|
3 | module.exports = factory();
|
4 | else if(typeof define === 'function' && define.amd)
|
5 | define([], factory);
|
6 | else if(typeof exports === 'object')
|
7 | exports["G2_3"] = factory();
|
8 | else
|
9 | root["G2_3"] = factory();
|
10 | })(typeof self !== 'undefined' ? self : this, function() {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId]) {
|
20 | return installedModules[moduleId].exports;
|
21 | }
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | i: moduleId,
|
25 | l: false,
|
26 | exports: {}
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.l = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
47 | __webpack_require__.d = function(exports, name, getter) {
|
48 | if(!__webpack_require__.o(exports, name)) {
|
49 | Object.defineProperty(exports, name, {
|
50 | configurable: false,
|
51 | enumerable: true,
|
52 | get: getter
|
53 | /******/ });
|
54 | /******/ }
|
55 | /******/ };
|
56 | /******/
|
57 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
58 | /******/ __webpack_require__.n = function(module) {
|
59 | var getter = module && module.__esModule ?
|
60 | function getDefault() { return module['default']; } :
|
61 | function getModuleExports() { return module; };
|
62 | __webpack_require__.d(getter, 'a', getter);
|
63 | return getter;
|
64 | };
|
65 |
|
66 |
|
67 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
68 |
|
69 |
|
70 | __webpack_require__.p = "";
|
71 |
|
72 |
|
73 | return __webpack_require__(__webpack_require__.s = 126);
|
74 | })
|
75 |
|
76 | ([
|
77 |
|
78 | (function(module, exports, __webpack_require__) {
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 | var MAX_LEVEL = 5;
|
87 |
|
88 | function _mix(dist, obj) {
|
89 | for (var k in obj) {
|
90 | if (obj.hasOwnProperty(k) && k !== 'constructor' && obj[k] !== undefined) {
|
91 | dist[k] = obj[k];
|
92 | }
|
93 | }
|
94 | }
|
95 |
|
96 | var Util = {
|
97 | each: __webpack_require__(127),
|
98 | map: __webpack_require__(142),
|
99 | isObject: __webpack_require__(7),
|
100 | isNumber: __webpack_require__(193),
|
101 | isString: __webpack_require__(89),
|
102 | isFunction: __webpack_require__(48),
|
103 | isFinite: __webpack_require__(194),
|
104 | isBoolean: __webpack_require__(195),
|
105 | isEmpty: __webpack_require__(196),
|
106 | lowerFirst: __webpack_require__(197),
|
107 | upperFirst: __webpack_require__(202),
|
108 | upperCase: __webpack_require__(203),
|
109 | isNil: __webpack_require__(93),
|
110 | isNull: __webpack_require__(212),
|
111 | isArray: __webpack_require__(3),
|
112 | isDate: __webpack_require__(213),
|
113 | isPlainObject: __webpack_require__(215),
|
114 | toArray: __webpack_require__(216),
|
115 | indexOf: __webpack_require__(220),
|
116 | assign: __webpack_require__(60),
|
117 | groupBy: __webpack_require__(231),
|
118 | cloneDeep: __webpack_require__(102),
|
119 | maxBy: __webpack_require__(256),
|
120 | minBy: __webpack_require__(258),
|
121 | round: __webpack_require__(260),
|
122 | filter: __webpack_require__(262),
|
123 | isEqualWith: __webpack_require__(264),
|
124 | isEqual: __webpack_require__(265),
|
125 | replace: __webpack_require__(266),
|
126 | union: __webpack_require__(267),
|
127 | pick: __webpack_require__(274),
|
128 | uniq: __webpack_require__(280),
|
129 | snapEqual: function snapEqual(v1, v2) {
|
130 | return Math.abs(v1 - v2) < 0.001;
|
131 | },
|
132 | fixedBase: function fixedBase(v, base) {
|
133 | var str = base.toString();
|
134 | var index = str.indexOf('.');
|
135 | if (index === -1) {
|
136 | return Math.round(v);
|
137 | }
|
138 | var length = str.substr(index + 1).length;
|
139 | if (length > 20) {
|
140 | length = 20;
|
141 | }
|
142 | return parseFloat(v.toFixed(length));
|
143 | },
|
144 | mix: function mix(dist, obj1, obj2, obj3) {
|
145 | if (obj1) {
|
146 | _mix(dist, obj1);
|
147 | }
|
148 |
|
149 | if (obj2) {
|
150 | _mix(dist, obj2);
|
151 | }
|
152 |
|
153 | if (obj3) {
|
154 | _mix(dist, obj3);
|
155 | }
|
156 | return dist;
|
157 | },
|
158 | inArray: function inArray(arr, value) {
|
159 | return arr.indexOf(value) >= 0;
|
160 | },
|
161 |
|
162 | |
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 | wrapBehavior: function wrapBehavior(obj, action) {
|
170 | if (obj['_wrap_' + action]) {
|
171 | return obj['_wrap_' + action];
|
172 | }
|
173 | var method = function method(e) {
|
174 | obj[action](e);
|
175 | };
|
176 | obj['_wrap_' + action] = method;
|
177 | return method;
|
178 | },
|
179 |
|
180 | |
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 | getWrapBehavior: function getWrapBehavior(obj, action) {
|
188 | return obj['_wrap_' + action];
|
189 | },
|
190 |
|
191 | |
192 |
|
193 |
|
194 |
|
195 |
|
196 | toAllPadding: function toAllPadding(padding) {
|
197 | var top = 0;
|
198 | var left = 0;
|
199 | var right = 0;
|
200 | var bottom = 0;
|
201 |
|
202 | if (Util.isNumber(padding) || Util.isString(padding)) {
|
203 | top = left = right = bottom = padding;
|
204 | } else if (Util.isArray(padding)) {
|
205 | top = padding[0];
|
206 | right = !Util.isNil(padding[1]) ? padding[1] : padding[0];
|
207 | bottom = !Util.isNil(padding[2]) ? padding[2] : padding[0];
|
208 | left = !Util.isNil(padding[3]) ? padding[3] : right;
|
209 | } else if (Util.isObject(padding)) {
|
210 | top = padding.top || 0;
|
211 | right = padding.right || 0;
|
212 | bottom = padding.bottom || 0;
|
213 | left = padding.left || 0;
|
214 | }
|
215 | return [top, right, bottom, left];
|
216 | },
|
217 |
|
218 | |
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 | substitute: function substitute(str, o) {
|
225 | if (!str || !o) {
|
226 | return str;
|
227 | }
|
228 | return str.replace(/\\?\{([^{}]+)\}/g, function (match, name) {
|
229 | if (match.charAt(0) === '\\') {
|
230 | return match.slice(1);
|
231 | }
|
232 | return o[name] === undefined ? '' : o[name];
|
233 | });
|
234 | }
|
235 | };
|
236 |
|
237 | function deepMix(dst, src, level) {
|
238 | level = level || 0;
|
239 | for (var k in src) {
|
240 | if (src.hasOwnProperty(k)) {
|
241 | var value = src[k];
|
242 | if (value !== null && Util.isPlainObject(value)) {
|
243 | if (!Util.isPlainObject(dst[k])) {
|
244 | dst[k] = {};
|
245 | }
|
246 | if (level < MAX_LEVEL) {
|
247 | deepMix(dst[k], src[k], level + 1);
|
248 | } else {
|
249 | dst[k] = src[k];
|
250 | }
|
251 | } else if (Util.isArray(value)) {
|
252 | dst[k] = [];
|
253 | dst[k] = dst[k].concat(value);
|
254 | } else if (value !== undefined) {
|
255 | dst[k] = src[k];
|
256 | }
|
257 | }
|
258 | }
|
259 | }
|
260 |
|
261 | Util.deepMix = function () {
|
262 | var args = Util.toArray(arguments);
|
263 | var rst = args[0];
|
264 | for (var i = 1; i < args.length; i++) {
|
265 | var source = args[i];
|
266 | deepMix(rst, source);
|
267 | }
|
268 | return rst;
|
269 | };
|
270 |
|
271 | Util.Array = {
|
272 | merge: function merge(dataArray) {
|
273 | var rst = [];
|
274 | for (var i = 0; i < dataArray.length; i++) {
|
275 | rst = rst.concat(dataArray[i]);
|
276 | }
|
277 | return rst;
|
278 | },
|
279 | values: function values(data, name) {
|
280 | var rst = [];
|
281 | var tmpMap = {};
|
282 | for (var i = 0; i < data.length; i++) {
|
283 | var obj = data[i];
|
284 | var value = obj[name];
|
285 | if (!Util.isNil(value)) {
|
286 | if (!Util.isArray(value)) {
|
287 | value = [value];
|
288 | }
|
289 | Util.each(value, function (val) {
|
290 | if (!tmpMap[val]) {
|
291 | rst.push(val);
|
292 | tmpMap[val] = true;
|
293 | }
|
294 | });
|
295 | }
|
296 | }
|
297 | return rst;
|
298 | },
|
299 | getRange: function getRange(values) {
|
300 | if (!values.length) {
|
301 |
|
302 | return {
|
303 | min: 0,
|
304 | max: 0
|
305 | };
|
306 | }
|
307 | if (Util.isArray(values[0])) {
|
308 | var tmp = [];
|
309 | for (var i = 0; i < values.length; i++) {
|
310 | tmp = tmp.concat(values[i]);
|
311 | }
|
312 | values = tmp;
|
313 | }
|
314 | var max = Math.max.apply(null, values);
|
315 | var min = Math.min.apply(null, values);
|
316 | return {
|
317 | min: min,
|
318 | max: max
|
319 | };
|
320 | },
|
321 | firstValue: function firstValue(data, name) {
|
322 | var rst = null;
|
323 | for (var i = 0; i < data.length; i++) {
|
324 | var obj = data[i];
|
325 | var value = obj[name];
|
326 | if (!Util.isNil(value)) {
|
327 | if (Util.isArray(value)) {
|
328 | rst = value[0];
|
329 | } else {
|
330 | rst = value;
|
331 | }
|
332 | break;
|
333 | }
|
334 | }
|
335 | return rst;
|
336 | },
|
337 | group: function group(data, condition) {
|
338 | if (!condition) {
|
339 | return [data];
|
340 | }
|
341 | var groups = Util.Array.groupToMap(data, condition);
|
342 | var array = [];
|
343 | for (var i in groups) {
|
344 | array.push(groups[i]);
|
345 | }
|
346 | return array;
|
347 | },
|
348 | groupToMap: function groupToMap(data, condition) {
|
349 | if (!condition) {
|
350 | return {
|
351 | 0: data
|
352 | };
|
353 | }
|
354 | if (!Util.isFunction(condition)) {
|
355 | var paramsCondition = Util.isArray(condition) ? condition : condition.replace(/\s+/g, '').split('*');
|
356 | condition = function condition(row) {
|
357 | var unique = '_';
|
358 | for (var i = 0, l = paramsCondition.length; i < l; i++) {
|
359 | unique += row[paramsCondition[i]] && row[paramsCondition[i]].toString();
|
360 | }
|
361 | return unique;
|
362 | };
|
363 | }
|
364 | var groups = Util.groupBy(data, condition);
|
365 | return groups;
|
366 | },
|
367 | remove: function remove(arr, obj) {
|
368 | var index = Util.indexOf(arr, obj);
|
369 | if (index !== -1) {
|
370 | arr.splice(index, 1);
|
371 | }
|
372 | }
|
373 | };
|
374 |
|
375 | module.exports = Util;
|
376 |
|
377 | }),
|
378 |
|
379 | (function(module, exports, __webpack_require__) {
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 | var Util = __webpack_require__(0);
|
386 | var Theme = __webpack_require__(292);
|
387 |
|
388 | var Global = {};
|
389 | var Default = {
|
390 | version: '3.0.2-beta.1',
|
391 | trackable: true,
|
392 | animate: true,
|
393 | snapArray: [0, 1, 2, 4, 5, 10],
|
394 |
|
395 | snapCountArray: [0, 1, 1.2, 1.5, 1.6, 2, 2.2, 2.4, 3, 4, 5, 6, 7.5, 8, 10],
|
396 | widthRatio: {
|
397 | column: 1 / 2,
|
398 | rose: 0.9999999,
|
399 | multiplePie: 1 / 1.3
|
400 | },
|
401 |
|
402 | showSinglePoint: false,
|
403 | connectNulls: false,
|
404 | scales: {}
|
405 | };
|
406 |
|
407 | function setTheme(theme) {
|
408 | for (var k in Global) {
|
409 | if (Global.hasOwnProperty(k)) {
|
410 | delete Global[k];
|
411 | }
|
412 | }
|
413 |
|
414 | var newTheme = {};
|
415 | if (Util.isObject(theme)) {
|
416 | newTheme = theme;
|
417 | } else if (Util.indexOf(Object.keys(Theme), theme) !== -1) {
|
418 | newTheme = Theme[theme];
|
419 | } else {
|
420 | newTheme = Theme.default;
|
421 | }
|
422 | Util.deepMix(Global, Default, newTheme);
|
423 | Global.setTheme = setTheme;
|
424 | }
|
425 |
|
426 | setTheme('default');
|
427 |
|
428 | module.exports = Global;
|
429 |
|
430 | }),
|
431 |
|
432 | (function(module, exports, __webpack_require__) {
|
433 |
|
434 | (function(module) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
435 |
|
436 | (function webpackUniversalModuleDefinition(root, factory) {
|
437 | if (( false ? 'undefined' : _typeof2(exports)) === 'object' && ( false ? 'undefined' : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
438 | __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
439 | (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
440 | __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else if ((typeof exports === 'undefined' ? 'undefined' : _typeof2(exports)) === 'object') exports["G"] = factory();else root["G"] = factory();
|
441 | })(this, function () {
|
442 | return (function (modules) {
|
443 |
|
444 |
|
445 | var installedModules = {};
|
446 |
|
447 |
|
448 | function __webpack_require__(moduleId) {
|
449 |
|
450 |
|
451 | if (installedModules[moduleId]) {
|
452 | return installedModules[moduleId].exports;
|
453 |
|
454 | }
|
455 |
|
456 | var module = installedModules[moduleId] = {
|
457 | i: moduleId,
|
458 | l: false,
|
459 | exports: {}
|
460 | };
|
461 |
|
462 |
|
463 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
464 |
|
465 |
|
466 | module.l = true;
|
467 |
|
468 |
|
469 | return module.exports;
|
470 |
|
471 | }
|
472 |
|
473 |
|
474 |
|
475 | __webpack_require__.m = modules;
|
476 |
|
477 |
|
478 | __webpack_require__.c = installedModules;
|
479 |
|
480 |
|
481 | __webpack_require__.d = function (exports, name, getter) {
|
482 | if (!__webpack_require__.o(exports, name)) {
|
483 | Object.defineProperty(exports, name, {
|
484 | configurable: false,
|
485 | enumerable: true,
|
486 | get: getter
|
487 | /******/ });
|
488 | /******/
|
489 | }
|
490 | /******/
|
491 | };
|
492 | /******/
|
493 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
494 | /******/__webpack_require__.n = function (module) {
|
495 | var getter = module && module.__esModule ?
|
496 | function getDefault() {
|
497 | return module['default'];
|
498 | } :
|
499 | function getModuleExports() {
|
500 | return module;
|
501 | };
|
502 | __webpack_require__.d(getter, 'a', getter);
|
503 | return getter;
|
504 |
|
505 | };
|
506 |
|
507 |
|
508 | __webpack_require__.o = function (object, property) {
|
509 | return Object.prototype.hasOwnProperty.call(object, property);
|
510 | };
|
511 |
|
512 |
|
513 | __webpack_require__.p = "";
|
514 |
|
515 |
|
516 | return __webpack_require__(__webpack_require__.s = 112);
|
517 |
|
518 | }(
|
519 |
|
520 | [
|
521 |
|
522 | function (module, exports, __webpack_require__) {
|
523 |
|
524 | var CommonUtil = __webpack_require__(31);
|
525 | var DomUtil = __webpack_require__(85);
|
526 |
|
527 | var Util = {};
|
528 |
|
529 | CommonUtil.merge(Util, CommonUtil, DomUtil, {
|
530 | mixin: function mixin(c, mixins) {
|
531 | var Param = c.CFG ? 'CFG' : 'ATTRS';
|
532 | if (c && mixins) {
|
533 | c._mixins = mixins;
|
534 | c[Param] = c[Param] || {};
|
535 | var temp = {};
|
536 | Util.each(mixins, function (mixin) {
|
537 | Util.augment(c, mixin);
|
538 | var attrs = mixin[Param];
|
539 | if (attrs) {
|
540 | Util.merge(temp, attrs);
|
541 | }
|
542 | });
|
543 | c[Param] = Util.merge(temp, c[Param]);
|
544 | }
|
545 | }
|
546 | });
|
547 |
|
548 | module.exports = Util;
|
549 |
|
550 |
|
551 | },
|
552 |
|
553 | function (module, exports, __webpack_require__) {
|
554 |
|
555 | var Util = __webpack_require__(0);
|
556 | var Element = __webpack_require__(88);
|
557 | var Inside = __webpack_require__(2);
|
558 |
|
559 | var Shape = function Shape(cfg) {
|
560 | Shape.superclass.constructor.call(this, cfg);
|
561 | };
|
562 |
|
563 | Shape.ATTRS = {};
|
564 |
|
565 | Util.extend(Shape, Element);
|
566 |
|
567 | Util.augment(Shape, {
|
568 | isShape: true,
|
569 | createPath: function createPath() {},
|
570 | drawInner: function drawInner(context) {
|
571 | var self = this;
|
572 | var attrs = self.__attrs;
|
573 | self.createPath(context);
|
574 | var originOpacity = context.globalAlpha;
|
575 | if (self.hasFill()) {
|
576 | var fillOpacity = attrs.fillOpacity;
|
577 | if (!Util.isNil(fillOpacity) && fillOpacity !== 1) {
|
578 | context.globalAlpha = fillOpacity;
|
579 | context.fill();
|
580 | context.globalAlpha = originOpacity;
|
581 | } else {
|
582 | context.fill();
|
583 | }
|
584 | }
|
585 | if (self.hasStroke()) {
|
586 | var lineWidth = self.__attrs.lineWidth;
|
587 | if (lineWidth > 0) {
|
588 | var strokeOpacity = attrs.strokeOpacity;
|
589 | if (!Util.isNil(strokeOpacity) && strokeOpacity !== 1) {
|
590 | context.globalAlpha = strokeOpacity;
|
591 | }
|
592 | context.stroke();
|
593 | }
|
594 | }
|
595 | },
|
596 |
|
597 | |
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 | isPointInPath: function isPointInPath() {
|
604 | return false;
|
605 | },
|
606 |
|
607 | |
608 |
|
609 |
|
610 |
|
611 | isHitBox: function isHitBox() {
|
612 | return true;
|
613 | },
|
614 |
|
615 | |
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 | isHit: function isHit(x, y) {
|
622 | var self = this;
|
623 | var v = [x, y, 1];
|
624 | self.invert(v);
|
625 |
|
626 | if (self.isHitBox()) {
|
627 | var box = self.getBBox();
|
628 | if (box && !Inside.box(box.minX, box.maxX, box.minY, box.maxY, v[0], v[1])) {
|
629 | return false;
|
630 | }
|
631 | }
|
632 | var clip = self.__attrs.clip;
|
633 | if (clip) {
|
634 | if (clip.inside(x, y)) {
|
635 | return self.isPointInPath(v[0], v[1]);
|
636 | }
|
637 | } else {
|
638 | return self.isPointInPath(v[0], v[1]);
|
639 | }
|
640 | return false;
|
641 | },
|
642 |
|
643 | |
644 |
|
645 |
|
646 |
|
647 |
|
648 | calculateBox: function calculateBox() {
|
649 | return null;
|
650 | },
|
651 |
|
652 |
|
653 | clearTotalMatrix: function clearTotalMatrix() {
|
654 | this.__cfg.totalMatrix = null;
|
655 | this.__cfg.region = null;
|
656 | },
|
657 | clearBBox: function clearBBox() {
|
658 | this.__cfg.box = null;
|
659 | this.__cfg.region = null;
|
660 | },
|
661 | getBBox: function getBBox() {
|
662 | var box = this.__cfg.box;
|
663 |
|
664 | if (!box) {
|
665 | box = this.calculateBox();
|
666 | if (box) {
|
667 | box.x = box.minX;
|
668 | box.y = box.minY;
|
669 | box.width = box.maxX - box.minX;
|
670 | box.height = box.maxY - box.minY;
|
671 | }
|
672 | this.__cfg.box = box;
|
673 | }
|
674 | return box;
|
675 | }
|
676 | });
|
677 |
|
678 | module.exports = Shape;
|
679 |
|
680 |
|
681 | },
|
682 |
|
683 | function (module, exports, __webpack_require__) {
|
684 |
|
685 | var Line = __webpack_require__(52);
|
686 | var Quadratic = __webpack_require__(53);
|
687 | var Cubic = __webpack_require__(30);
|
688 | var Arc = __webpack_require__(54);
|
689 |
|
690 | module.exports = {
|
691 | line: function line(x1, y1, x2, y2, lineWidth, x, y) {
|
692 | var box = Line.box(x1, y1, x2, y2, lineWidth);
|
693 |
|
694 | if (!this.box(box.minX, box.maxX, box.minY, box.maxY, x, y)) {
|
695 | return false;
|
696 | }
|
697 |
|
698 | var d = Line.pointDistance(x1, y1, x2, y2, x, y);
|
699 | if (isNaN(d)) {
|
700 | return false;
|
701 | }
|
702 | return d <= lineWidth / 2;
|
703 | },
|
704 | polyline: function polyline(points, lineWidth, x, y) {
|
705 | var l = points.length - 1;
|
706 | if (l < 1) {
|
707 | return false;
|
708 | }
|
709 | for (var i = 0; i < l; i++) {
|
710 | var x1 = points[i][0];
|
711 | var y1 = points[i][1];
|
712 | var x2 = points[i + 1][0];
|
713 | var y2 = points[i + 1][1];
|
714 |
|
715 | if (this.line(x1, y1, x2, y2, lineWidth, x, y)) {
|
716 | return true;
|
717 | }
|
718 | }
|
719 |
|
720 | return false;
|
721 | },
|
722 | cubicline: function cubicline(x1, y1, x2, y2, x3, y3, x4, y4, lineWidth, x, y) {
|
723 | return Cubic.pointDistance(x1, y1, x2, y2, x3, y3, x4, y4, x, y) <= lineWidth / 2;
|
724 | },
|
725 | quadraticline: function quadraticline(x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
|
726 | return Quadratic.pointDistance(x1, y1, x2, y2, x3, y3, x, y) <= lineWidth / 2;
|
727 | },
|
728 | arcline: function arcline(cx, cy, r, startAngle, endAngle, clockwise, lineWidth, x, y) {
|
729 | return Arc.pointDistance(cx, cy, r, startAngle, endAngle, clockwise, x, y) <= lineWidth / 2;
|
730 | },
|
731 | rect: function rect(rx, ry, width, height, x, y) {
|
732 | return rx <= x && x <= rx + width && ry <= y && y <= ry + height;
|
733 | },
|
734 | circle: function circle(cx, cy, r, x, y) {
|
735 | return Math.pow(x - cx, 2) + Math.pow(y - cy, 2) <= Math.pow(r, 2);
|
736 | },
|
737 | box: function box(minX, maxX, minY, maxY, x, y) {
|
738 | return minX <= x && x <= maxX && minY <= y && y <= maxY;
|
739 | }
|
740 | };
|
741 |
|
742 |
|
743 | },
|
744 |
|
745 | function (module, exports, __webpack_require__) {
|
746 |
|
747 | var CommonUtil = __webpack_require__(31);
|
748 | var mat3 = __webpack_require__(230);
|
749 | var vec3 = __webpack_require__(231);
|
750 | var vec2 = __webpack_require__(232);
|
751 |
|
752 | vec2.angle = function (v1, v2) {
|
753 | var theta = vec2.dot(v1, v2) / (vec2.length(v1) * vec2.length(v2));
|
754 | return Math.acos(CommonUtil.clamp(theta, -1, 1));
|
755 | };
|
756 | |
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 | vec2.direction = function (v1, v2) {
|
763 | return v1[0] * v2[1] - v2[0] * v1[1];
|
764 | };
|
765 | vec2.angleTo = function (v1, v2, direct) {
|
766 | var angle = vec2.angle(v1, v2);
|
767 | var angleLargeThanPI = vec2.direction(v1, v2) >= 0;
|
768 | if (direct) {
|
769 | if (angleLargeThanPI) {
|
770 | return Math.PI * 2 - angle;
|
771 | }
|
772 |
|
773 | return angle;
|
774 | }
|
775 |
|
776 | if (angleLargeThanPI) {
|
777 | return angle;
|
778 | }
|
779 | return Math.PI * 2 - angle;
|
780 | };
|
781 | vec2.vertical = function (out, v, flag) {
|
782 | if (flag) {
|
783 | out[0] = v[1];
|
784 | out[1] = -1 * v[0];
|
785 | } else {
|
786 | out[0] = -1 * v[1];
|
787 | out[1] = v[0];
|
788 | }
|
789 |
|
790 | return out;
|
791 | };
|
792 |
|
793 | mat3.translate = function (out, a, v) {
|
794 | var transMat = new Array(9);
|
795 | mat3.fromTranslation(transMat, v);
|
796 | return mat3.multiply(out, transMat, a);
|
797 | };
|
798 |
|
799 | mat3.rotate = function (out, a, rad) {
|
800 | var rotateMat = new Array(9);
|
801 | mat3.fromRotation(rotateMat, rad);
|
802 | return mat3.multiply(out, rotateMat, a);
|
803 | };
|
804 |
|
805 | mat3.scale = function (out, a, v) {
|
806 | var scaleMat = new Array(9);
|
807 | mat3.fromScaling(scaleMat, v);
|
808 | return mat3.multiply(out, scaleMat, a);
|
809 | };
|
810 |
|
811 | module.exports = {
|
812 | mat3: mat3,
|
813 | vec2: vec2,
|
814 | vec3: vec3,
|
815 | transform: function transform(m, ts) {
|
816 | m = CommonUtil.clone(m);
|
817 | CommonUtil.each(ts, function (t) {
|
818 | switch (t[0]) {
|
819 | case 't':
|
820 | mat3.translate(m, m, [t[1], t[2]]);
|
821 | break;
|
822 | case 's':
|
823 | mat3.scale(m, m, [t[1], t[2]]);
|
824 | break;
|
825 | case 'r':
|
826 | mat3.rotate(m, m, t[1]);
|
827 | break;
|
828 | case 'm':
|
829 | mat3.multiply(m, m, t[1]);
|
830 | break;
|
831 | default:
|
832 | return false;
|
833 | }
|
834 | });
|
835 | return m;
|
836 | }
|
837 | };
|
838 |
|
839 |
|
840 | },
|
841 |
|
842 | function (module, exports, __webpack_require__) {
|
843 |
|
844 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
845 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
846 | } : function (obj) {
|
847 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
848 | };
|
849 |
|
850 | var freeGlobal = __webpack_require__(55);
|
851 |
|
852 |
|
853 | var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self;
|
854 |
|
855 |
|
856 | var root = freeGlobal || freeSelf || Function('return this')();
|
857 |
|
858 | module.exports = root;
|
859 |
|
860 |
|
861 | },
|
862 |
|
863 | function (module, exports) {
|
864 |
|
865 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
866 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
867 | } : function (obj) {
|
868 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
869 | };
|
870 |
|
871 | |
872 |
|
873 |
|
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 | function isObjectLike(value) {
|
896 | return value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object';
|
897 | }
|
898 |
|
899 | module.exports = isObjectLike;
|
900 |
|
901 |
|
902 | },
|
903 |
|
904 | function (module, exports) {
|
905 |
|
906 | |
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 | var isArray = Array.isArray;
|
930 |
|
931 | module.exports = isArray;
|
932 |
|
933 |
|
934 | },
|
935 |
|
936 | function (module, exports, __webpack_require__) {
|
937 |
|
938 | var _Symbol = __webpack_require__(11),
|
939 | getRawTag = __webpack_require__(115),
|
940 | objectToString = __webpack_require__(116);
|
941 |
|
942 |
|
943 | var nullTag = '[object Null]',
|
944 | undefinedTag = '[object Undefined]';
|
945 |
|
946 |
|
947 | var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
948 |
|
949 | |
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 | function baseGetTag(value) {
|
957 | if (value == null) {
|
958 | return value === undefined ? undefinedTag : nullTag;
|
959 | }
|
960 | return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
961 | }
|
962 |
|
963 | module.exports = baseGetTag;
|
964 |
|
965 |
|
966 | },
|
967 |
|
968 | function (module, exports) {
|
969 |
|
970 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
971 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
972 | } : function (obj) {
|
973 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
974 | };
|
975 |
|
976 | |
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 | function isObject(value) {
|
1002 | var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
1003 | return value != null && (type == 'object' || type == 'function');
|
1004 | }
|
1005 |
|
1006 | module.exports = isObject;
|
1007 |
|
1008 |
|
1009 | },
|
1010 |
|
1011 | function (module, exports, __webpack_require__) {
|
1012 |
|
1013 | var isFunction = __webpack_require__(20),
|
1014 | isLength = __webpack_require__(60);
|
1015 |
|
1016 | |
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 | function isArrayLike(value) {
|
1042 | return value != null && isLength(value.length) && !isFunction(value);
|
1043 | }
|
1044 |
|
1045 | module.exports = isArrayLike;
|
1046 |
|
1047 |
|
1048 | },
|
1049 |
|
1050 | function (module, exports, __webpack_require__) {
|
1051 |
|
1052 | var baseIsNative = __webpack_require__(123),
|
1053 | getValue = __webpack_require__(126);
|
1054 |
|
1055 | |
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 | function getNative(object, key) {
|
1064 | var value = getValue(object, key);
|
1065 | return baseIsNative(value) ? value : undefined;
|
1066 | }
|
1067 |
|
1068 | module.exports = getNative;
|
1069 |
|
1070 |
|
1071 | },
|
1072 |
|
1073 | function (module, exports, __webpack_require__) {
|
1074 |
|
1075 | var root = __webpack_require__(4);
|
1076 |
|
1077 |
|
1078 | var _Symbol = root.Symbol;
|
1079 |
|
1080 | module.exports = _Symbol;
|
1081 |
|
1082 |
|
1083 | },
|
1084 |
|
1085 | function (module, exports, __webpack_require__) {
|
1086 |
|
1087 | var assignValue = __webpack_require__(37),
|
1088 | baseAssignValue = __webpack_require__(38);
|
1089 |
|
1090 | |
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 | function copyObject(source, props, object, customizer) {
|
1101 | var isNew = !object;
|
1102 | object || (object = {});
|
1103 |
|
1104 | var index = -1,
|
1105 | length = props.length;
|
1106 |
|
1107 | while (++index < length) {
|
1108 | var key = props[index];
|
1109 |
|
1110 | var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
|
1111 |
|
1112 | if (newValue === undefined) {
|
1113 | newValue = source[key];
|
1114 | }
|
1115 | if (isNew) {
|
1116 | baseAssignValue(object, key, newValue);
|
1117 | } else {
|
1118 | assignValue(object, key, newValue);
|
1119 | }
|
1120 | }
|
1121 | return object;
|
1122 | }
|
1123 |
|
1124 | module.exports = copyObject;
|
1125 |
|
1126 |
|
1127 | },
|
1128 |
|
1129 | function (module, exports, __webpack_require__) {
|
1130 |
|
1131 | var arrayLikeKeys = __webpack_require__(66),
|
1132 | baseKeys = __webpack_require__(57),
|
1133 | isArrayLike = __webpack_require__(9);
|
1134 |
|
1135 | |
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 | function keys(object) {
|
1164 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
1165 | }
|
1166 |
|
1167 | module.exports = keys;
|
1168 |
|
1169 |
|
1170 | },
|
1171 |
|
1172 | function (module, __webpack_exports__, __webpack_require__) {
|
1173 |
|
1174 | "use strict";
|
1175 |
|
1176 | var __WEBPACK_IMPORTED_MODULE_0__src_color__ = __webpack_require__(49);
|
1177 | __webpack_require__.d(__webpack_exports__, "a", function () {
|
1178 | return __WEBPACK_IMPORTED_MODULE_0__src_color__["e"];
|
1179 | });
|
1180 | __webpack_require__.d(__webpack_exports__, "f", function () {
|
1181 | return __WEBPACK_IMPORTED_MODULE_0__src_color__["g"];
|
1182 | });
|
1183 | __webpack_require__.d(__webpack_exports__, "d", function () {
|
1184 | return __WEBPACK_IMPORTED_MODULE_0__src_color__["f"];
|
1185 | });
|
1186 | var __WEBPACK_IMPORTED_MODULE_1__src_lab__ = __webpack_require__(249);
|
1187 | __webpack_require__.d(__webpack_exports__, "e", function () {
|
1188 | return __WEBPACK_IMPORTED_MODULE_1__src_lab__["a"];
|
1189 | });
|
1190 | __webpack_require__.d(__webpack_exports__, "c", function () {
|
1191 | return __WEBPACK_IMPORTED_MODULE_1__src_lab__["b"];
|
1192 | });
|
1193 | var __WEBPACK_IMPORTED_MODULE_2__src_cubehelix__ = __webpack_require__(250);
|
1194 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
1195 | return __WEBPACK_IMPORTED_MODULE_2__src_cubehelix__["a"];
|
1196 | });
|
1197 |
|
1198 |
|
1199 | },
|
1200 |
|
1201 | function (module, exports) {
|
1202 |
|
1203 | var PI = Math.PI;
|
1204 | var sin = Math.sin;
|
1205 | var cos = Math.cos;
|
1206 | var atan2 = Math.atan2;
|
1207 | var DEFAULT_LENGTH = 10;
|
1208 | var DEFAULT_ANGLE = PI / 3;
|
1209 |
|
1210 | function _addArrow(ctx, attrs, x1, y1, x2, y2) {
|
1211 | var leftX = void 0;
|
1212 | var leftY = void 0;
|
1213 | var rightX = void 0;
|
1214 | var rightY = void 0;
|
1215 | var offsetX = void 0;
|
1216 | var offsetY = void 0;
|
1217 | var angle = void 0;
|
1218 |
|
1219 | if (!attrs.fill) {
|
1220 |
|
1221 | var arrowLength = attrs.arrowLength || DEFAULT_LENGTH;
|
1222 | var arrowAngle = attrs.arrowAngle ? attrs.arrowAngle * PI / 180 : DEFAULT_ANGLE;
|
1223 |
|
1224 |
|
1225 | angle = atan2(y2 - y1, x2 - x1);
|
1226 |
|
1227 | angle -= PI;
|
1228 |
|
1229 | offsetX = attrs.lineWidth * cos(angle);
|
1230 | offsetY = attrs.lineWidth * sin(angle);
|
1231 |
|
1232 |
|
1233 | leftX = x2 + arrowLength * cos(angle + arrowAngle / 2);
|
1234 | leftY = y2 + arrowLength * sin(angle + arrowAngle / 2);
|
1235 |
|
1236 | rightX = x2 + arrowLength * cos(angle - arrowAngle / 2);
|
1237 | rightY = y2 + arrowLength * sin(angle - arrowAngle / 2);
|
1238 |
|
1239 |
|
1240 | ctx.moveTo(leftX - offsetX, leftY - offsetY);
|
1241 | ctx.lineTo(x2 - offsetX, y2 - offsetY);
|
1242 |
|
1243 | ctx.lineTo(rightX - offsetX, rightY - offsetY);
|
1244 |
|
1245 |
|
1246 | ctx.moveTo(x2 - offsetX, y2 - offsetY);
|
1247 | ctx.lineTo(x2 + offsetX, y2 + offsetY);
|
1248 |
|
1249 | ctx.moveTo(x2, y2);
|
1250 | }
|
1251 | }
|
1252 |
|
1253 | module.exports = {
|
1254 | addStartArrow: function addStartArrow(ctx, attrs, x1, y1, x2, y2) {
|
1255 | if (attrs.startArrow) {
|
1256 | _addArrow(ctx, attrs, x1, y1, x2, y2);
|
1257 | }
|
1258 | },
|
1259 | addEndArrow: function addEndArrow(ctx, attrs, x1, y1, x2, y2) {
|
1260 | if (attrs.endArrow) {
|
1261 | _addArrow(ctx, attrs, x1, y1, x2, y2);
|
1262 | }
|
1263 | }
|
1264 | };
|
1265 |
|
1266 |
|
1267 | },
|
1268 |
|
1269 | function (module, exports) {
|
1270 |
|
1271 |
|
1272 | var objectProto = Object.prototype;
|
1273 |
|
1274 | |
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 | function isPrototype(value) {
|
1282 | var Ctor = value && value.constructor,
|
1283 | proto = typeof Ctor == 'function' && Ctor.prototype || objectProto;
|
1284 |
|
1285 | return value === proto;
|
1286 | }
|
1287 |
|
1288 | module.exports = isPrototype;
|
1289 |
|
1290 |
|
1291 | },
|
1292 |
|
1293 | function (module, exports, __webpack_require__) {
|
1294 |
|
1295 | (function (module) {
|
1296 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
1297 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
1298 | } : function (obj) {
|
1299 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
1300 | };
|
1301 |
|
1302 | var root = __webpack_require__(4),
|
1303 | stubFalse = __webpack_require__(131);
|
1304 |
|
1305 |
|
1306 | var freeExports = (false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
|
1307 |
|
1308 |
|
1309 | var freeModule = freeExports && (false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
|
1310 |
|
1311 |
|
1312 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
1313 |
|
1314 |
|
1315 | var Buffer = moduleExports ? root.Buffer : undefined;
|
1316 |
|
1317 |
|
1318 | var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
1319 |
|
1320 | |
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 | var isBuffer = nativeIsBuffer || stubFalse;
|
1338 |
|
1339 | module.exports = isBuffer;
|
1340 |
|
1341 | }).call(exports, __webpack_require__(34)(module));
|
1342 |
|
1343 |
|
1344 | },
|
1345 |
|
1346 | function (module, exports) {
|
1347 |
|
1348 | |
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 |
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 | function eq(value, other) {
|
1381 | return value === other || value !== value && other !== other;
|
1382 | }
|
1383 |
|
1384 | module.exports = eq;
|
1385 |
|
1386 |
|
1387 | },
|
1388 |
|
1389 | function (module, __webpack_exports__, __webpack_require__) {
|
1390 |
|
1391 | "use strict";
|
1392 |
|
1393 | __webpack_exports__["c"] = hue;
|
1394 | __webpack_exports__["b"] = gamma;
|
1395 | __webpack_exports__["a"] = nogamma;
|
1396 | var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__(92);
|
1397 |
|
1398 | function linear(a, d) {
|
1399 | return function (t) {
|
1400 | return a + t * d;
|
1401 | };
|
1402 | }
|
1403 |
|
1404 | function exponential(a, b, y) {
|
1405 | return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function (t) {
|
1406 | return Math.pow(a + t * b, y);
|
1407 | };
|
1408 | }
|
1409 |
|
1410 | function hue(a, b) {
|
1411 | var d = b - a;
|
1412 | return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" ])(isNaN(a) ? b : a);
|
1413 | }
|
1414 |
|
1415 | function gamma(y) {
|
1416 | return (y = +y) === 1 ? nogamma : function (a, b) {
|
1417 | return b - a ? exponential(a, b, y) : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" ])(isNaN(a) ? b : a);
|
1418 | };
|
1419 | }
|
1420 |
|
1421 | function nogamma(a, b) {
|
1422 | var d = b - a;
|
1423 | return d ? linear(a, d) : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" ])(isNaN(a) ? b : a);
|
1424 | }
|
1425 |
|
1426 |
|
1427 | },
|
1428 |
|
1429 | function (module, exports, __webpack_require__) {
|
1430 |
|
1431 | var baseGetTag = __webpack_require__(7),
|
1432 | isObject = __webpack_require__(8);
|
1433 |
|
1434 |
|
1435 | var asyncTag = '[object AsyncFunction]',
|
1436 | funcTag = '[object Function]',
|
1437 | genTag = '[object GeneratorFunction]',
|
1438 | proxyTag = '[object Proxy]';
|
1439 |
|
1440 | |
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 | function isFunction(value) {
|
1458 | if (!isObject(value)) {
|
1459 | return false;
|
1460 | }
|
1461 |
|
1462 |
|
1463 | var tag = baseGetTag(value);
|
1464 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
1465 | }
|
1466 |
|
1467 | module.exports = isFunction;
|
1468 |
|
1469 |
|
1470 | },
|
1471 |
|
1472 | function (module, exports, __webpack_require__) {
|
1473 |
|
1474 | var DataView = __webpack_require__(122),
|
1475 | Map = __webpack_require__(32),
|
1476 | Promise = __webpack_require__(127),
|
1477 | Set = __webpack_require__(128),
|
1478 | WeakMap = __webpack_require__(129),
|
1479 | baseGetTag = __webpack_require__(7),
|
1480 | toSource = __webpack_require__(59);
|
1481 |
|
1482 |
|
1483 | var mapTag = '[object Map]',
|
1484 | objectTag = '[object Object]',
|
1485 | promiseTag = '[object Promise]',
|
1486 | setTag = '[object Set]',
|
1487 | weakMapTag = '[object WeakMap]';
|
1488 |
|
1489 | var dataViewTag = '[object DataView]';
|
1490 |
|
1491 |
|
1492 | var dataViewCtorString = toSource(DataView),
|
1493 | mapCtorString = toSource(Map),
|
1494 | promiseCtorString = toSource(Promise),
|
1495 | setCtorString = toSource(Set),
|
1496 | weakMapCtorString = toSource(WeakMap);
|
1497 |
|
1498 | |
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 | var getTag = baseGetTag;
|
1506 |
|
1507 |
|
1508 | if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
1509 | getTag = function getTag(value) {
|
1510 | var result = baseGetTag(value),
|
1511 | Ctor = result == objectTag ? value.constructor : undefined,
|
1512 | ctorString = Ctor ? toSource(Ctor) : '';
|
1513 |
|
1514 | if (ctorString) {
|
1515 | switch (ctorString) {
|
1516 | case dataViewCtorString:
|
1517 | return dataViewTag;
|
1518 | case mapCtorString:
|
1519 | return mapTag;
|
1520 | case promiseCtorString:
|
1521 | return promiseTag;
|
1522 | case setCtorString:
|
1523 | return setTag;
|
1524 | case weakMapCtorString:
|
1525 | return weakMapTag;
|
1526 | }
|
1527 | }
|
1528 | return result;
|
1529 | };
|
1530 | }
|
1531 |
|
1532 | module.exports = getTag;
|
1533 |
|
1534 |
|
1535 | },
|
1536 |
|
1537 | function (module, exports, __webpack_require__) {
|
1538 |
|
1539 | var baseIsTypedArray = __webpack_require__(132),
|
1540 | baseUnary = __webpack_require__(61),
|
1541 | nodeUtil = __webpack_require__(133);
|
1542 |
|
1543 |
|
1544 | var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
1545 |
|
1546 | |
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 | var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
1564 |
|
1565 | module.exports = isTypedArray;
|
1566 |
|
1567 |
|
1568 | },
|
1569 |
|
1570 | function (module, exports, __webpack_require__) {
|
1571 |
|
1572 | var listCacheClear = __webpack_require__(139),
|
1573 | listCacheDelete = __webpack_require__(140),
|
1574 | listCacheGet = __webpack_require__(141),
|
1575 | listCacheHas = __webpack_require__(142),
|
1576 | listCacheSet = __webpack_require__(143);
|
1577 |
|
1578 | |
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 | function ListCache(entries) {
|
1586 | var index = -1,
|
1587 | length = entries == null ? 0 : entries.length;
|
1588 |
|
1589 | this.clear();
|
1590 | while (++index < length) {
|
1591 | var entry = entries[index];
|
1592 | this.set(entry[0], entry[1]);
|
1593 | }
|
1594 | }
|
1595 |
|
1596 |
|
1597 | ListCache.prototype.clear = listCacheClear;
|
1598 | ListCache.prototype['delete'] = listCacheDelete;
|
1599 | ListCache.prototype.get = listCacheGet;
|
1600 | ListCache.prototype.has = listCacheHas;
|
1601 | ListCache.prototype.set = listCacheSet;
|
1602 |
|
1603 | module.exports = ListCache;
|
1604 |
|
1605 |
|
1606 | },
|
1607 |
|
1608 | function (module, exports, __webpack_require__) {
|
1609 |
|
1610 | var eq = __webpack_require__(18);
|
1611 |
|
1612 | |
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 | function assocIndexOf(array, key) {
|
1621 | var length = array.length;
|
1622 | while (length--) {
|
1623 | if (eq(array[length][0], key)) {
|
1624 | return length;
|
1625 | }
|
1626 | }
|
1627 | return -1;
|
1628 | }
|
1629 |
|
1630 | module.exports = assocIndexOf;
|
1631 |
|
1632 |
|
1633 | },
|
1634 |
|
1635 | function (module, exports, __webpack_require__) {
|
1636 |
|
1637 | var getNative = __webpack_require__(10);
|
1638 |
|
1639 |
|
1640 | var nativeCreate = getNative(Object, 'create');
|
1641 |
|
1642 | module.exports = nativeCreate;
|
1643 |
|
1644 |
|
1645 | },
|
1646 |
|
1647 | function (module, exports, __webpack_require__) {
|
1648 |
|
1649 | var isKeyable = __webpack_require__(157);
|
1650 |
|
1651 | |
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 |
|
1658 |
|
1659 | function getMapData(map, key) {
|
1660 | var data = map.__data__;
|
1661 | return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
|
1662 | }
|
1663 |
|
1664 | module.exports = getMapData;
|
1665 |
|
1666 |
|
1667 | },
|
1668 |
|
1669 | function (module, exports, __webpack_require__) {
|
1670 |
|
1671 | var arrayLikeKeys = __webpack_require__(66),
|
1672 | baseKeysIn = __webpack_require__(164),
|
1673 | isArrayLike = __webpack_require__(9);
|
1674 |
|
1675 | |
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 | function keysIn(object) {
|
1699 | return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
1700 | }
|
1701 |
|
1702 | module.exports = keysIn;
|
1703 |
|
1704 |
|
1705 | },
|
1706 |
|
1707 | function (module, exports) {
|
1708 |
|
1709 | |
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 | function copyArray(source, array) {
|
1718 | var index = -1,
|
1719 | length = source.length;
|
1720 |
|
1721 | array || (array = Array(length));
|
1722 | while (++index < length) {
|
1723 | array[index] = source[index];
|
1724 | }
|
1725 | return array;
|
1726 | }
|
1727 |
|
1728 | module.exports = copyArray;
|
1729 |
|
1730 |
|
1731 | },
|
1732 |
|
1733 | function (module, __webpack_exports__, __webpack_require__) {
|
1734 |
|
1735 | "use strict";
|
1736 |
|
1737 | __webpack_exports__["a"] = function (a, b) {
|
1738 | return a = +a, b -= a, function (t) {
|
1739 | return a + b * t;
|
1740 | };
|
1741 | };
|
1742 |
|
1743 |
|
1744 | },
|
1745 |
|
1746 | function (module, exports, __webpack_require__) {
|
1747 |
|
1748 | var Util = __webpack_require__(0);
|
1749 | var vec2 = __webpack_require__(3).vec2;
|
1750 |
|
1751 | function cubicAt(p0, p1, p2, p3, t) {
|
1752 | var onet = 1 - t;
|
1753 | return onet * onet * (onet * p3 + 3 * t * p2) + t * t * (t * p0 + 3 * onet * p1);
|
1754 | }
|
1755 |
|
1756 | function cubicDerivativeAt(p0, p1, p2, p3, t) {
|
1757 | var onet = 1 - t;
|
1758 | return 3 * (((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet + (p3 - p2) * t * t);
|
1759 | }
|
1760 |
|
1761 | function cubicProjectPoint(x1, y1, x2, y2, x3, y3, x4, y4, x, y, out) {
|
1762 | var t = void 0;
|
1763 | var interval = 0.005;
|
1764 | var d = Infinity;
|
1765 | var _t = void 0;
|
1766 | var v1 = void 0;
|
1767 | var d1 = void 0;
|
1768 | var d2 = void 0;
|
1769 | var v2 = void 0;
|
1770 | var prev = void 0;
|
1771 | var next = void 0;
|
1772 | var EPSILON = 0.0001;
|
1773 | var v0 = [x, y];
|
1774 |
|
1775 | for (_t = 0; _t < 1; _t += 0.05) {
|
1776 | v1 = [cubicAt(x1, x2, x3, x4, _t), cubicAt(y1, y2, y3, y4, _t)];
|
1777 |
|
1778 | d1 = vec2.squaredDistance(v0, v1);
|
1779 | if (d1 < d) {
|
1780 | t = _t;
|
1781 | d = d1;
|
1782 | }
|
1783 | }
|
1784 | d = Infinity;
|
1785 |
|
1786 | for (var i = 0; i < 32; i++) {
|
1787 | if (interval < EPSILON) {
|
1788 | break;
|
1789 | }
|
1790 |
|
1791 | prev = t - interval;
|
1792 | next = t + interval;
|
1793 |
|
1794 | v1 = [cubicAt(x1, x2, x3, x4, prev), cubicAt(y1, y2, y3, y4, prev)];
|
1795 |
|
1796 | d1 = vec2.squaredDistance(v0, v1);
|
1797 |
|
1798 | if (prev >= 0 && d1 < d) {
|
1799 | t = prev;
|
1800 | d = d1;
|
1801 | } else {
|
1802 | v2 = [cubicAt(x1, x2, x3, x4, next), cubicAt(y1, y2, y3, y4, next)];
|
1803 |
|
1804 | d2 = vec2.squaredDistance(v0, v2);
|
1805 |
|
1806 | if (next <= 1 && d2 < d) {
|
1807 | t = next;
|
1808 | d = d2;
|
1809 | } else {
|
1810 | interval *= 0.5;
|
1811 | }
|
1812 | }
|
1813 | }
|
1814 |
|
1815 | if (out) {
|
1816 | out.x = cubicAt(x1, x2, x3, x4, t);
|
1817 | out.y = cubicAt(y1, y2, y3, y4, t);
|
1818 | }
|
1819 |
|
1820 | return Math.sqrt(d);
|
1821 | }
|
1822 |
|
1823 | function cubicExtrema(p0, p1, p2, p3) {
|
1824 | var a = 3 * p0 - 9 * p1 + 9 * p2 - 3 * p3;
|
1825 | var b = 6 * p1 - 12 * p2 + 6 * p3;
|
1826 | var c = 3 * p2 - 3 * p3;
|
1827 | var extrema = [];
|
1828 | var t1 = void 0;
|
1829 | var t2 = void 0;
|
1830 | var discSqrt = void 0;
|
1831 |
|
1832 | if (Util.isNumberEqual(a, 0)) {
|
1833 | if (!Util.isNumberEqual(b, 0)) {
|
1834 | t1 = -c / b;
|
1835 | if (t1 >= 0 && t1 <= 1) {
|
1836 | extrema.push(t1);
|
1837 | }
|
1838 | }
|
1839 | } else {
|
1840 | var disc = b * b - 4 * a * c;
|
1841 | if (Util.isNumberEqual(disc, 0)) {
|
1842 | extrema.push(-b / (2 * a));
|
1843 | } else if (disc > 0) {
|
1844 | discSqrt = Math.sqrt(disc);
|
1845 | t1 = (-b + discSqrt) / (2 * a);
|
1846 | t2 = (-b - discSqrt) / (2 * a);
|
1847 | if (t1 >= 0 && t1 <= 1) {
|
1848 | extrema.push(t1);
|
1849 | }
|
1850 | if (t2 >= 0 && t2 <= 1) {
|
1851 | extrema.push(t2);
|
1852 | }
|
1853 | }
|
1854 | }
|
1855 | return extrema;
|
1856 | }
|
1857 |
|
1858 | function base3(t, p1, p2, p3, p4) {
|
1859 | var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4;
|
1860 | var t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;
|
1861 | return t * t2 - 3 * p1 + 3 * p2;
|
1862 | }
|
1863 |
|
1864 | function cubiclLen(x1, y1, x2, y2, x3, y3, x4, y4, z) {
|
1865 | if (Util.isNil(z)) {
|
1866 | z = 1;
|
1867 | }
|
1868 | z = z > 1 ? 1 : z < 0 ? 0 : z;
|
1869 | var z2 = z / 2;
|
1870 | var n = 12;
|
1871 | var Tvalues = [-0.1252, 0.1252, -0.3678, 0.3678, -0.5873, 0.5873, -0.7699, 0.7699, -0.9041, 0.9041, -0.9816, 0.9816];
|
1872 | var Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472];
|
1873 | var sum = 0;
|
1874 | for (var i = 0; i < n; i++) {
|
1875 | var ct = z2 * Tvalues[i] + z2;
|
1876 | var xbase = base3(ct, x1, x2, x3, x4);
|
1877 | var ybase = base3(ct, y1, y2, y3, y4);
|
1878 | var comb = xbase * xbase + ybase * ybase;
|
1879 | sum += Cvalues[i] * Math.sqrt(comb);
|
1880 | }
|
1881 | return z2 * sum;
|
1882 | }
|
1883 |
|
1884 | module.exports = {
|
1885 | at: cubicAt,
|
1886 | derivativeAt: cubicDerivativeAt,
|
1887 | projectPoint: function projectPoint(x1, y1, x2, y2, x3, y3, x4, y4, x, y) {
|
1888 | var rst = {};
|
1889 | cubicProjectPoint(x1, y1, x2, y2, x3, y3, x4, y4, x, y, rst);
|
1890 | return rst;
|
1891 | },
|
1892 |
|
1893 | pointDistance: cubicProjectPoint,
|
1894 | extrema: cubicExtrema,
|
1895 | len: cubiclLen
|
1896 | };
|
1897 |
|
1898 |
|
1899 | },
|
1900 |
|
1901 | function (module, exports, __webpack_require__) {
|
1902 |
|
1903 | var PRECISION = 0.00001;
|
1904 | var RADIAN = Math.PI / 180;
|
1905 | var DEGREE = 180 / Math.PI;
|
1906 |
|
1907 | module.exports = {
|
1908 | isFunction: __webpack_require__(20),
|
1909 | isObject: __webpack_require__(8),
|
1910 | isBoolean: __webpack_require__(117),
|
1911 | isNil: __webpack_require__(118),
|
1912 | isString: __webpack_require__(56),
|
1913 | isArray: __webpack_require__(6),
|
1914 | isNumber: __webpack_require__(119),
|
1915 | isEmpty: __webpack_require__(120),
|
1916 | uniqueId: __webpack_require__(134),
|
1917 | clone: __webpack_require__(137),
|
1918 | assign: __webpack_require__(180),
|
1919 | merge: __webpack_require__(188),
|
1920 | upperFirst: __webpack_require__(195),
|
1921 | remove: __webpack_require__(201),
|
1922 | each: __webpack_require__(209),
|
1923 | isEqual: __webpack_require__(214),
|
1924 | toArray: __webpack_require__(224),
|
1925 | extend: function extend(subclass, superclass, overrides, staticOverrides) {
|
1926 |
|
1927 | if (!this.isFunction(superclass)) {
|
1928 | overrides = superclass;
|
1929 | superclass = subclass;
|
1930 | subclass = function subclass() {};
|
1931 | }
|
1932 |
|
1933 | var create = Object.create ? function (proto, c) {
|
1934 | return Object.create(proto, {
|
1935 | constructor: {
|
1936 | value: c
|
1937 | }
|
1938 | });
|
1939 | } : function (proto, c) {
|
1940 | function F() {}
|
1941 |
|
1942 | F.prototype = proto;
|
1943 | var o = new F();
|
1944 | o.constructor = c;
|
1945 | return o;
|
1946 | };
|
1947 |
|
1948 | var superObj = create(superclass.prototype, subclass);
|
1949 | subclass.prototype = this.merge(superObj, subclass.prototype);
|
1950 | subclass.superclass = create(superclass.prototype, superclass);
|
1951 | this.merge(superObj, overrides);
|
1952 | this.merge(subclass, staticOverrides);
|
1953 | return subclass;
|
1954 | },
|
1955 | augment: function augment(c) {
|
1956 | var args = this.toArray(arguments);
|
1957 | for (var i = 1; i < args.length; i++) {
|
1958 | var obj = args[i];
|
1959 | if (this.isFunction(obj)) {
|
1960 | obj = obj.prototype;
|
1961 | }
|
1962 | this.merge(c.prototype, obj);
|
1963 | }
|
1964 | },
|
1965 |
|
1966 | |
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 | isNumberEqual: function isNumberEqual(a, b) {
|
1973 | return Math.abs(a - b) < PRECISION;
|
1974 | },
|
1975 |
|
1976 | |
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 | toRadian: function toRadian(degree) {
|
1982 | return RADIAN * degree;
|
1983 | },
|
1984 |
|
1985 | |
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 | toDegree: function toDegree(radian) {
|
1991 | return DEGREE * radian;
|
1992 | },
|
1993 |
|
1994 | |
1995 |
|
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 | mod: function mod(n, m) {
|
2001 | return (n % m + m) % m;
|
2002 | },
|
2003 |
|
2004 | |
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 | clamp: function clamp(a, min, max) {
|
2012 | if (a < min) {
|
2013 | return min;
|
2014 | } else if (a > max) {
|
2015 | return max;
|
2016 | }
|
2017 |
|
2018 | return a;
|
2019 | }
|
2020 | };
|
2021 |
|
2022 |
|
2023 | },
|
2024 |
|
2025 | function (module, exports, __webpack_require__) {
|
2026 |
|
2027 | var getNative = __webpack_require__(10),
|
2028 | root = __webpack_require__(4);
|
2029 |
|
2030 |
|
2031 | var Map = getNative(root, 'Map');
|
2032 |
|
2033 | module.exports = Map;
|
2034 |
|
2035 |
|
2036 | },
|
2037 |
|
2038 | function (module, exports, __webpack_require__) {
|
2039 |
|
2040 | var baseIsArguments = __webpack_require__(130),
|
2041 | isObjectLike = __webpack_require__(5);
|
2042 |
|
2043 |
|
2044 | var objectProto = Object.prototype;
|
2045 |
|
2046 |
|
2047 | var hasOwnProperty = objectProto.hasOwnProperty;
|
2048 |
|
2049 |
|
2050 | var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
2051 |
|
2052 | |
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 | var isArguments = baseIsArguments(function () {
|
2071 | return arguments;
|
2072 | }()) ? baseIsArguments : function (value) {
|
2073 | return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
|
2074 | };
|
2075 |
|
2076 | module.exports = isArguments;
|
2077 |
|
2078 |
|
2079 | },
|
2080 |
|
2081 | function (module, exports) {
|
2082 |
|
2083 | module.exports = function (module) {
|
2084 | if (!module.webpackPolyfill) {
|
2085 | module.deprecate = function () {};
|
2086 | module.paths = [];
|
2087 |
|
2088 | if (!module.children) module.children = [];
|
2089 | Object.defineProperty(module, "loaded", {
|
2090 | enumerable: true,
|
2091 | get: function get() {
|
2092 | return module.l;
|
2093 | }
|
2094 | });
|
2095 | Object.defineProperty(module, "id", {
|
2096 | enumerable: true,
|
2097 | get: function get() {
|
2098 | return module.i;
|
2099 | }
|
2100 | });
|
2101 | module.webpackPolyfill = 1;
|
2102 | }
|
2103 | return module;
|
2104 | };
|
2105 |
|
2106 |
|
2107 | },
|
2108 |
|
2109 | function (module, exports) {
|
2110 |
|
2111 | |
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 | function arrayMap(array, iteratee) {
|
2121 | var index = -1,
|
2122 | length = array == null ? 0 : array.length,
|
2123 | result = Array(length);
|
2124 |
|
2125 | while (++index < length) {
|
2126 | result[index] = iteratee(array[index], index, array);
|
2127 | }
|
2128 | return result;
|
2129 | }
|
2130 |
|
2131 | module.exports = arrayMap;
|
2132 |
|
2133 |
|
2134 | },
|
2135 |
|
2136 | function (module, exports, __webpack_require__) {
|
2137 |
|
2138 | var ListCache = __webpack_require__(23),
|
2139 | stackClear = __webpack_require__(144),
|
2140 | stackDelete = __webpack_require__(145),
|
2141 | stackGet = __webpack_require__(146),
|
2142 | stackHas = __webpack_require__(147),
|
2143 | stackSet = __webpack_require__(148);
|
2144 |
|
2145 | |
2146 |
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 | function Stack(entries) {
|
2153 | var data = this.__data__ = new ListCache(entries);
|
2154 | this.size = data.size;
|
2155 | }
|
2156 |
|
2157 |
|
2158 | Stack.prototype.clear = stackClear;
|
2159 | Stack.prototype['delete'] = stackDelete;
|
2160 | Stack.prototype.get = stackGet;
|
2161 | Stack.prototype.has = stackHas;
|
2162 | Stack.prototype.set = stackSet;
|
2163 |
|
2164 | module.exports = Stack;
|
2165 |
|
2166 |
|
2167 | },
|
2168 |
|
2169 | function (module, exports, __webpack_require__) {
|
2170 |
|
2171 | var baseAssignValue = __webpack_require__(38),
|
2172 | eq = __webpack_require__(18);
|
2173 |
|
2174 |
|
2175 | var objectProto = Object.prototype;
|
2176 |
|
2177 |
|
2178 | var hasOwnProperty = objectProto.hasOwnProperty;
|
2179 |
|
2180 | |
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 | function assignValue(object, key, value) {
|
2191 | var objValue = object[key];
|
2192 | if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
|
2193 | baseAssignValue(object, key, value);
|
2194 | }
|
2195 | }
|
2196 |
|
2197 | module.exports = assignValue;
|
2198 |
|
2199 |
|
2200 | },
|
2201 |
|
2202 | function (module, exports, __webpack_require__) {
|
2203 |
|
2204 | var defineProperty = __webpack_require__(65);
|
2205 |
|
2206 | |
2207 |
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 |
|
2215 | function baseAssignValue(object, key, value) {
|
2216 | if (key == '__proto__' && defineProperty) {
|
2217 | defineProperty(object, key, {
|
2218 | 'configurable': true,
|
2219 | 'enumerable': true,
|
2220 | 'value': value,
|
2221 | 'writable': true
|
2222 | });
|
2223 | } else {
|
2224 | object[key] = value;
|
2225 | }
|
2226 | }
|
2227 |
|
2228 | module.exports = baseAssignValue;
|
2229 |
|
2230 |
|
2231 | },
|
2232 |
|
2233 | function (module, exports, __webpack_require__) {
|
2234 |
|
2235 | var arrayFilter = __webpack_require__(167),
|
2236 | stubArray = __webpack_require__(69);
|
2237 |
|
2238 |
|
2239 | var objectProto = Object.prototype;
|
2240 |
|
2241 |
|
2242 | var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
2243 |
|
2244 |
|
2245 | var nativeGetSymbols = Object.getOwnPropertySymbols;
|
2246 |
|
2247 | |
2248 |
|
2249 |
|
2250 |
|
2251 |
|
2252 |
|
2253 |
|
2254 | var getSymbols = !nativeGetSymbols ? stubArray : function (object) {
|
2255 | if (object == null) {
|
2256 | return [];
|
2257 | }
|
2258 | object = Object(object);
|
2259 | return arrayFilter(nativeGetSymbols(object), function (symbol) {
|
2260 | return propertyIsEnumerable.call(object, symbol);
|
2261 | });
|
2262 | };
|
2263 |
|
2264 | module.exports = getSymbols;
|
2265 |
|
2266 |
|
2267 | },
|
2268 |
|
2269 | function (module, exports, __webpack_require__) {
|
2270 |
|
2271 | var overArg = __webpack_require__(58);
|
2272 |
|
2273 |
|
2274 | var getPrototype = overArg(Object.getPrototypeOf, Object);
|
2275 |
|
2276 | module.exports = getPrototype;
|
2277 |
|
2278 |
|
2279 | },
|
2280 |
|
2281 | function (module, exports, __webpack_require__) {
|
2282 |
|
2283 | var Uint8Array = __webpack_require__(74);
|
2284 |
|
2285 | |
2286 |
|
2287 |
|
2288 |
|
2289 |
|
2290 |
|
2291 |
|
2292 | function cloneArrayBuffer(arrayBuffer) {
|
2293 | var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
2294 | new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
2295 | return result;
|
2296 | }
|
2297 |
|
2298 | module.exports = cloneArrayBuffer;
|
2299 |
|
2300 |
|
2301 | },
|
2302 |
|
2303 | function (module, exports) {
|
2304 |
|
2305 | |
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 | function mapToArray(map) {
|
2313 | var index = -1,
|
2314 | result = Array(map.size);
|
2315 |
|
2316 | map.forEach(function (value, key) {
|
2317 | result[++index] = [key, value];
|
2318 | });
|
2319 | return result;
|
2320 | }
|
2321 |
|
2322 | module.exports = mapToArray;
|
2323 |
|
2324 |
|
2325 | },
|
2326 |
|
2327 | function (module, exports) {
|
2328 |
|
2329 | |
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 | function setToArray(set) {
|
2337 | var index = -1,
|
2338 | result = Array(set.size);
|
2339 |
|
2340 | set.forEach(function (value) {
|
2341 | result[++index] = value;
|
2342 | });
|
2343 | return result;
|
2344 | }
|
2345 |
|
2346 | module.exports = setToArray;
|
2347 |
|
2348 |
|
2349 | },
|
2350 |
|
2351 | function (module, exports) {
|
2352 |
|
2353 | |
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 | function identity(value) {
|
2370 | return value;
|
2371 | }
|
2372 |
|
2373 | module.exports = identity;
|
2374 |
|
2375 |
|
2376 | },
|
2377 |
|
2378 | function (module, __webpack_exports__, __webpack_require__) {
|
2379 |
|
2380 | "use strict";
|
2381 |
|
2382 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
2383 | return EPSILON;
|
2384 | });
|
2385 | __webpack_require__.d(__webpack_exports__, "a", function () {
|
2386 | return ARRAY_TYPE;
|
2387 | });
|
2388 | __webpack_require__.d(__webpack_exports__, "c", function () {
|
2389 | return RANDOM;
|
2390 | });
|
2391 |
|
2392 |
|
2393 |
|
2394 | |
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 | |
2415 |
|
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 | var EPSILON = 0.000001;
|
2421 | var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
|
2422 | var RANDOM = Math.random;
|
2423 |
|
2424 | |
2425 |
|
2426 |
|
2427 |
|
2428 |
|
2429 | function setMatrixArrayType(type) {
|
2430 | ARRAY_TYPE = type;
|
2431 | }
|
2432 |
|
2433 | var degree = Math.PI / 180;
|
2434 |
|
2435 | |
2436 |
|
2437 |
|
2438 |
|
2439 |
|
2440 | function toRadian(a) {
|
2441 | return a * degree;
|
2442 | }
|
2443 |
|
2444 | |
2445 |
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 |
|
2453 | function equals(a, b) {
|
2454 | return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));
|
2455 | }
|
2456 |
|
2457 |
|
2458 | },
|
2459 |
|
2460 | function (module, exports, __webpack_require__) {
|
2461 |
|
2462 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
2463 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
2464 | } : function (obj) {
|
2465 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
2466 | };
|
2467 |
|
2468 | var Util = __webpack_require__(31);
|
2469 | var SPACES = '\t\n\x0B\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029';
|
2470 | var PATH_COMMAND = new RegExp('([a-z])[' + SPACES + ',]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[' + SPACES + ']*,?[' + SPACES + ']*)+)', 'ig');
|
2471 | var PATH_VALUES = new RegExp('(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[' + SPACES + ']*,?[' + SPACES + ']*', 'ig');
|
2472 |
|
2473 |
|
2474 | var parsePathString = function parsePathString(pathString) {
|
2475 | if (!pathString) {
|
2476 | return null;
|
2477 | }
|
2478 |
|
2479 | if ((typeof pathString === 'undefined' ? 'undefined' : _typeof(pathString)) === _typeof([])) {
|
2480 | return pathString;
|
2481 | }
|
2482 | var paramCounts = {
|
2483 | a: 7,
|
2484 | c: 6,
|
2485 | o: 2,
|
2486 | h: 1,
|
2487 | l: 2,
|
2488 | m: 2,
|
2489 | r: 4,
|
2490 | q: 4,
|
2491 | s: 4,
|
2492 | t: 2,
|
2493 | v: 1,
|
2494 | u: 3,
|
2495 | z: 0
|
2496 | };
|
2497 | var data = [];
|
2498 |
|
2499 | String(pathString).replace(PATH_COMMAND, function (a, b, c) {
|
2500 | var params = [];
|
2501 | var name = b.toLowerCase();
|
2502 | c.replace(PATH_VALUES, function (a, b) {
|
2503 | b && params.push(+b);
|
2504 | });
|
2505 | if (name === 'm' && params.length > 2) {
|
2506 | data.push([b].concat(params.splice(0, 2)));
|
2507 | name = 'l';
|
2508 | b = b === 'm' ? 'l' : 'L';
|
2509 | }
|
2510 | if (name === 'o' && params.length === 1) {
|
2511 | data.push([b, params[0]]);
|
2512 | }
|
2513 | if (name === 'r') {
|
2514 | data.push([b].concat(params));
|
2515 | } else {
|
2516 | while (params.length >= paramCounts[name]) {
|
2517 | data.push([b].concat(params.splice(0, paramCounts[name])));
|
2518 | if (!paramCounts[name]) {
|
2519 | break;
|
2520 | }
|
2521 | }
|
2522 | }
|
2523 | });
|
2524 |
|
2525 | return data;
|
2526 | };
|
2527 |
|
2528 |
|
2529 | var catmullRom2bezier = function catmullRom2bezier(crp, z) {
|
2530 | var d = [];
|
2531 | for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) {
|
2532 | var p = [{
|
2533 | x: +crp[i - 2],
|
2534 | y: +crp[i - 1]
|
2535 | }, {
|
2536 | x: +crp[i],
|
2537 | y: +crp[i + 1]
|
2538 | }, {
|
2539 | x: +crp[i + 2],
|
2540 | y: +crp[i + 3]
|
2541 | }, {
|
2542 | x: +crp[i + 4],
|
2543 | y: +crp[i + 5]
|
2544 | }];
|
2545 | if (z) {
|
2546 | if (!i) {
|
2547 | p[0] = {
|
2548 | x: +crp[iLen - 2],
|
2549 | y: +crp[iLen - 1]
|
2550 | };
|
2551 | } else if (iLen - 4 === i) {
|
2552 | p[3] = {
|
2553 | x: +crp[0],
|
2554 | y: +crp[1]
|
2555 | };
|
2556 | } else if (iLen - 2 === i) {
|
2557 | p[2] = {
|
2558 | x: +crp[0],
|
2559 | y: +crp[1]
|
2560 | };
|
2561 | p[3] = {
|
2562 | x: +crp[2],
|
2563 | y: +crp[3]
|
2564 | };
|
2565 | }
|
2566 | } else {
|
2567 | if (iLen - 4 === i) {
|
2568 | p[3] = p[2];
|
2569 | } else if (!i) {
|
2570 | p[0] = {
|
2571 | x: +crp[i],
|
2572 | y: +crp[i + 1]
|
2573 | };
|
2574 | }
|
2575 | }
|
2576 | d.push(['C', (-p[0].x + 6 * p[1].x + p[2].x) / 6, (-p[0].y + 6 * p[1].y + p[2].y) / 6, (p[1].x + 6 * p[2].x - p[3].x) / 6, (p[1].y + 6 * p[2].y - p[3].y) / 6, p[2].x, p[2].y]);
|
2577 | }
|
2578 |
|
2579 | return d;
|
2580 | };
|
2581 |
|
2582 | var ellipsePath = function ellipsePath(x, y, rx, ry, a) {
|
2583 | var res = [];
|
2584 | if (a === null && ry === null) {
|
2585 | ry = rx;
|
2586 | }
|
2587 | x = +x;
|
2588 | y = +y;
|
2589 | rx = +rx;
|
2590 | ry = +ry;
|
2591 | if (a !== null) {
|
2592 | var rad = Math.PI / 180;
|
2593 | var x1 = x + rx * Math.cos(-ry * rad);
|
2594 | var x2 = x + rx * Math.cos(-a * rad);
|
2595 | var y1 = y + rx * Math.sin(-ry * rad);
|
2596 | var y2 = y + rx * Math.sin(-a * rad);
|
2597 | res = [['M', x1, y1], ['A', rx, rx, 0, +(a - ry > 180), 0, x2, y2]];
|
2598 | } else {
|
2599 | res = [['M', x, y], ['m', 0, -ry], ['a', rx, ry, 0, 1, 1, 0, 2 * ry], ['a', rx, ry, 0, 1, 1, 0, -2 * ry], ['z']];
|
2600 | }
|
2601 | return res;
|
2602 | };
|
2603 |
|
2604 | var pathToAbsolute = function pathToAbsolute(pathArray) {
|
2605 | pathArray = parsePathString(pathArray);
|
2606 |
|
2607 | if (!pathArray || !pathArray.length) {
|
2608 | return [['M', 0, 0]];
|
2609 | }
|
2610 | var res = [];
|
2611 | var x = 0;
|
2612 | var y = 0;
|
2613 | var mx = 0;
|
2614 | var my = 0;
|
2615 | var start = 0;
|
2616 | var pa0 = void 0;
|
2617 | var dots = void 0;
|
2618 | if (pathArray[0][0] === 'M') {
|
2619 | x = +pathArray[0][1];
|
2620 | y = +pathArray[0][2];
|
2621 | mx = x;
|
2622 | my = y;
|
2623 | start++;
|
2624 | res[0] = ['M', x, y];
|
2625 | }
|
2626 | var crz = pathArray.length === 3 && pathArray[0][0] === 'M' && pathArray[1][0].toUpperCase() === 'R' && pathArray[2][0].toUpperCase() === 'Z';
|
2627 | for (var r, pa, i = start, ii = pathArray.length; i < ii; i++) {
|
2628 | res.push(r = []);
|
2629 | pa = pathArray[i];
|
2630 | pa0 = pa[0];
|
2631 | if (pa0 !== pa0.toUpperCase()) {
|
2632 | r[0] = pa0.toUpperCase();
|
2633 | switch (r[0]) {
|
2634 | case 'A':
|
2635 | r[1] = pa[1];
|
2636 | r[2] = pa[2];
|
2637 | r[3] = pa[3];
|
2638 | r[4] = pa[4];
|
2639 | r[5] = pa[5];
|
2640 | r[6] = +pa[6] + x;
|
2641 | r[7] = +pa[7] + y;
|
2642 | break;
|
2643 | case 'V':
|
2644 | r[1] = +pa[1] + y;
|
2645 | break;
|
2646 | case 'H':
|
2647 | r[1] = +pa[1] + x;
|
2648 | break;
|
2649 | case 'R':
|
2650 | dots = [x, y].concat(pa.slice(1));
|
2651 | for (var j = 2, jj = dots.length; j < jj; j++) {
|
2652 | dots[j] = +dots[j] + x;
|
2653 | dots[++j] = +dots[j] + y;
|
2654 | }
|
2655 | res.pop();
|
2656 | res = res.concat(catmullRom2bezier(dots, crz));
|
2657 | break;
|
2658 | case 'O':
|
2659 | res.pop();
|
2660 | dots = ellipsePath(x, y, pa[1], pa[2]);
|
2661 | dots.push(dots[0]);
|
2662 | res = res.concat(dots);
|
2663 | break;
|
2664 | case 'U':
|
2665 | res.pop();
|
2666 | res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));
|
2667 | r = ['U'].concat(res[res.length - 1].slice(-2));
|
2668 | break;
|
2669 | case 'M':
|
2670 | mx = +pa[1] + x;
|
2671 | my = +pa[2] + y;
|
2672 | break;
|
2673 | default:
|
2674 | for (var _j = 1, _jj = pa.length; _j < _jj; _j++) {
|
2675 | r[_j] = +pa[_j] + (_j % 2 ? x : y);
|
2676 | }
|
2677 | }
|
2678 | } else if (pa0 === 'R') {
|
2679 | dots = [x, y].concat(pa.slice(1));
|
2680 | res.pop();
|
2681 | res = res.concat(catmullRom2bezier(dots, crz));
|
2682 | r = ['R'].concat(pa.slice(-2));
|
2683 | } else if (pa0 === 'O') {
|
2684 | res.pop();
|
2685 | dots = ellipsePath(x, y, pa[1], pa[2]);
|
2686 | dots.push(dots[0]);
|
2687 | res = res.concat(dots);
|
2688 | } else if (pa0 === 'U') {
|
2689 | res.pop();
|
2690 | res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));
|
2691 | r = ['U'].concat(res[res.length - 1].slice(-2));
|
2692 | } else {
|
2693 | for (var k = 0, kk = pa.length; k < kk; k++) {
|
2694 | r[k] = pa[k];
|
2695 | }
|
2696 | }
|
2697 | pa0 = pa0.toUpperCase();
|
2698 | if (pa0 !== 'O') {
|
2699 | switch (r[0]) {
|
2700 | case 'Z':
|
2701 | x = +mx;
|
2702 | y = +my;
|
2703 | break;
|
2704 | case 'H':
|
2705 | x = r[1];
|
2706 | break;
|
2707 | case 'V':
|
2708 | y = r[1];
|
2709 | break;
|
2710 | case 'M':
|
2711 | mx = r[r.length - 2];
|
2712 | my = r[r.length - 1];
|
2713 | break;
|
2714 | default:
|
2715 | x = r[r.length - 2];
|
2716 | y = r[r.length - 1];
|
2717 | }
|
2718 | }
|
2719 | }
|
2720 |
|
2721 | return res;
|
2722 | };
|
2723 |
|
2724 | var l2c = function l2c(x1, y1, x2, y2) {
|
2725 | return [x1, y1, x2, y2, x2, y2];
|
2726 | };
|
2727 |
|
2728 | var q2c = function q2c(x1, y1, ax, ay, x2, y2) {
|
2729 | var _13 = 1 / 3;
|
2730 | var _23 = 2 / 3;
|
2731 | return [_13 * x1 + _23 * ax, _13 * y1 + _23 * ay, _13 * x2 + _23 * ax, _13 * y2 + _23 * ay, x2, y2];
|
2732 | };
|
2733 |
|
2734 | var a2c = function a2c(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
|
2735 |
|
2736 |
|
2737 | if (rx === ry) {
|
2738 | rx += 1;
|
2739 | }
|
2740 |
|
2741 | var _120 = Math.PI * 120 / 180;
|
2742 | var rad = Math.PI / 180 * (+angle || 0);
|
2743 | var res = [];
|
2744 | var xy = void 0;
|
2745 | var f1 = void 0;
|
2746 | var f2 = void 0;
|
2747 | var cx = void 0;
|
2748 | var cy = void 0;
|
2749 | var rotate = function rotate(x, y, rad) {
|
2750 | var X = x * Math.cos(rad) - y * Math.sin(rad);
|
2751 | var Y = x * Math.sin(rad) + y * Math.cos(rad);
|
2752 | return {
|
2753 | x: X,
|
2754 | y: Y
|
2755 | };
|
2756 | };
|
2757 | if (!recursive) {
|
2758 | xy = rotate(x1, y1, -rad);
|
2759 | x1 = xy.x;
|
2760 | y1 = xy.y;
|
2761 | xy = rotate(x2, y2, -rad);
|
2762 | x2 = xy.x;
|
2763 | y2 = xy.y;
|
2764 | if (x1 === x2 && y1 === y2) {
|
2765 |
|
2766 | x2 += 1;
|
2767 | y2 += 1;
|
2768 | }
|
2769 |
|
2770 |
|
2771 | var x = (x1 - x2) / 2;
|
2772 | var y = (y1 - y2) / 2;
|
2773 | var h = x * x / (rx * rx) + y * y / (ry * ry);
|
2774 | if (h > 1) {
|
2775 | h = Math.sqrt(h);
|
2776 | rx = h * rx;
|
2777 | ry = h * ry;
|
2778 | }
|
2779 | var rx2 = rx * rx;
|
2780 | var ry2 = ry * ry;
|
2781 | var k = (large_arc_flag === sweep_flag ? -1 : 1) * Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));
|
2782 | cx = k * rx * y / ry + (x1 + x2) / 2;
|
2783 | cy = k * -ry * x / rx + (y1 + y2) / 2;
|
2784 | f1 = Math.asin(((y1 - cy) / ry).toFixed(9));
|
2785 | f2 = Math.asin(((y2 - cy) / ry).toFixed(9));
|
2786 |
|
2787 | f1 = x1 < cx ? Math.PI - f1 : f1;
|
2788 | f2 = x2 < cx ? Math.PI - f2 : f2;
|
2789 | f1 < 0 && (f1 = Math.PI * 2 + f1);
|
2790 | f2 < 0 && (f2 = Math.PI * 2 + f2);
|
2791 | if (sweep_flag && f1 > f2) {
|
2792 | f1 = f1 - Math.PI * 2;
|
2793 | }
|
2794 | if (!sweep_flag && f2 > f1) {
|
2795 | f2 = f2 - Math.PI * 2;
|
2796 | }
|
2797 | } else {
|
2798 | f1 = recursive[0];
|
2799 | f2 = recursive[1];
|
2800 | cx = recursive[2];
|
2801 | cy = recursive[3];
|
2802 | }
|
2803 | var df = f2 - f1;
|
2804 | if (Math.abs(df) > _120) {
|
2805 | var f2old = f2;
|
2806 | var x2old = x2;
|
2807 | var y2old = y2;
|
2808 | f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
|
2809 | x2 = cx + rx * Math.cos(f2);
|
2810 | y2 = cy + ry * Math.sin(f2);
|
2811 | res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
|
2812 | }
|
2813 | df = f2 - f1;
|
2814 | var c1 = Math.cos(f1);
|
2815 | var s1 = Math.sin(f1);
|
2816 | var c2 = Math.cos(f2);
|
2817 | var s2 = Math.sin(f2);
|
2818 | var t = Math.tan(df / 4);
|
2819 | var hx = 4 / 3 * rx * t;
|
2820 | var hy = 4 / 3 * ry * t;
|
2821 | var m1 = [x1, y1];
|
2822 | var m2 = [x1 + hx * s1, y1 - hy * c1];
|
2823 | var m3 = [x2 + hx * s2, y2 - hy * c2];
|
2824 | var m4 = [x2, y2];
|
2825 | m2[0] = 2 * m1[0] - m2[0];
|
2826 | m2[1] = 2 * m1[1] - m2[1];
|
2827 | if (recursive) {
|
2828 | return [m2, m3, m4].concat(res);
|
2829 | }
|
2830 | res = [m2, m3, m4].concat(res).join().split(',');
|
2831 | var newres = [];
|
2832 | for (var i = 0, ii = res.length; i < ii; i++) {
|
2833 | newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;
|
2834 | }
|
2835 | return newres;
|
2836 | };
|
2837 |
|
2838 | var pathTocurve = function pathTocurve(path, path2) {
|
2839 | var pcoms1 = [];
|
2840 | var pcoms2 = [];
|
2841 | var p = pathToAbsolute(path);
|
2842 | var p2 = path2 && pathToAbsolute(path2);
|
2843 | var attrs = {
|
2844 | x: 0,
|
2845 | y: 0,
|
2846 | bx: 0,
|
2847 | by: 0,
|
2848 | X: 0,
|
2849 | Y: 0,
|
2850 | qx: null,
|
2851 | qy: null
|
2852 | };
|
2853 | var attrs2 = {
|
2854 | x: 0,
|
2855 | y: 0,
|
2856 | bx: 0,
|
2857 | by: 0,
|
2858 | X: 0,
|
2859 | Y: 0,
|
2860 | qx: null,
|
2861 | qy: null
|
2862 | };
|
2863 | var processPath = function processPath(path, d, pcom) {
|
2864 | var nx = void 0;
|
2865 | var ny = void 0;
|
2866 | if (!path) {
|
2867 | return ['C', d.x, d.y, d.x, d.y, d.x, d.y];
|
2868 | }!(path[0] in {
|
2869 | T: 1,
|
2870 | Q: 1
|
2871 | }) && (d.qx = d.qy = null);
|
2872 | switch (path[0]) {
|
2873 | case 'M':
|
2874 | d.X = path[1];
|
2875 | d.Y = path[2];
|
2876 | break;
|
2877 | case 'A':
|
2878 | path = ['C'].concat(a2c.apply(0, [d.x, d.y].concat(path.slice(1))));
|
2879 | break;
|
2880 | case 'S':
|
2881 | if (pcom === 'C' || pcom === 'S') {
|
2882 |
|
2883 | nx = d.x * 2 - d.bx;
|
2884 | ny = d.y * 2 - d.by;
|
2885 | } else {
|
2886 |
|
2887 | nx = d.x;
|
2888 | ny = d.y;
|
2889 | }
|
2890 | path = ['C', nx, ny].concat(path.slice(1));
|
2891 | break;
|
2892 | case 'T':
|
2893 | if (pcom === 'Q' || pcom === 'T') {
|
2894 |
|
2895 | d.qx = d.x * 2 - d.qx;
|
2896 | d.qy = d.y * 2 - d.qy;
|
2897 | } else {
|
2898 |
|
2899 | d.qx = d.x;
|
2900 | d.qy = d.y;
|
2901 | }
|
2902 | path = ['C'].concat(q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
|
2903 | break;
|
2904 | case 'Q':
|
2905 | d.qx = path[1];
|
2906 | d.qy = path[2];
|
2907 | path = ['C'].concat(q2c(d.x, d.y, path[1], path[2], path[3], path[4]));
|
2908 | break;
|
2909 | case 'L':
|
2910 | path = ['C'].concat(l2c(d.x, d.y, path[1], path[2]));
|
2911 | break;
|
2912 | case 'H':
|
2913 | path = ['C'].concat(l2c(d.x, d.y, path[1], d.y));
|
2914 | break;
|
2915 | case 'V':
|
2916 | path = ['C'].concat(l2c(d.x, d.y, d.x, path[1]));
|
2917 | break;
|
2918 | case 'Z':
|
2919 | path = ['C'].concat(l2c(d.x, d.y, d.X, d.Y));
|
2920 | break;
|
2921 | default:
|
2922 | path = [];
|
2923 | }
|
2924 | return path;
|
2925 | };
|
2926 | var fixArc = function fixArc(pp, i) {
|
2927 | if (pp[i].length > 7) {
|
2928 | pp[i].shift();
|
2929 | var pi = pp[i];
|
2930 | while (pi.length) {
|
2931 | pcoms1[i] = 'A';
|
2932 | p2 && (pcoms2[i] = 'A');
|
2933 | pp.splice(i++, 0, ['C'].concat(pi.splice(0, 6)));
|
2934 | }
|
2935 | pp.splice(i, 1);
|
2936 |
|
2937 | }
|
2938 | };
|
2939 | var fixM = function fixM(path1, path2, a1, a2, i) {
|
2940 | if (path1 && path2 && path1[i][0] === 'M' && path2[i][0] !== 'M') {
|
2941 | path2.splice(i, 0, ['M', a2.x, a2.y]);
|
2942 | a1.bx = 0;
|
2943 | a1.by = 0;
|
2944 | a1.x = path1[i][1];
|
2945 | a1.y = path1[i][2];
|
2946 |
|
2947 | }
|
2948 | };
|
2949 | var pfirst = '';
|
2950 | var pcom = '';
|
2951 | for (var i = 0, ii = Math.max(p.length, p2 && p2.length || 0); i < ii; i++) {
|
2952 | p[i] && (pfirst = p[i][0]);
|
2953 |
|
2954 | if (pfirst !== 'C') {
|
2955 |
|
2956 | pcoms1[i] = pfirst;
|
2957 | i && (pcom = pcoms1[i - 1]);
|
2958 | }
|
2959 | p[i] = processPath(p[i], attrs, pcom);
|
2960 |
|
2961 | if (pcoms1[i] !== 'A' && pfirst === 'C') pcoms1[i] = 'C';
|
2962 |
|
2963 |
|
2964 |
|
2965 | fixArc(p, i);
|
2966 |
|
2967 | if (p2) {
|
2968 |
|
2969 | p2[i] && (pfirst = p2[i][0]);
|
2970 | if (pfirst !== 'C') {
|
2971 | pcoms2[i] = pfirst;
|
2972 | i && (pcom = pcoms2[i - 1]);
|
2973 | }
|
2974 | p2[i] = processPath(p2[i], attrs2, pcom);
|
2975 |
|
2976 | if (pcoms2[i] !== 'A' && pfirst === 'C') {
|
2977 | pcoms2[i] = 'C';
|
2978 | }
|
2979 |
|
2980 | fixArc(p2, i);
|
2981 | }
|
2982 | fixM(p, p2, attrs, attrs2, i);
|
2983 | fixM(p2, p, attrs2, attrs, i);
|
2984 | var seg = p[i];
|
2985 | var seg2 = p2 && p2[i];
|
2986 | var seglen = seg.length;
|
2987 | var seg2len = p2 && seg2.length;
|
2988 | attrs.x = seg[seglen - 2];
|
2989 | attrs.y = seg[seglen - 1];
|
2990 | attrs.bx = parseFloat(seg[seglen - 4]) || attrs.x;
|
2991 | attrs.by = parseFloat(seg[seglen - 3]) || attrs.y;
|
2992 | attrs2.bx = p2 && (parseFloat(seg2[seg2len - 4]) || attrs2.x);
|
2993 | attrs2.by = p2 && (parseFloat(seg2[seg2len - 3]) || attrs2.y);
|
2994 | attrs2.x = p2 && seg2[seg2len - 2];
|
2995 | attrs2.y = p2 && seg2[seg2len - 1];
|
2996 | }
|
2997 |
|
2998 | return p2 ? [p, p2] : p;
|
2999 | };
|
3000 |
|
3001 | var p2s = /,?([a-z]),?/gi;
|
3002 | var parsePathArray = function parsePathArray(path) {
|
3003 | return path.join(',').replace(p2s, '$1');
|
3004 | };
|
3005 |
|
3006 | var base3 = function base3(t, p1, p2, p3, p4) {
|
3007 | var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4;
|
3008 | var t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;
|
3009 | return t * t2 - 3 * p1 + 3 * p2;
|
3010 | };
|
3011 |
|
3012 | var bezlen = function bezlen(x1, y1, x2, y2, x3, y3, x4, y4, z) {
|
3013 | if (z === null) {
|
3014 | z = 1;
|
3015 | }
|
3016 | z = z > 1 ? 1 : z < 0 ? 0 : z;
|
3017 | var z2 = z / 2;
|
3018 | var n = 12;
|
3019 | var Tvalues = [-0.1252, 0.1252, -0.3678, 0.3678, -0.5873, 0.5873, -0.7699, 0.7699, -0.9041, 0.9041, -0.9816, 0.9816];
|
3020 | var Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472];
|
3021 | var sum = 0;
|
3022 | for (var i = 0; i < n; i++) {
|
3023 | var ct = z2 * Tvalues[i] + z2;
|
3024 | var xbase = base3(ct, x1, x2, x3, x4);
|
3025 | var ybase = base3(ct, y1, y2, y3, y4);
|
3026 | var comb = xbase * xbase + ybase * ybase;
|
3027 | sum += Cvalues[i] * Math.sqrt(comb);
|
3028 | }
|
3029 | return z2 * sum;
|
3030 | };
|
3031 |
|
3032 | var curveDim = function curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {
|
3033 | var tvalues = [];
|
3034 | var bounds = [[], []];
|
3035 | var a = void 0;
|
3036 | var b = void 0;
|
3037 | var c = void 0;
|
3038 | var t = void 0;
|
3039 |
|
3040 | for (var i = 0; i < 2; ++i) {
|
3041 | if (i === 0) {
|
3042 | b = 6 * x0 - 12 * x1 + 6 * x2;
|
3043 | a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
|
3044 | c = 3 * x1 - 3 * x0;
|
3045 | } else {
|
3046 | b = 6 * y0 - 12 * y1 + 6 * y2;
|
3047 | a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
|
3048 | c = 3 * y1 - 3 * y0;
|
3049 | }
|
3050 | if (Math.abs(a) < 1e-12) {
|
3051 | if (Math.abs(b) < 1e-12) {
|
3052 | continue;
|
3053 | }
|
3054 | t = -c / b;
|
3055 | if (t > 0 && t < 1) {
|
3056 | tvalues.push(t);
|
3057 | }
|
3058 | continue;
|
3059 | }
|
3060 | var b2ac = b * b - 4 * c * a;
|
3061 | var sqrtb2ac = Math.sqrt(b2ac);
|
3062 | if (b2ac < 0) {
|
3063 | continue;
|
3064 | }
|
3065 | var t1 = (-b + sqrtb2ac) / (2 * a);
|
3066 | if (t1 > 0 && t1 < 1) {
|
3067 | tvalues.push(t1);
|
3068 | }
|
3069 | var t2 = (-b - sqrtb2ac) / (2 * a);
|
3070 | if (t2 > 0 && t2 < 1) {
|
3071 | tvalues.push(t2);
|
3072 | }
|
3073 | }
|
3074 |
|
3075 | var j = tvalues.length;
|
3076 | var jlen = j;
|
3077 | var mt = void 0;
|
3078 | while (j--) {
|
3079 | t = tvalues[j];
|
3080 | mt = 1 - t;
|
3081 | bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
|
3082 | bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
|
3083 | }
|
3084 |
|
3085 | bounds[0][jlen] = x0;
|
3086 | bounds[1][jlen] = y0;
|
3087 | bounds[0][jlen + 1] = x3;
|
3088 | bounds[1][jlen + 1] = y3;
|
3089 | bounds[0].length = bounds[1].length = jlen + 2;
|
3090 |
|
3091 | return {
|
3092 | min: {
|
3093 | x: Math.min.apply(0, bounds[0]),
|
3094 | y: Math.min.apply(0, bounds[1])
|
3095 | },
|
3096 | max: {
|
3097 | x: Math.max.apply(0, bounds[0]),
|
3098 | y: Math.max.apply(0, bounds[1])
|
3099 | }
|
3100 | };
|
3101 | };
|
3102 |
|
3103 | var intersect = function intersect(x1, y1, x2, y2, x3, y3, x4, y4) {
|
3104 | if (Math.max(x1, x2) < Math.min(x3, x4) || Math.min(x1, x2) > Math.max(x3, x4) || Math.max(y1, y2) < Math.min(y3, y4) || Math.min(y1, y2) > Math.max(y3, y4)) {
|
3105 | return;
|
3106 | }
|
3107 | var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4);
|
3108 | var ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4);
|
3109 | var denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
|
3110 |
|
3111 | if (!denominator) {
|
3112 | return;
|
3113 | }
|
3114 | var px = nx / denominator;
|
3115 | var py = ny / denominator;
|
3116 | var px2 = +px.toFixed(2);
|
3117 | var py2 = +py.toFixed(2);
|
3118 | if (px2 < +Math.min(x1, x2).toFixed(2) || px2 > +Math.max(x1, x2).toFixed(2) || px2 < +Math.min(x3, x4).toFixed(2) || px2 > +Math.max(x3, x4).toFixed(2) || py2 < +Math.min(y1, y2).toFixed(2) || py2 > +Math.max(y1, y2).toFixed(2) || py2 < +Math.min(y3, y4).toFixed(2) || py2 > +Math.max(y3, y4).toFixed(2)) {
|
3119 | return;
|
3120 | }
|
3121 | return {
|
3122 | x: px,
|
3123 | y: py
|
3124 | };
|
3125 | };
|
3126 |
|
3127 | var isPointInsideBBox = function isPointInsideBBox(bbox, x, y) {
|
3128 | return x >= bbox.x && x <= bbox.x + bbox.width && y >= bbox.y && y <= bbox.y + bbox.height;
|
3129 | };
|
3130 |
|
3131 | var rectPath = function rectPath(x, y, w, h, r) {
|
3132 | if (r) {
|
3133 | return [['M', +x + +r, y], ['l', w - r * 2, 0], ['a', r, r, 0, 0, 1, r, r], ['l', 0, h - r * 2], ['a', r, r, 0, 0, 1, -r, r], ['l', r * 2 - w, 0], ['a', r, r, 0, 0, 1, -r, -r], ['l', 0, r * 2 - h], ['a', r, r, 0, 0, 1, r, -r], ['z']];
|
3134 | }
|
3135 | var res = [['M', x, y], ['l', w, 0], ['l', 0, h], ['l', -w, 0], ['z']];
|
3136 | res.parsePathArray = parsePathArray;
|
3137 | return res;
|
3138 | };
|
3139 |
|
3140 | var box = function box(x, y, width, height) {
|
3141 | if (x === null) {
|
3142 | x = y = width = height = 0;
|
3143 | }
|
3144 | if (y === null) {
|
3145 | y = x.y;
|
3146 | width = x.width;
|
3147 | height = x.height;
|
3148 | x = x.x;
|
3149 | }
|
3150 | return {
|
3151 | x: x,
|
3152 | y: y,
|
3153 | width: width,
|
3154 | w: width,
|
3155 | height: height,
|
3156 | h: height,
|
3157 | x2: x + width,
|
3158 | y2: y + height,
|
3159 | cx: x + width / 2,
|
3160 | cy: y + height / 2,
|
3161 | r1: Math.min(width, height) / 2,
|
3162 | r2: Math.max(width, height) / 2,
|
3163 | r0: Math.sqrt(width * width + height * height) / 2,
|
3164 | path: rectPath(x, y, width, height),
|
3165 | vb: [x, y, width, height].join(' ')
|
3166 | };
|
3167 | };
|
3168 |
|
3169 | var isBBoxIntersect = function isBBoxIntersect(bbox1, bbox2) {
|
3170 | bbox1 = box(bbox1);
|
3171 | bbox2 = box(bbox2);
|
3172 | return isPointInsideBBox(bbox2, bbox1.x, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x, bbox1.y2) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y2) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y2) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y2) || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x) && (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y);
|
3173 | };
|
3174 |
|
3175 | var bezierBBox = function bezierBBox(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
|
3176 | if (!Util.isArray(p1x)) {
|
3177 | p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];
|
3178 | }
|
3179 | var bbox = curveDim.apply(null, p1x);
|
3180 | return box(bbox.min.x, bbox.min.y, bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y);
|
3181 | };
|
3182 |
|
3183 | var findDotsAtSegment = function findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
|
3184 | var t1 = 1 - t;
|
3185 | var t13 = Math.pow(t1, 3);
|
3186 | var t12 = Math.pow(t1, 2);
|
3187 | var t2 = t * t;
|
3188 | var t3 = t2 * t;
|
3189 | var x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x;
|
3190 | var y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y;
|
3191 | var mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x);
|
3192 | var my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y);
|
3193 | var nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x);
|
3194 | var ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y);
|
3195 | var ax = t1 * p1x + t * c1x;
|
3196 | var ay = t1 * p1y + t * c1y;
|
3197 | var cx = t1 * c2x + t * p2x;
|
3198 | var cy = t1 * c2y + t * p2y;
|
3199 | var alpha = 90 - Math.atan2(mx - nx, my - ny) * 180 / Math.PI;
|
3200 |
|
3201 | return {
|
3202 | x: x,
|
3203 | y: y,
|
3204 | m: {
|
3205 | x: mx,
|
3206 | y: my
|
3207 | },
|
3208 | n: {
|
3209 | x: nx,
|
3210 | y: ny
|
3211 | },
|
3212 | start: {
|
3213 | x: ax,
|
3214 | y: ay
|
3215 | },
|
3216 | end: {
|
3217 | x: cx,
|
3218 | y: cy
|
3219 | },
|
3220 | alpha: alpha
|
3221 | };
|
3222 | };
|
3223 |
|
3224 | var interHelper = function interHelper(bez1, bez2, justCount) {
|
3225 | var bbox1 = bezierBBox(bez1);
|
3226 | var bbox2 = bezierBBox(bez2);
|
3227 | if (!isBBoxIntersect(bbox1, bbox2)) {
|
3228 | return justCount ? 0 : [];
|
3229 | }
|
3230 | var l1 = bezlen.apply(0, bez1);
|
3231 | var l2 = bezlen.apply(0, bez2);
|
3232 | var n1 = ~~(l1 / 8);
|
3233 | var n2 = ~~(l2 / 8);
|
3234 | var dots1 = [];
|
3235 | var dots2 = [];
|
3236 | var xy = {};
|
3237 | var res = justCount ? 0 : [];
|
3238 | for (var i = 0; i < n1 + 1; i++) {
|
3239 | var d = findDotsAtSegment.apply(0, bez1.concat(i / n1));
|
3240 | dots1.push({
|
3241 | x: d.x,
|
3242 | y: d.y,
|
3243 | t: i / n1
|
3244 | });
|
3245 | }
|
3246 | for (var _i = 0; _i < n2 + 1; _i++) {
|
3247 | var _d = findDotsAtSegment.apply(0, bez2.concat(_i / n2));
|
3248 | dots2.push({
|
3249 | x: _d.x,
|
3250 | y: _d.y,
|
3251 | t: _i / n2
|
3252 | });
|
3253 | }
|
3254 | for (var _i2 = 0; _i2 < n1; _i2++) {
|
3255 | for (var j = 0; j < n2; j++) {
|
3256 | var di = dots1[_i2];
|
3257 | var di1 = dots1[_i2 + 1];
|
3258 | var dj = dots2[j];
|
3259 | var dj1 = dots2[j + 1];
|
3260 | var ci = Math.abs(di1.x - di.x) < 0.001 ? 'y' : 'x';
|
3261 | var cj = Math.abs(dj1.x - dj.x) < 0.001 ? 'y' : 'x';
|
3262 | var is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);
|
3263 | if (is) {
|
3264 | if (xy[is.x.toFixed(4)] === is.y.toFixed(4)) {
|
3265 | continue;
|
3266 | }
|
3267 | xy[is.x.toFixed(4)] = is.y.toFixed(4);
|
3268 | var t1 = di.t + Math.abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t);
|
3269 | var t2 = dj.t + Math.abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);
|
3270 | if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) {
|
3271 | if (justCount) {
|
3272 | res++;
|
3273 | } else {
|
3274 | res.push({
|
3275 | x: is.x,
|
3276 | y: is.y,
|
3277 | t1: t1,
|
3278 | t2: t2
|
3279 | });
|
3280 | }
|
3281 | }
|
3282 | }
|
3283 | }
|
3284 | }
|
3285 | return res;
|
3286 | };
|
3287 |
|
3288 | var interPathHelper = function interPathHelper(path1, path2, justCount) {
|
3289 | path1 = pathTocurve(path1);
|
3290 | path2 = pathTocurve(path2);
|
3291 | var x1 = void 0;
|
3292 | var y1 = void 0;
|
3293 | var x2 = void 0;
|
3294 | var y2 = void 0;
|
3295 | var x1m = void 0;
|
3296 | var y1m = void 0;
|
3297 | var x2m = void 0;
|
3298 | var y2m = void 0;
|
3299 | var bez1 = void 0;
|
3300 | var bez2 = void 0;
|
3301 | var res = justCount ? 0 : [];
|
3302 | for (var i = 0, ii = path1.length; i < ii; i++) {
|
3303 | var pi = path1[i];
|
3304 | if (pi[0] === 'M') {
|
3305 | x1 = x1m = pi[1];
|
3306 | y1 = y1m = pi[2];
|
3307 | } else {
|
3308 | if (pi[0] === 'C') {
|
3309 | bez1 = [x1, y1].concat(pi.slice(1));
|
3310 | x1 = bez1[6];
|
3311 | y1 = bez1[7];
|
3312 | } else {
|
3313 | bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m];
|
3314 | x1 = x1m;
|
3315 | y1 = y1m;
|
3316 | }
|
3317 | for (var j = 0, jj = path2.length; j < jj; j++) {
|
3318 | var pj = path2[j];
|
3319 | if (pj[0] === 'M') {
|
3320 | x2 = x2m = pj[1];
|
3321 | y2 = y2m = pj[2];
|
3322 | } else {
|
3323 | if (pj[0] === 'C') {
|
3324 | bez2 = [x2, y2].concat(pj.slice(1));
|
3325 | x2 = bez2[6];
|
3326 | y2 = bez2[7];
|
3327 | } else {
|
3328 | bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m];
|
3329 | x2 = x2m;
|
3330 | y2 = y2m;
|
3331 | }
|
3332 | var intr = interHelper(bez1, bez2, justCount);
|
3333 | if (justCount) {
|
3334 | res += intr;
|
3335 | } else {
|
3336 | for (var k = 0, kk = intr.length; k < kk; k++) {
|
3337 | intr[k].segment1 = i;
|
3338 | intr[k].segment2 = j;
|
3339 | intr[k].bez1 = bez1;
|
3340 | intr[k].bez2 = bez2;
|
3341 | }
|
3342 | res = res.concat(intr);
|
3343 | }
|
3344 | }
|
3345 | }
|
3346 | }
|
3347 | }
|
3348 | return res;
|
3349 | };
|
3350 |
|
3351 | var pathIntersection = function pathIntersection(path1, path2) {
|
3352 | return interPathHelper(path1, path2);
|
3353 | };
|
3354 |
|
3355 | module.exports = {
|
3356 | parsePathString: parsePathString,
|
3357 | parsePathArray: parsePathArray,
|
3358 | pathTocurve: pathTocurve,
|
3359 | pathToAbsolute: pathToAbsolute,
|
3360 | catmullRomToBezier: catmullRom2bezier,
|
3361 | rectPath: rectPath,
|
3362 | intersection: pathIntersection
|
3363 | };
|
3364 |
|
3365 |
|
3366 | },
|
3367 |
|
3368 | function (module, __webpack_exports__, __webpack_require__) {
|
3369 |
|
3370 | "use strict";
|
3371 |
|
3372 | __webpack_exports__["b"] = now;
|
3373 | __webpack_exports__["a"] = Timer;
|
3374 | __webpack_exports__["c"] = timer;
|
3375 | __webpack_exports__["d"] = timerFlush;
|
3376 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
3377 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
3378 | } : function (obj) {
|
3379 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
3380 | };
|
3381 |
|
3382 | var frame = 0,
|
3383 |
|
3384 |
|
3385 | timeout = 0,
|
3386 |
|
3387 |
|
3388 | interval = 0,
|
3389 |
|
3390 |
|
3391 | pokeDelay = 1000,
|
3392 |
|
3393 |
|
3394 | taskHead,
|
3395 | taskTail,
|
3396 | clockLast = 0,
|
3397 | clockNow = 0,
|
3398 | clockSkew = 0,
|
3399 | clock = (typeof performance === "undefined" ? "undefined" : _typeof(performance)) === "object" && performance.now ? performance : Date,
|
3400 | setFrame = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function (f) {
|
3401 | setTimeout(f, 17);
|
3402 | };
|
3403 |
|
3404 | function now() {
|
3405 | return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
|
3406 | }
|
3407 |
|
3408 | function clearNow() {
|
3409 | clockNow = 0;
|
3410 | }
|
3411 |
|
3412 | function Timer() {
|
3413 | this._call = this._time = this._next = null;
|
3414 | }
|
3415 |
|
3416 | Timer.prototype = timer.prototype = {
|
3417 | constructor: Timer,
|
3418 | restart: function restart(callback, delay, time) {
|
3419 | if (typeof callback !== "function") throw new TypeError("callback is not a function");
|
3420 | time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
|
3421 | if (!this._next && taskTail !== this) {
|
3422 | if (taskTail) taskTail._next = this;else taskHead = this;
|
3423 | taskTail = this;
|
3424 | }
|
3425 | this._call = callback;
|
3426 | this._time = time;
|
3427 | sleep();
|
3428 | },
|
3429 | stop: function stop() {
|
3430 | if (this._call) {
|
3431 | this._call = null;
|
3432 | this._time = Infinity;
|
3433 | sleep();
|
3434 | }
|
3435 | }
|
3436 | };
|
3437 |
|
3438 | function timer(callback, delay, time) {
|
3439 | var t = new Timer();
|
3440 | t.restart(callback, delay, time);
|
3441 | return t;
|
3442 | }
|
3443 |
|
3444 | function timerFlush() {
|
3445 | now();
|
3446 | ++frame;
|
3447 | var t = taskHead,
|
3448 | e;
|
3449 | while (t) {
|
3450 | if ((e = clockNow - t._time) >= 0) t._call.call(null, e);
|
3451 | t = t._next;
|
3452 | }
|
3453 | --frame;
|
3454 | }
|
3455 |
|
3456 | function wake() {
|
3457 | clockNow = (clockLast = clock.now()) + clockSkew;
|
3458 | frame = timeout = 0;
|
3459 | try {
|
3460 | timerFlush();
|
3461 | } finally {
|
3462 | frame = 0;
|
3463 | nap();
|
3464 | clockNow = 0;
|
3465 | }
|
3466 | }
|
3467 |
|
3468 | function poke() {
|
3469 | var now = clock.now(),
|
3470 | delay = now - clockLast;
|
3471 | if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
|
3472 | }
|
3473 |
|
3474 | function nap() {
|
3475 | var t0,
|
3476 | t1 = taskHead,
|
3477 | t2,
|
3478 | time = Infinity;
|
3479 | while (t1) {
|
3480 | if (t1._call) {
|
3481 | if (time > t1._time) time = t1._time;
|
3482 | t0 = t1, t1 = t1._next;
|
3483 | } else {
|
3484 | t2 = t1._next, t1._next = null;
|
3485 | t1 = t0 ? t0._next = t2 : taskHead = t2;
|
3486 | }
|
3487 | }
|
3488 | taskTail = t0;
|
3489 | sleep(time);
|
3490 | }
|
3491 |
|
3492 | function sleep(time) {
|
3493 | if (frame) return;
|
3494 | if (timeout) timeout = clearTimeout(timeout);
|
3495 | var delay = time - clockNow;
|
3496 | if (delay > 24) {
|
3497 | if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
|
3498 | if (interval) interval = clearInterval(interval);
|
3499 | } else {
|
3500 | if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
|
3501 | frame = 1, setFrame(wake);
|
3502 | }
|
3503 | }
|
3504 |
|
3505 |
|
3506 | },
|
3507 |
|
3508 | function (module, __webpack_exports__, __webpack_require__) {
|
3509 |
|
3510 | "use strict";
|
3511 |
|
3512 | var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
|
3513 | var __WEBPACK_IMPORTED_MODULE_1__rgb__ = __webpack_require__(90);
|
3514 | var __WEBPACK_IMPORTED_MODULE_2__array__ = __webpack_require__(93);
|
3515 | var __WEBPACK_IMPORTED_MODULE_3__date__ = __webpack_require__(94);
|
3516 | var __WEBPACK_IMPORTED_MODULE_4__number__ = __webpack_require__(29);
|
3517 | var __WEBPACK_IMPORTED_MODULE_5__object__ = __webpack_require__(95);
|
3518 | var __WEBPACK_IMPORTED_MODULE_6__string__ = __webpack_require__(96);
|
3519 | var __WEBPACK_IMPORTED_MODULE_7__constant__ = __webpack_require__(92);
|
3520 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
3521 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
3522 | } : function (obj) {
|
3523 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
3524 | };
|
3525 |
|
3526 | __webpack_exports__["a"] = function (a, b) {
|
3527 | var t = typeof b === "undefined" ? "undefined" : _typeof(b),
|
3528 | c;
|
3529 | return b == null || t === "boolean" ? Object(__WEBPACK_IMPORTED_MODULE_7__constant__["a" ])(b) : (t === "number" ? __WEBPACK_IMPORTED_MODULE_4__number__["a" ] : t === "string" ? (c = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["a" ])(b)) ? (b = c, __WEBPACK_IMPORTED_MODULE_1__rgb__["a" ]) : __WEBPACK_IMPORTED_MODULE_6__string__["a" ] : b instanceof __WEBPACK_IMPORTED_MODULE_0_d3_color__["a" ] ? __WEBPACK_IMPORTED_MODULE_1__rgb__["a" ] : b instanceof Date ? __WEBPACK_IMPORTED_MODULE_3__date__["a" ] : Array.isArray(b) ? __WEBPACK_IMPORTED_MODULE_2__array__["a" ] : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? __WEBPACK_IMPORTED_MODULE_5__object__["a" ] : __WEBPACK_IMPORTED_MODULE_4__number__["a" ])(a, b);
|
3530 | };
|
3531 |
|
3532 |
|
3533 | },
|
3534 |
|
3535 | function (module, __webpack_exports__, __webpack_require__) {
|
3536 |
|
3537 | "use strict";
|
3538 |
|
3539 | __webpack_exports__["a"] = Color;
|
3540 | __webpack_require__.d(__webpack_exports__, "d", function () {
|
3541 | return _darker;
|
3542 | });
|
3543 | __webpack_require__.d(__webpack_exports__, "c", function () {
|
3544 | return _brighter;
|
3545 | });
|
3546 | __webpack_exports__["e"] = color;
|
3547 | __webpack_exports__["h"] = rgbConvert;
|
3548 | __webpack_exports__["g"] = rgb;
|
3549 | __webpack_exports__["b"] = Rgb;
|
3550 |
|
3551 | __webpack_exports__["f"] = hsl;
|
3552 | var __WEBPACK_IMPORTED_MODULE_0__define__ = __webpack_require__(50);
|
3553 |
|
3554 | function Color() {}
|
3555 |
|
3556 | var _darker = 0.7;
|
3557 |
|
3558 | var _brighter = 1 / _darker;
|
3559 |
|
3560 | var reI = "\\s*([+-]?\\d+)\\s*",
|
3561 | reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
|
3562 | reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
|
3563 | reHex3 = /^#([0-9a-f]{3})$/,
|
3564 | reHex6 = /^#([0-9a-f]{6})$/,
|
3565 | reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
|
3566 | reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
|
3567 | reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
|
3568 | reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
|
3569 | reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
|
3570 | reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
|
3571 |
|
3572 | var named = {
|
3573 | aliceblue: 0xf0f8ff,
|
3574 | antiquewhite: 0xfaebd7,
|
3575 | aqua: 0x00ffff,
|
3576 | aquamarine: 0x7fffd4,
|
3577 | azure: 0xf0ffff,
|
3578 | beige: 0xf5f5dc,
|
3579 | bisque: 0xffe4c4,
|
3580 | black: 0x000000,
|
3581 | blanchedalmond: 0xffebcd,
|
3582 | blue: 0x0000ff,
|
3583 | blueviolet: 0x8a2be2,
|
3584 | brown: 0xa52a2a,
|
3585 | burlywood: 0xdeb887,
|
3586 | cadetblue: 0x5f9ea0,
|
3587 | chartreuse: 0x7fff00,
|
3588 | chocolate: 0xd2691e,
|
3589 | coral: 0xff7f50,
|
3590 | cornflowerblue: 0x6495ed,
|
3591 | cornsilk: 0xfff8dc,
|
3592 | crimson: 0xdc143c,
|
3593 | cyan: 0x00ffff,
|
3594 | darkblue: 0x00008b,
|
3595 | darkcyan: 0x008b8b,
|
3596 | darkgoldenrod: 0xb8860b,
|
3597 | darkgray: 0xa9a9a9,
|
3598 | darkgreen: 0x006400,
|
3599 | darkgrey: 0xa9a9a9,
|
3600 | darkkhaki: 0xbdb76b,
|
3601 | darkmagenta: 0x8b008b,
|
3602 | darkolivegreen: 0x556b2f,
|
3603 | darkorange: 0xff8c00,
|
3604 | darkorchid: 0x9932cc,
|
3605 | darkred: 0x8b0000,
|
3606 | darksalmon: 0xe9967a,
|
3607 | darkseagreen: 0x8fbc8f,
|
3608 | darkslateblue: 0x483d8b,
|
3609 | darkslategray: 0x2f4f4f,
|
3610 | darkslategrey: 0x2f4f4f,
|
3611 | darkturquoise: 0x00ced1,
|
3612 | darkviolet: 0x9400d3,
|
3613 | deeppink: 0xff1493,
|
3614 | deepskyblue: 0x00bfff,
|
3615 | dimgray: 0x696969,
|
3616 | dimgrey: 0x696969,
|
3617 | dodgerblue: 0x1e90ff,
|
3618 | firebrick: 0xb22222,
|
3619 | floralwhite: 0xfffaf0,
|
3620 | forestgreen: 0x228b22,
|
3621 | fuchsia: 0xff00ff,
|
3622 | gainsboro: 0xdcdcdc,
|
3623 | ghostwhite: 0xf8f8ff,
|
3624 | gold: 0xffd700,
|
3625 | goldenrod: 0xdaa520,
|
3626 | gray: 0x808080,
|
3627 | green: 0x008000,
|
3628 | greenyellow: 0xadff2f,
|
3629 | grey: 0x808080,
|
3630 | honeydew: 0xf0fff0,
|
3631 | hotpink: 0xff69b4,
|
3632 | indianred: 0xcd5c5c,
|
3633 | indigo: 0x4b0082,
|
3634 | ivory: 0xfffff0,
|
3635 | khaki: 0xf0e68c,
|
3636 | lavender: 0xe6e6fa,
|
3637 | lavenderblush: 0xfff0f5,
|
3638 | lawngreen: 0x7cfc00,
|
3639 | lemonchiffon: 0xfffacd,
|
3640 | lightblue: 0xadd8e6,
|
3641 | lightcoral: 0xf08080,
|
3642 | lightcyan: 0xe0ffff,
|
3643 | lightgoldenrodyellow: 0xfafad2,
|
3644 | lightgray: 0xd3d3d3,
|
3645 | lightgreen: 0x90ee90,
|
3646 | lightgrey: 0xd3d3d3,
|
3647 | lightpink: 0xffb6c1,
|
3648 | lightsalmon: 0xffa07a,
|
3649 | lightseagreen: 0x20b2aa,
|
3650 | lightskyblue: 0x87cefa,
|
3651 | lightslategray: 0x778899,
|
3652 | lightslategrey: 0x778899,
|
3653 | lightsteelblue: 0xb0c4de,
|
3654 | lightyellow: 0xffffe0,
|
3655 | lime: 0x00ff00,
|
3656 | limegreen: 0x32cd32,
|
3657 | linen: 0xfaf0e6,
|
3658 | magenta: 0xff00ff,
|
3659 | maroon: 0x800000,
|
3660 | mediumaquamarine: 0x66cdaa,
|
3661 | mediumblue: 0x0000cd,
|
3662 | mediumorchid: 0xba55d3,
|
3663 | mediumpurple: 0x9370db,
|
3664 | mediumseagreen: 0x3cb371,
|
3665 | mediumslateblue: 0x7b68ee,
|
3666 | mediumspringgreen: 0x00fa9a,
|
3667 | mediumturquoise: 0x48d1cc,
|
3668 | mediumvioletred: 0xc71585,
|
3669 | midnightblue: 0x191970,
|
3670 | mintcream: 0xf5fffa,
|
3671 | mistyrose: 0xffe4e1,
|
3672 | moccasin: 0xffe4b5,
|
3673 | navajowhite: 0xffdead,
|
3674 | navy: 0x000080,
|
3675 | oldlace: 0xfdf5e6,
|
3676 | olive: 0x808000,
|
3677 | olivedrab: 0x6b8e23,
|
3678 | orange: 0xffa500,
|
3679 | orangered: 0xff4500,
|
3680 | orchid: 0xda70d6,
|
3681 | palegoldenrod: 0xeee8aa,
|
3682 | palegreen: 0x98fb98,
|
3683 | paleturquoise: 0xafeeee,
|
3684 | palevioletred: 0xdb7093,
|
3685 | papayawhip: 0xffefd5,
|
3686 | peachpuff: 0xffdab9,
|
3687 | peru: 0xcd853f,
|
3688 | pink: 0xffc0cb,
|
3689 | plum: 0xdda0dd,
|
3690 | powderblue: 0xb0e0e6,
|
3691 | purple: 0x800080,
|
3692 | rebeccapurple: 0x663399,
|
3693 | red: 0xff0000,
|
3694 | rosybrown: 0xbc8f8f,
|
3695 | royalblue: 0x4169e1,
|
3696 | saddlebrown: 0x8b4513,
|
3697 | salmon: 0xfa8072,
|
3698 | sandybrown: 0xf4a460,
|
3699 | seagreen: 0x2e8b57,
|
3700 | seashell: 0xfff5ee,
|
3701 | sienna: 0xa0522d,
|
3702 | silver: 0xc0c0c0,
|
3703 | skyblue: 0x87ceeb,
|
3704 | slateblue: 0x6a5acd,
|
3705 | slategray: 0x708090,
|
3706 | slategrey: 0x708090,
|
3707 | snow: 0xfffafa,
|
3708 | springgreen: 0x00ff7f,
|
3709 | steelblue: 0x4682b4,
|
3710 | tan: 0xd2b48c,
|
3711 | teal: 0x008080,
|
3712 | thistle: 0xd8bfd8,
|
3713 | tomato: 0xff6347,
|
3714 | turquoise: 0x40e0d0,
|
3715 | violet: 0xee82ee,
|
3716 | wheat: 0xf5deb3,
|
3717 | white: 0xffffff,
|
3718 | whitesmoke: 0xf5f5f5,
|
3719 | yellow: 0xffff00,
|
3720 | yellowgreen: 0x9acd32
|
3721 | };
|
3722 |
|
3723 | Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" ])(Color, color, {
|
3724 | displayable: function displayable() {
|
3725 | return this.rgb().displayable();
|
3726 | },
|
3727 | toString: function toString() {
|
3728 | return this.rgb() + "";
|
3729 | }
|
3730 | });
|
3731 |
|
3732 | function color(format) {
|
3733 | var m;
|
3734 | format = (format + "").trim().toLowerCase();
|
3735 | return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb(m >> 8 & 0xf | m >> 4 & 0x0f0, m >> 4 & 0xf | m & 0xf0, (m & 0xf) << 4 | m & 0xf, 1)
|
3736 | ) : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16))
|
3737 | : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1)
|
3738 | : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1)
|
3739 | : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4])
|
3740 | : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4])
|
3741 | : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1)
|
3742 | : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4])
|
3743 | : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
|
3744 | }
|
3745 |
|
3746 | function rgbn(n) {
|
3747 | return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
|
3748 | }
|
3749 |
|
3750 | function rgba(r, g, b, a) {
|
3751 | if (a <= 0) r = g = b = NaN;
|
3752 | return new Rgb(r, g, b, a);
|
3753 | }
|
3754 |
|
3755 | function rgbConvert(o) {
|
3756 | if (!(o instanceof Color)) o = color(o);
|
3757 | if (!o) return new Rgb();
|
3758 | o = o.rgb();
|
3759 | return new Rgb(o.r, o.g, o.b, o.opacity);
|
3760 | }
|
3761 |
|
3762 | function rgb(r, g, b, opacity) {
|
3763 | return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
3764 | }
|
3765 |
|
3766 | function Rgb(r, g, b, opacity) {
|
3767 | this.r = +r;
|
3768 | this.g = +g;
|
3769 | this.b = +b;
|
3770 | this.opacity = +opacity;
|
3771 | }
|
3772 |
|
3773 | Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" ])(Rgb, rgb, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" ])(Color, {
|
3774 | brighter: function brighter(k) {
|
3775 | k = k == null ? _brighter : Math.pow(_brighter, k);
|
3776 | return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
3777 | },
|
3778 | darker: function darker(k) {
|
3779 | k = k == null ? _darker : Math.pow(_darker, k);
|
3780 | return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
3781 | },
|
3782 | rgb: function rgb() {
|
3783 | return this;
|
3784 | },
|
3785 | displayable: function displayable() {
|
3786 | return 0 <= this.r && this.r <= 255 && 0 <= this.g && this.g <= 255 && 0 <= this.b && this.b <= 255 && 0 <= this.opacity && this.opacity <= 1;
|
3787 | },
|
3788 | toString: function toString() {
|
3789 | var a = this.opacity;a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
|
3790 | return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")");
|
3791 | }
|
3792 | }));
|
3793 |
|
3794 | function hsla(h, s, l, a) {
|
3795 | if (a <= 0) h = s = l = NaN;else if (l <= 0 || l >= 1) h = s = NaN;else if (s <= 0) h = NaN;
|
3796 | return new Hsl(h, s, l, a);
|
3797 | }
|
3798 |
|
3799 | function hslConvert(o) {
|
3800 | if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
3801 | if (!(o instanceof Color)) o = color(o);
|
3802 | if (!o) return new Hsl();
|
3803 | if (o instanceof Hsl) return o;
|
3804 | o = o.rgb();
|
3805 | var r = o.r / 255,
|
3806 | g = o.g / 255,
|
3807 | b = o.b / 255,
|
3808 | min = Math.min(r, g, b),
|
3809 | max = Math.max(r, g, b),
|
3810 | h = NaN,
|
3811 | s = max - min,
|
3812 | l = (max + min) / 2;
|
3813 | if (s) {
|
3814 | if (r === max) h = (g - b) / s + (g < b) * 6;else if (g === max) h = (b - r) / s + 2;else h = (r - g) / s + 4;
|
3815 | s /= l < 0.5 ? max + min : 2 - max - min;
|
3816 | h *= 60;
|
3817 | } else {
|
3818 | s = l > 0 && l < 1 ? 0 : h;
|
3819 | }
|
3820 | return new Hsl(h, s, l, o.opacity);
|
3821 | }
|
3822 |
|
3823 | function hsl(h, s, l, opacity) {
|
3824 | return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
3825 | }
|
3826 |
|
3827 | function Hsl(h, s, l, opacity) {
|
3828 | this.h = +h;
|
3829 | this.s = +s;
|
3830 | this.l = +l;
|
3831 | this.opacity = +opacity;
|
3832 | }
|
3833 |
|
3834 | Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" ])(Hsl, hsl, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" ])(Color, {
|
3835 | brighter: function brighter(k) {
|
3836 | k = k == null ? _brighter : Math.pow(_brighter, k);
|
3837 | return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
3838 | },
|
3839 | darker: function darker(k) {
|
3840 | k = k == null ? _darker : Math.pow(_darker, k);
|
3841 | return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
3842 | },
|
3843 | rgb: function rgb() {
|
3844 | var h = this.h % 360 + (this.h < 0) * 360,
|
3845 | s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
3846 | l = this.l,
|
3847 | m2 = l + (l < 0.5 ? l : 1 - l) * s,
|
3848 | m1 = 2 * l - m2;
|
3849 | return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
|
3850 | },
|
3851 | displayable: function displayable() {
|
3852 | return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
|
3853 | }
|
3854 | }));
|
3855 |
|
3856 |
|
3857 | function hsl2rgb(h, m1, m2) {
|
3858 | return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
|
3859 | }
|
3860 |
|
3861 |
|
3862 | },
|
3863 |
|
3864 | function (module, __webpack_exports__, __webpack_require__) {
|
3865 |
|
3866 | "use strict";
|
3867 |
|
3868 | __webpack_exports__["b"] = extend;
|
3869 | __webpack_exports__["a"] = function (constructor, factory, prototype) {
|
3870 | constructor.prototype = factory.prototype = prototype;
|
3871 | prototype.constructor = constructor;
|
3872 | };
|
3873 |
|
3874 | function extend(parent, definition) {
|
3875 | var prototype = Object.create(parent.prototype);
|
3876 | for (var key in definition) {
|
3877 | prototype[key] = definition[key];
|
3878 | }return prototype;
|
3879 | }
|
3880 |
|
3881 |
|
3882 | },
|
3883 |
|
3884 | function (module, __webpack_exports__, __webpack_require__) {
|
3885 |
|
3886 | "use strict";
|
3887 |
|
3888 | __webpack_exports__["a"] = basis;
|
3889 | function basis(t1, v0, v1, v2, v3) {
|
3890 | var t2 = t1 * t1,
|
3891 | t3 = t2 * t1;
|
3892 | return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
|
3893 | }
|
3894 |
|
3895 | __webpack_exports__["b"] = function (values) {
|
3896 | var n = values.length - 1;
|
3897 | return function (t) {
|
3898 | var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
|
3899 | v1 = values[i],
|
3900 | v2 = values[i + 1],
|
3901 | v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
|
3902 | v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
|
3903 | return basis((t - i / n) * n, v0, v1, v2, v3);
|
3904 | };
|
3905 | };
|
3906 |
|
3907 |
|
3908 | },
|
3909 |
|
3910 | function (module, exports, __webpack_require__) {
|
3911 |
|
3912 | var vec2 = __webpack_require__(3).vec2;
|
3913 |
|
3914 | module.exports = {
|
3915 | at: function at(p1, p2, t) {
|
3916 | return (p2 - p1) * t + p1;
|
3917 | },
|
3918 | pointDistance: function pointDistance(x1, y1, x2, y2, x, y) {
|
3919 | var d = [x2 - x1, y2 - y1];
|
3920 | if (vec2.exactEquals(d, [0, 0])) {
|
3921 | return NaN;
|
3922 | }
|
3923 |
|
3924 | var u = [-d[1], d[0]];
|
3925 | vec2.normalize(u, u);
|
3926 | var a = [x - x1, y - y1];
|
3927 | return Math.abs(vec2.dot(a, u));
|
3928 | },
|
3929 | box: function box(x1, y1, x2, y2, lineWidth) {
|
3930 | var halfWidth = lineWidth / 2;
|
3931 | var minX = Math.min(x1, x2);
|
3932 | var maxX = Math.max(x1, x2);
|
3933 | var minY = Math.min(y1, y2);
|
3934 | var maxY = Math.max(y1, y2);
|
3935 |
|
3936 | return {
|
3937 | minX: minX - halfWidth,
|
3938 | minY: minY - halfWidth,
|
3939 | maxX: maxX + halfWidth,
|
3940 | maxY: maxY + halfWidth
|
3941 | };
|
3942 | },
|
3943 | len: function len(x1, y1, x2, y2) {
|
3944 | return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
3945 | }
|
3946 | };
|
3947 |
|
3948 |
|
3949 | },
|
3950 |
|
3951 | function (module, exports, __webpack_require__) {
|
3952 |
|
3953 | var Util = __webpack_require__(0);
|
3954 | var vec2 = __webpack_require__(3).vec2;
|
3955 |
|
3956 | function quadraticAt(p0, p1, p2, t) {
|
3957 | var onet = 1 - t;
|
3958 | return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
|
3959 | }
|
3960 |
|
3961 | function quadraticProjectPoint(x1, y1, x2, y2, x3, y3, x, y, out) {
|
3962 | var t = void 0;
|
3963 | var interval = 0.005;
|
3964 | var d = Infinity;
|
3965 | var d1 = void 0;
|
3966 | var v1 = void 0;
|
3967 | var v2 = void 0;
|
3968 | var _t = void 0;
|
3969 | var d2 = void 0;
|
3970 | var i = void 0;
|
3971 | var EPSILON = 0.0001;
|
3972 | var v0 = [x, y];
|
3973 |
|
3974 | for (_t = 0; _t < 1; _t += 0.05) {
|
3975 | v1 = [quadraticAt(x1, x2, x3, _t), quadraticAt(y1, y2, y3, _t)];
|
3976 |
|
3977 | d1 = vec2.squaredDistance(v0, v1);
|
3978 | if (d1 < d) {
|
3979 | t = _t;
|
3980 | d = d1;
|
3981 | }
|
3982 | }
|
3983 | d = Infinity;
|
3984 |
|
3985 | for (i = 0; i < 32; i++) {
|
3986 | if (interval < EPSILON) {
|
3987 | break;
|
3988 | }
|
3989 |
|
3990 | var prev = t - interval;
|
3991 | var next = t + interval;
|
3992 |
|
3993 | v1 = [quadraticAt(x1, x2, x3, prev), quadraticAt(y1, y2, y3, prev)];
|
3994 |
|
3995 | d1 = vec2.squaredDistance(v0, v1);
|
3996 |
|
3997 | if (prev >= 0 && d1 < d) {
|
3998 | t = prev;
|
3999 | d = d1;
|
4000 | } else {
|
4001 | v2 = [quadraticAt(x1, x2, x3, next), quadraticAt(y1, y2, y3, next)];
|
4002 |
|
4003 | d2 = vec2.squaredDistance(v0, v2);
|
4004 |
|
4005 | if (next <= 1 && d2 < d) {
|
4006 | t = next;
|
4007 | d = d2;
|
4008 | } else {
|
4009 | interval *= 0.5;
|
4010 | }
|
4011 | }
|
4012 | }
|
4013 |
|
4014 | if (out) {
|
4015 | out.x = quadraticAt(x1, x2, x3, t);
|
4016 | out.y = quadraticAt(y1, y2, y3, t);
|
4017 | }
|
4018 |
|
4019 | return Math.sqrt(d);
|
4020 | }
|
4021 |
|
4022 | function quadraticExtrema(p0, p1, p2) {
|
4023 | var a = p0 + p2 - 2 * p1;
|
4024 | if (Util.isNumberEqual(a, 0)) {
|
4025 | return [0.5];
|
4026 | }
|
4027 | var rst = (p0 - p1) / a;
|
4028 | if (rst <= 1 && rst >= 0) {
|
4029 | return [rst];
|
4030 | }
|
4031 | return [];
|
4032 | }
|
4033 |
|
4034 | module.exports = {
|
4035 | at: quadraticAt,
|
4036 | projectPoint: function projectPoint(x1, y1, x2, y2, x3, y3, x, y) {
|
4037 | var rst = {};
|
4038 | quadraticProjectPoint(x1, y1, x2, y2, x3, y3, x, y, rst);
|
4039 | return rst;
|
4040 | },
|
4041 |
|
4042 | pointDistance: quadraticProjectPoint,
|
4043 | extrema: quadraticExtrema
|
4044 | };
|
4045 |
|
4046 |
|
4047 | },
|
4048 |
|
4049 | function (module, exports, __webpack_require__) {
|
4050 |
|
4051 | var Util = __webpack_require__(0);
|
4052 | var vec2 = __webpack_require__(3).vec2;
|
4053 |
|
4054 | function circlePoint(cx, cy, r, angle) {
|
4055 | return {
|
4056 | x: Math.cos(angle) * r + cx,
|
4057 | y: Math.sin(angle) * r + cy
|
4058 | };
|
4059 | }
|
4060 |
|
4061 | function angleNearTo(angle, min, max, out) {
|
4062 | var v1 = void 0;
|
4063 | var v2 = void 0;
|
4064 | if (out) {
|
4065 | if (angle < min) {
|
4066 | v1 = min - angle;
|
4067 | v2 = Math.PI * 2 - max + angle;
|
4068 | } else if (angle > max) {
|
4069 | v1 = Math.PI * 2 - angle + min;
|
4070 | v2 = angle - max;
|
4071 | }
|
4072 | } else {
|
4073 | v1 = angle - min;
|
4074 | v2 = max - angle;
|
4075 | }
|
4076 |
|
4077 | return v1 > v2 ? max : min;
|
4078 | }
|
4079 |
|
4080 | function nearAngle(angle, startAngle, endAngle, clockwise) {
|
4081 | var plus = 0;
|
4082 | if (endAngle - startAngle >= Math.PI * 2) {
|
4083 | plus = Math.PI * 2;
|
4084 | }
|
4085 | startAngle = Util.mod(startAngle, Math.PI * 2);
|
4086 | endAngle = Util.mod(endAngle, Math.PI * 2) + plus;
|
4087 | angle = Util.mod(angle, Math.PI * 2);
|
4088 | if (clockwise) {
|
4089 | if (startAngle >= endAngle) {
|
4090 | if (angle > endAngle && angle < startAngle) {
|
4091 | return angle;
|
4092 | }
|
4093 | return angleNearTo(angle, endAngle, startAngle, true);
|
4094 | }
|
4095 | if (angle < startAngle || angle > endAngle) {
|
4096 | return angle;
|
4097 | }
|
4098 | return angleNearTo(angle, startAngle, endAngle);
|
4099 | }
|
4100 | if (startAngle <= endAngle) {
|
4101 | if (startAngle < angle && angle < endAngle) {
|
4102 | return angle;
|
4103 | }
|
4104 | return angleNearTo(angle, startAngle, endAngle, true);
|
4105 | }
|
4106 | if (angle > startAngle || angle < endAngle) {
|
4107 | return angle;
|
4108 | }
|
4109 | return angleNearTo(angle, endAngle, startAngle);
|
4110 | }
|
4111 |
|
4112 | function arcProjectPoint(cx, cy, r, startAngle, endAngle, clockwise, x, y, out) {
|
4113 | var v = [x, y];
|
4114 | var v0 = [cx, cy];
|
4115 | var v1 = [1, 0];
|
4116 | var subv = vec2.subtract([], v, v0);
|
4117 | var angle = vec2.angleTo(v1, subv);
|
4118 |
|
4119 | angle = nearAngle(angle, startAngle, endAngle, clockwise);
|
4120 | var vpoint = [r * Math.cos(angle) + cx, r * Math.sin(angle) + cy];
|
4121 | if (out) {
|
4122 | out.x = vpoint[0];
|
4123 | out.y = vpoint[1];
|
4124 | }
|
4125 | var d = vec2.distance(vpoint, v);
|
4126 | return d;
|
4127 | }
|
4128 |
|
4129 | function arcBox(cx, cy, r, startAngle, endAngle, clockwise) {
|
4130 | var angleRight = 0;
|
4131 | var angleBottom = Math.PI / 2;
|
4132 | var angleLeft = Math.PI;
|
4133 | var angleTop = Math.PI * 3 / 2;
|
4134 | var points = [];
|
4135 | var angle = nearAngle(angleRight, startAngle, endAngle, clockwise);
|
4136 | if (angle === angleRight) {
|
4137 | points.push(circlePoint(cx, cy, r, angleRight));
|
4138 | }
|
4139 |
|
4140 | angle = nearAngle(angleBottom, startAngle, endAngle, clockwise);
|
4141 | if (angle === angleBottom) {
|
4142 | points.push(circlePoint(cx, cy, r, angleBottom));
|
4143 | }
|
4144 |
|
4145 | angle = nearAngle(angleLeft, startAngle, endAngle, clockwise);
|
4146 | if (angle === angleLeft) {
|
4147 | points.push(circlePoint(cx, cy, r, angleLeft));
|
4148 | }
|
4149 |
|
4150 | angle = nearAngle(angleTop, startAngle, endAngle, clockwise);
|
4151 | if (angle === angleTop) {
|
4152 | points.push(circlePoint(cx, cy, r, angleTop));
|
4153 | }
|
4154 |
|
4155 | points.push(circlePoint(cx, cy, r, startAngle));
|
4156 | points.push(circlePoint(cx, cy, r, endAngle));
|
4157 | var minX = Infinity;
|
4158 | var maxX = -Infinity;
|
4159 | var minY = Infinity;
|
4160 | var maxY = -Infinity;
|
4161 | Util.each(points, function (point) {
|
4162 | if (minX > point.x) {
|
4163 | minX = point.x;
|
4164 | }
|
4165 | if (maxX < point.x) {
|
4166 | maxX = point.x;
|
4167 | }
|
4168 | if (minY > point.y) {
|
4169 | minY = point.y;
|
4170 | }
|
4171 | if (maxY < point.y) {
|
4172 | maxY = point.y;
|
4173 | }
|
4174 | });
|
4175 |
|
4176 | return {
|
4177 | minX: minX,
|
4178 | minY: minY,
|
4179 | maxX: maxX,
|
4180 | maxY: maxY
|
4181 | };
|
4182 | }
|
4183 |
|
4184 | module.exports = {
|
4185 | nearAngle: nearAngle,
|
4186 | projectPoint: function projectPoint(cx, cy, r, startAngle, endAngle, clockwise, x, y) {
|
4187 | var rst = {};
|
4188 | arcProjectPoint(cx, cy, r, startAngle, endAngle, clockwise, x, y, rst);
|
4189 | return rst;
|
4190 | },
|
4191 |
|
4192 | pointDistance: arcProjectPoint,
|
4193 | box: arcBox
|
4194 | };
|
4195 |
|
4196 |
|
4197 | },
|
4198 |
|
4199 | function (module, exports, __webpack_require__) {
|
4200 |
|
4201 | (function (global) {
|
4202 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
4203 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
4204 | } : function (obj) {
|
4205 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
4206 | };
|
4207 |
|
4208 |
|
4209 | var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global && global.Object === Object && global;
|
4210 |
|
4211 | module.exports = freeGlobal;
|
4212 |
|
4213 | }).call(exports, __webpack_require__(114));
|
4214 |
|
4215 |
|
4216 | },
|
4217 |
|
4218 | function (module, exports, __webpack_require__) {
|
4219 |
|
4220 | var baseGetTag = __webpack_require__(7),
|
4221 | isArray = __webpack_require__(6),
|
4222 | isObjectLike = __webpack_require__(5);
|
4223 |
|
4224 |
|
4225 | var stringTag = '[object String]';
|
4226 |
|
4227 | |
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 |
|
4241 |
|
4242 |
|
4243 |
|
4244 | function isString(value) {
|
4245 | return typeof value == 'string' || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
|
4246 | }
|
4247 |
|
4248 | module.exports = isString;
|
4249 |
|
4250 |
|
4251 | },
|
4252 |
|
4253 | function (module, exports, __webpack_require__) {
|
4254 |
|
4255 | var isPrototype = __webpack_require__(16),
|
4256 | nativeKeys = __webpack_require__(121);
|
4257 |
|
4258 |
|
4259 | var objectProto = Object.prototype;
|
4260 |
|
4261 |
|
4262 | var hasOwnProperty = objectProto.hasOwnProperty;
|
4263 |
|
4264 | |
4265 |
|
4266 |
|
4267 |
|
4268 |
|
4269 |
|
4270 |
|
4271 | function baseKeys(object) {
|
4272 | if (!isPrototype(object)) {
|
4273 | return nativeKeys(object);
|
4274 | }
|
4275 | var result = [];
|
4276 | for (var key in Object(object)) {
|
4277 | if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
4278 | result.push(key);
|
4279 | }
|
4280 | }
|
4281 | return result;
|
4282 | }
|
4283 |
|
4284 | module.exports = baseKeys;
|
4285 |
|
4286 |
|
4287 | },
|
4288 |
|
4289 | function (module, exports) {
|
4290 |
|
4291 | |
4292 |
|
4293 |
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 |
|
4299 | function overArg(func, transform) {
|
4300 | return function (arg) {
|
4301 | return func(transform(arg));
|
4302 | };
|
4303 | }
|
4304 |
|
4305 | module.exports = overArg;
|
4306 |
|
4307 |
|
4308 | },
|
4309 |
|
4310 | function (module, exports) {
|
4311 |
|
4312 |
|
4313 | var funcProto = Function.prototype;
|
4314 |
|
4315 |
|
4316 | var funcToString = funcProto.toString;
|
4317 |
|
4318 | |
4319 |
|
4320 |
|
4321 |
|
4322 |
|
4323 |
|
4324 |
|
4325 | function toSource(func) {
|
4326 | if (func != null) {
|
4327 | try {
|
4328 | return funcToString.call(func);
|
4329 | } catch (e) {}
|
4330 | try {
|
4331 | return func + '';
|
4332 | } catch (e) {}
|
4333 | }
|
4334 | return '';
|
4335 | }
|
4336 |
|
4337 | module.exports = toSource;
|
4338 |
|
4339 |
|
4340 | },
|
4341 |
|
4342 | function (module, exports) {
|
4343 |
|
4344 |
|
4345 | var MAX_SAFE_INTEGER = 9007199254740991;
|
4346 |
|
4347 | |
4348 |
|
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 |
|
4357 |
|
4358 |
|
4359 |
|
4360 |
|
4361 |
|
4362 |
|
4363 |
|
4364 |
|
4365 |
|
4366 |
|
4367 |
|
4368 |
|
4369 |
|
4370 |
|
4371 |
|
4372 |
|
4373 | function isLength(value) {
|
4374 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
4375 | }
|
4376 |
|
4377 | module.exports = isLength;
|
4378 |
|
4379 |
|
4380 | },
|
4381 |
|
4382 | function (module, exports) {
|
4383 |
|
4384 | |
4385 |
|
4386 |
|
4387 |
|
4388 |
|
4389 |
|
4390 |
|
4391 | function baseUnary(func) {
|
4392 | return function (value) {
|
4393 | return func(value);
|
4394 | };
|
4395 | }
|
4396 |
|
4397 | module.exports = baseUnary;
|
4398 |
|
4399 |
|
4400 | },
|
4401 |
|
4402 | function (module, exports, __webpack_require__) {
|
4403 |
|
4404 | var baseToString = __webpack_require__(135);
|
4405 |
|
4406 | |
4407 |
|
4408 |
|
4409 |
|
4410 |
|
4411 |
|
4412 |
|
4413 |
|
4414 |
|
4415 |
|
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 |
|
4421 |
|
4422 |
|
4423 |
|
4424 |
|
4425 |
|
4426 |
|
4427 | function toString(value) {
|
4428 | return value == null ? '' : baseToString(value);
|
4429 | }
|
4430 |
|
4431 | module.exports = toString;
|
4432 |
|
4433 |
|
4434 | },
|
4435 |
|
4436 | function (module, exports, __webpack_require__) {
|
4437 |
|
4438 | var mapCacheClear = __webpack_require__(149),
|
4439 | mapCacheDelete = __webpack_require__(156),
|
4440 | mapCacheGet = __webpack_require__(158),
|
4441 | mapCacheHas = __webpack_require__(159),
|
4442 | mapCacheSet = __webpack_require__(160);
|
4443 |
|
4444 | |
4445 |
|
4446 |
|
4447 |
|
4448 |
|
4449 |
|
4450 |
|
4451 | function MapCache(entries) {
|
4452 | var index = -1,
|
4453 | length = entries == null ? 0 : entries.length;
|
4454 |
|
4455 | this.clear();
|
4456 | while (++index < length) {
|
4457 | var entry = entries[index];
|
4458 | this.set(entry[0], entry[1]);
|
4459 | }
|
4460 | }
|
4461 |
|
4462 |
|
4463 | MapCache.prototype.clear = mapCacheClear;
|
4464 | MapCache.prototype['delete'] = mapCacheDelete;
|
4465 | MapCache.prototype.get = mapCacheGet;
|
4466 | MapCache.prototype.has = mapCacheHas;
|
4467 | MapCache.prototype.set = mapCacheSet;
|
4468 |
|
4469 | module.exports = MapCache;
|
4470 |
|
4471 |
|
4472 | },
|
4473 |
|
4474 | function (module, exports) {
|
4475 |
|
4476 | |
4477 |
|
4478 |
|
4479 |
|
4480 |
|
4481 |
|
4482 |
|
4483 |
|
4484 |
|
4485 | function arrayEach(array, iteratee) {
|
4486 | var index = -1,
|
4487 | length = array == null ? 0 : array.length;
|
4488 |
|
4489 | while (++index < length) {
|
4490 | if (iteratee(array[index], index, array) === false) {
|
4491 | break;
|
4492 | }
|
4493 | }
|
4494 | return array;
|
4495 | }
|
4496 |
|
4497 | module.exports = arrayEach;
|
4498 |
|
4499 |
|
4500 | },
|
4501 |
|
4502 | function (module, exports, __webpack_require__) {
|
4503 |
|
4504 | var getNative = __webpack_require__(10);
|
4505 |
|
4506 | var defineProperty = function () {
|
4507 | try {
|
4508 | var func = getNative(Object, 'defineProperty');
|
4509 | func({}, '', {});
|
4510 | return func;
|
4511 | } catch (e) {}
|
4512 | }();
|
4513 |
|
4514 | module.exports = defineProperty;
|
4515 |
|
4516 |
|
4517 | },
|
4518 |
|
4519 | function (module, exports, __webpack_require__) {
|
4520 |
|
4521 | var baseTimes = __webpack_require__(162),
|
4522 | isArguments = __webpack_require__(33),
|
4523 | isArray = __webpack_require__(6),
|
4524 | isBuffer = __webpack_require__(17),
|
4525 | isIndex = __webpack_require__(67),
|
4526 | isTypedArray = __webpack_require__(22);
|
4527 |
|
4528 |
|
4529 | var objectProto = Object.prototype;
|
4530 |
|
4531 |
|
4532 | var hasOwnProperty = objectProto.hasOwnProperty;
|
4533 |
|
4534 | |
4535 |
|
4536 |
|
4537 |
|
4538 |
|
4539 |
|
4540 |
|
4541 |
|
4542 | function arrayLikeKeys(value, inherited) {
|
4543 | var isArr = isArray(value),
|
4544 | isArg = !isArr && isArguments(value),
|
4545 | isBuff = !isArr && !isArg && isBuffer(value),
|
4546 | isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
4547 | skipIndexes = isArr || isArg || isBuff || isType,
|
4548 | result = skipIndexes ? baseTimes(value.length, String) : [],
|
4549 | length = result.length;
|
4550 |
|
4551 | for (var key in value) {
|
4552 | if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (
|
4553 |
|
4554 | key == 'length' ||
|
4555 |
|
4556 | isBuff && (key == 'offset' || key == 'parent') ||
|
4557 |
|
4558 | isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') ||
|
4559 |
|
4560 | isIndex(key, length)))) {
|
4561 | result.push(key);
|
4562 | }
|
4563 | }
|
4564 | return result;
|
4565 | }
|
4566 |
|
4567 | module.exports = arrayLikeKeys;
|
4568 |
|
4569 |
|
4570 | },
|
4571 |
|
4572 | function (module, exports) {
|
4573 |
|
4574 |
|
4575 | var MAX_SAFE_INTEGER = 9007199254740991;
|
4576 |
|
4577 |
|
4578 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
4579 |
|
4580 | |
4581 |
|
4582 |
|
4583 |
|
4584 |
|
4585 |
|
4586 |
|
4587 |
|
4588 | function isIndex(value, length) {
|
4589 | length = length == null ? MAX_SAFE_INTEGER : length;
|
4590 | return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
|
4591 | }
|
4592 |
|
4593 | module.exports = isIndex;
|
4594 |
|
4595 |
|
4596 | },
|
4597 |
|
4598 | function (module, exports, __webpack_require__) {
|
4599 |
|
4600 | (function (module) {
|
4601 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
4602 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
4603 | } : function (obj) {
|
4604 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
4605 | };
|
4606 |
|
4607 | var root = __webpack_require__(4);
|
4608 |
|
4609 |
|
4610 | var freeExports = (false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
|
4611 |
|
4612 |
|
4613 | var freeModule = freeExports && (false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
|
4614 |
|
4615 |
|
4616 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
4617 |
|
4618 |
|
4619 | var Buffer = moduleExports ? root.Buffer : undefined,
|
4620 | allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
4621 |
|
4622 | |
4623 |
|
4624 |
|
4625 |
|
4626 |
|
4627 |
|
4628 |
|
4629 |
|
4630 | function cloneBuffer(buffer, isDeep) {
|
4631 | if (isDeep) {
|
4632 | return buffer.slice();
|
4633 | }
|
4634 | var length = buffer.length,
|
4635 | result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
4636 |
|
4637 | buffer.copy(result);
|
4638 | return result;
|
4639 | }
|
4640 |
|
4641 | module.exports = cloneBuffer;
|
4642 |
|
4643 | }).call(exports, __webpack_require__(34)(module));
|
4644 |
|
4645 |
|
4646 | },
|
4647 |
|
4648 | function (module, exports) {
|
4649 |
|
4650 | |
4651 |
|
4652 |
|
4653 |
|
4654 |
|
4655 |
|
4656 |
|
4657 |
|
4658 |
|
4659 |
|
4660 |
|
4661 |
|
4662 |
|
4663 |
|
4664 |
|
4665 |
|
4666 |
|
4667 |
|
4668 | function stubArray() {
|
4669 | return [];
|
4670 | }
|
4671 |
|
4672 | module.exports = stubArray;
|
4673 |
|
4674 |
|
4675 | },
|
4676 |
|
4677 | function (module, exports, __webpack_require__) {
|
4678 |
|
4679 | var arrayPush = __webpack_require__(71),
|
4680 | getPrototype = __webpack_require__(40),
|
4681 | getSymbols = __webpack_require__(39),
|
4682 | stubArray = __webpack_require__(69);
|
4683 |
|
4684 |
|
4685 | var nativeGetSymbols = Object.getOwnPropertySymbols;
|
4686 |
|
4687 | |
4688 |
|
4689 |
|
4690 |
|
4691 |
|
4692 |
|
4693 |
|
4694 | var getSymbolsIn = !nativeGetSymbols ? stubArray : function (object) {
|
4695 | var result = [];
|
4696 | while (object) {
|
4697 | arrayPush(result, getSymbols(object));
|
4698 | object = getPrototype(object);
|
4699 | }
|
4700 | return result;
|
4701 | };
|
4702 |
|
4703 | module.exports = getSymbolsIn;
|
4704 |
|
4705 |
|
4706 | },
|
4707 |
|
4708 | function (module, exports) {
|
4709 |
|
4710 | |
4711 |
|
4712 |
|
4713 |
|
4714 |
|
4715 |
|
4716 |
|
4717 |
|
4718 | function arrayPush(array, values) {
|
4719 | var index = -1,
|
4720 | length = values.length,
|
4721 | offset = array.length;
|
4722 |
|
4723 | while (++index < length) {
|
4724 | array[offset + index] = values[index];
|
4725 | }
|
4726 | return array;
|
4727 | }
|
4728 |
|
4729 | module.exports = arrayPush;
|
4730 |
|
4731 |
|
4732 | },
|
4733 |
|
4734 | function (module, exports, __webpack_require__) {
|
4735 |
|
4736 | var baseGetAllKeys = __webpack_require__(73),
|
4737 | getSymbols = __webpack_require__(39),
|
4738 | keys = __webpack_require__(13);
|
4739 |
|
4740 | |
4741 |
|
4742 |
|
4743 |
|
4744 |
|
4745 |
|
4746 |
|
4747 | function getAllKeys(object) {
|
4748 | return baseGetAllKeys(object, keys, getSymbols);
|
4749 | }
|
4750 |
|
4751 | module.exports = getAllKeys;
|
4752 |
|
4753 |
|
4754 | },
|
4755 |
|
4756 | function (module, exports, __webpack_require__) {
|
4757 |
|
4758 | var arrayPush = __webpack_require__(71),
|
4759 | isArray = __webpack_require__(6);
|
4760 |
|
4761 | |
4762 |
|
4763 |
|
4764 |
|
4765 |
|
4766 |
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 | function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
4773 | var result = keysFunc(object);
|
4774 | return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
4775 | }
|
4776 |
|
4777 | module.exports = baseGetAllKeys;
|
4778 |
|
4779 |
|
4780 | },
|
4781 |
|
4782 | function (module, exports, __webpack_require__) {
|
4783 |
|
4784 | var root = __webpack_require__(4);
|
4785 |
|
4786 |
|
4787 | var Uint8Array = root.Uint8Array;
|
4788 |
|
4789 | module.exports = Uint8Array;
|
4790 |
|
4791 |
|
4792 | },
|
4793 |
|
4794 | function (module, exports) {
|
4795 |
|
4796 | |
4797 |
|
4798 |
|
4799 |
|
4800 |
|
4801 |
|
4802 |
|
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 |
|
4808 | function arrayReduce(array, iteratee, accumulator, initAccum) {
|
4809 | var index = -1,
|
4810 | length = array == null ? 0 : array.length;
|
4811 |
|
4812 | if (initAccum && length) {
|
4813 | accumulator = array[++index];
|
4814 | }
|
4815 | while (++index < length) {
|
4816 | accumulator = iteratee(accumulator, array[index], index, array);
|
4817 | }
|
4818 | return accumulator;
|
4819 | }
|
4820 |
|
4821 | module.exports = arrayReduce;
|
4822 |
|
4823 |
|
4824 | },
|
4825 |
|
4826 | function (module, exports, __webpack_require__) {
|
4827 |
|
4828 | var cloneArrayBuffer = __webpack_require__(41);
|
4829 |
|
4830 | |
4831 |
|
4832 |
|
4833 |
|
4834 |
|
4835 |
|
4836 |
|
4837 |
|
4838 | function cloneTypedArray(typedArray, isDeep) {
|
4839 | var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
4840 | return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
4841 | }
|
4842 |
|
4843 | module.exports = cloneTypedArray;
|
4844 |
|
4845 |
|
4846 | },
|
4847 |
|
4848 | function (module, exports, __webpack_require__) {
|
4849 |
|
4850 | var baseCreate = __webpack_require__(179),
|
4851 | getPrototype = __webpack_require__(40),
|
4852 | isPrototype = __webpack_require__(16);
|
4853 |
|
4854 | |
4855 |
|
4856 |
|
4857 |
|
4858 |
|
4859 |
|
4860 |
|
4861 | function initCloneObject(object) {
|
4862 | return typeof object.constructor == 'function' && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
4863 | }
|
4864 |
|
4865 | module.exports = initCloneObject;
|
4866 |
|
4867 |
|
4868 | },
|
4869 |
|
4870 | function (module, exports, __webpack_require__) {
|
4871 |
|
4872 | var baseRest = __webpack_require__(79),
|
4873 | isIterateeCall = __webpack_require__(187);
|
4874 |
|
4875 | |
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 | function createAssigner(assigner) {
|
4883 | return baseRest(function (object, sources) {
|
4884 | var index = -1,
|
4885 | length = sources.length,
|
4886 | customizer = length > 1 ? sources[length - 1] : undefined,
|
4887 | guard = length > 2 ? sources[2] : undefined;
|
4888 |
|
4889 | customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined;
|
4890 |
|
4891 | if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
4892 | customizer = length < 3 ? undefined : customizer;
|
4893 | length = 1;
|
4894 | }
|
4895 | object = Object(object);
|
4896 | while (++index < length) {
|
4897 | var source = sources[index];
|
4898 | if (source) {
|
4899 | assigner(object, source, index, customizer);
|
4900 | }
|
4901 | }
|
4902 | return object;
|
4903 | });
|
4904 | }
|
4905 |
|
4906 | module.exports = createAssigner;
|
4907 |
|
4908 |
|
4909 | },
|
4910 |
|
4911 | function (module, exports, __webpack_require__) {
|
4912 |
|
4913 | var identity = __webpack_require__(44),
|
4914 | overRest = __webpack_require__(181),
|
4915 | setToString = __webpack_require__(183);
|
4916 |
|
4917 | |
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 | function baseRest(func, start) {
|
4926 | return setToString(overRest(func, start, identity), func + '');
|
4927 | }
|
4928 |
|
4929 | module.exports = baseRest;
|
4930 |
|
4931 |
|
4932 | },
|
4933 |
|
4934 | function (module, exports, __webpack_require__) {
|
4935 |
|
4936 | var baseAssignValue = __webpack_require__(38),
|
4937 | eq = __webpack_require__(18);
|
4938 |
|
4939 | |
4940 |
|
4941 |
|
4942 |
|
4943 |
|
4944 |
|
4945 |
|
4946 |
|
4947 |
|
4948 | function assignMergeValue(object, key, value) {
|
4949 | if (value !== undefined && !eq(object[key], value) || value === undefined && !(key in object)) {
|
4950 | baseAssignValue(object, key, value);
|
4951 | }
|
4952 | }
|
4953 |
|
4954 | module.exports = assignMergeValue;
|
4955 |
|
4956 |
|
4957 | },
|
4958 |
|
4959 | function (module, exports, __webpack_require__) {
|
4960 |
|
4961 | var createBaseFor = __webpack_require__(190);
|
4962 |
|
4963 | |
4964 |
|
4965 |
|
4966 |
|
4967 |
|
4968 |
|
4969 |
|
4970 |
|
4971 |
|
4972 |
|
4973 |
|
4974 | var baseFor = createBaseFor();
|
4975 |
|
4976 | module.exports = baseFor;
|
4977 |
|
4978 |
|
4979 | },
|
4980 |
|
4981 | function (module, exports) {
|
4982 |
|
4983 |
|
4984 | var rsAstralRange = '\\ud800-\\udfff',
|
4985 | rsComboMarksRange = '\\u0300-\\u036f',
|
4986 | reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
4987 | rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
4988 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
4989 | rsVarRange = '\\ufe0e\\ufe0f';
|
4990 |
|
4991 |
|
4992 | var rsZWJ = '\\u200d';
|
4993 |
|
4994 |
|
4995 | var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
|
4996 |
|
4997 | |
4998 |
|
4999 |
|
5000 |
|
5001 |
|
5002 |
|
5003 |
|
5004 | function hasUnicode(string) {
|
5005 | return reHasUnicode.test(string);
|
5006 | }
|
5007 |
|
5008 | module.exports = hasUnicode;
|
5009 |
|
5010 |
|
5011 | },
|
5012 |
|
5013 | function (module, exports, __webpack_require__) {
|
5014 |
|
5015 | var asciiToArray = __webpack_require__(199),
|
5016 | hasUnicode = __webpack_require__(82),
|
5017 | unicodeToArray = __webpack_require__(200);
|
5018 |
|
5019 | |
5020 |
|
5021 |
|
5022 |
|
5023 |
|
5024 |
|
5025 |
|
5026 | function stringToArray(string) {
|
5027 | return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
|
5028 | }
|
5029 |
|
5030 | module.exports = stringToArray;
|
5031 |
|
5032 |
|
5033 | },
|
5034 |
|
5035 | function (module, exports, __webpack_require__) {
|
5036 |
|
5037 | var SetCache = __webpack_require__(217),
|
5038 | arraySome = __webpack_require__(220),
|
5039 | cacheHas = __webpack_require__(221);
|
5040 |
|
5041 |
|
5042 | var COMPARE_PARTIAL_FLAG = 1,
|
5043 | COMPARE_UNORDERED_FLAG = 2;
|
5044 |
|
5045 | |
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 |
|
5054 |
|
5055 |
|
5056 |
|
5057 |
|
5058 | function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
5059 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
5060 | arrLength = array.length,
|
5061 | othLength = other.length;
|
5062 |
|
5063 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
5064 | return false;
|
5065 | }
|
5066 |
|
5067 | var stacked = stack.get(array);
|
5068 | if (stacked && stack.get(other)) {
|
5069 | return stacked == other;
|
5070 | }
|
5071 | var index = -1,
|
5072 | result = true,
|
5073 | seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined;
|
5074 |
|
5075 | stack.set(array, other);
|
5076 | stack.set(other, array);
|
5077 |
|
5078 |
|
5079 | while (++index < arrLength) {
|
5080 | var arrValue = array[index],
|
5081 | othValue = other[index];
|
5082 |
|
5083 | if (customizer) {
|
5084 | var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
|
5085 | }
|
5086 | if (compared !== undefined) {
|
5087 | if (compared) {
|
5088 | continue;
|
5089 | }
|
5090 | result = false;
|
5091 | break;
|
5092 | }
|
5093 |
|
5094 | if (seen) {
|
5095 | if (!arraySome(other, function (othValue, othIndex) {
|
5096 | if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
5097 | return seen.push(othIndex);
|
5098 | }
|
5099 | })) {
|
5100 | result = false;
|
5101 | break;
|
5102 | }
|
5103 | } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
5104 | result = false;
|
5105 | break;
|
5106 | }
|
5107 | }
|
5108 | stack['delete'](array);
|
5109 | stack['delete'](other);
|
5110 | return result;
|
5111 | }
|
5112 |
|
5113 | module.exports = equalArrays;
|
5114 |
|
5115 |
|
5116 | },
|
5117 |
|
5118 | function (module, exports) {
|
5119 |
|
5120 | var TABLE = document.createElement('table');
|
5121 | var TABLE_TR = document.createElement('tr');
|
5122 | var FRAGMENT_REG = /^\s*<(\w+|!)[^>]*>/;
|
5123 | var CONTAINERS = {
|
5124 | tr: document.createElement('tbody'),
|
5125 | tbody: TABLE,
|
5126 | thead: TABLE,
|
5127 | tfoot: TABLE,
|
5128 | td: TABLE_TR,
|
5129 | th: TABLE_TR,
|
5130 | '*': document.createElement('div')
|
5131 | };
|
5132 |
|
5133 | module.exports = {
|
5134 | getBoundingClientRect: function getBoundingClientRect(node) {
|
5135 | var rect = node.getBoundingClientRect();
|
5136 | var top = document.documentElement.clientTop;
|
5137 | var left = document.documentElement.clientLeft;
|
5138 | return {
|
5139 | top: rect.top - top,
|
5140 | bottom: rect.bottom - top,
|
5141 | left: rect.left - left,
|
5142 | right: rect.right - left
|
5143 | };
|
5144 | },
|
5145 |
|
5146 | |
5147 |
|
5148 |
|
5149 |
|
5150 |
|
5151 |
|
5152 | getStyle: function getStyle(dom, name) {
|
5153 | if (window.getComputedStyle) {
|
5154 | return window.getComputedStyle(dom, null)[name];
|
5155 | }
|
5156 | return dom.currentStyle[name];
|
5157 | },
|
5158 | modifyCSS: function modifyCSS(dom, css) {
|
5159 | for (var key in css) {
|
5160 | if (css.hasOwnProperty(key)) {
|
5161 | dom.style[key] = css[key];
|
5162 | }
|
5163 | }
|
5164 | return dom;
|
5165 | },
|
5166 |
|
5167 | |
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 | createDom: function createDom(str) {
|
5173 | var name = FRAGMENT_REG.test(str) && RegExp.$1;
|
5174 | if (!(name in CONTAINERS)) {
|
5175 | name = '*';
|
5176 | }
|
5177 | var container = CONTAINERS[name];
|
5178 | str = str.replace(/(^\s*)|(\s*$)/g, '');
|
5179 | container.innerHTML = '' + str;
|
5180 | return container.childNodes[0];
|
5181 | },
|
5182 | getRatio: function getRatio() {
|
5183 | return window.devicePixelRatio ? window.devicePixelRatio : 2;
|
5184 | },
|
5185 |
|
5186 | |
5187 |
|
5188 |
|
5189 |
|
5190 |
|
5191 | getWidth: function getWidth(el) {
|
5192 | var width = this.getStyle(el, 'width');
|
5193 | if (width === 'auto') {
|
5194 | width = el.offsetWidth;
|
5195 | }
|
5196 | return parseFloat(width);
|
5197 | },
|
5198 |
|
5199 | |
5200 |
|
5201 |
|
5202 |
|
5203 |
|
5204 | getHeight: function getHeight(el) {
|
5205 | var height = this.getStyle(el, 'height');
|
5206 | if (height === 'auto') {
|
5207 | height = el.offsetHeight;
|
5208 | }
|
5209 | return parseFloat(height);
|
5210 | },
|
5211 |
|
5212 | |
5213 |
|
5214 |
|
5215 |
|
5216 |
|
5217 | getOuterHeight: function getOuterHeight(el) {
|
5218 | var height = this.getHeight(el);
|
5219 | var bTop = parseFloat(this.getStyle(el, 'borderTopWidth')) || 0;
|
5220 | var pTop = parseFloat(this.getStyle(el, 'paddingTop'));
|
5221 | var pBottom = parseFloat(this.getStyle(el, 'paddingBottom'));
|
5222 | var bBottom = parseFloat(this.getStyle(el, 'borderBottomWidth')) || 0;
|
5223 | return height + bTop + bBottom + pTop + pBottom;
|
5224 | },
|
5225 |
|
5226 | |
5227 |
|
5228 |
|
5229 |
|
5230 |
|
5231 | getOuterWidth: function getOuterWidth(el) {
|
5232 | var width = this.getWidth(el);
|
5233 | var bLeft = parseFloat(this.getStyle(el, 'borderLeftWidth')) || 0;
|
5234 | var pLeft = parseFloat(this.getStyle(el, 'paddingLeft'));
|
5235 | var pRight = parseFloat(this.getStyle(el, 'paddingRight'));
|
5236 | var bRight = parseFloat(this.getStyle(el, 'borderRightWidth')) || 0;
|
5237 | return width + bLeft + bRight + pLeft + pRight;
|
5238 | },
|
5239 |
|
5240 | |
5241 |
|
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 |
|
5247 | addEventListener: function addEventListener(target, eventType, callback) {
|
5248 | if (target.addEventListener) {
|
5249 | target.addEventListener(eventType, callback, false);
|
5250 | return {
|
5251 | remove: function remove() {
|
5252 | target.removeEventListener(eventType, callback, false);
|
5253 | }
|
5254 | };
|
5255 | } else if (target.attachEvent) {
|
5256 | target.attachEvent('on' + eventType, callback);
|
5257 | return {
|
5258 | remove: function remove() {
|
5259 | target.detachEvent('on' + eventType, callback);
|
5260 | }
|
5261 | };
|
5262 | }
|
5263 | },
|
5264 | requestAnimationFrame: function requestAnimationFrame(fn) {
|
5265 | var method = window.requestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {
|
5266 | return setTimeout(fn, 16);
|
5267 | };
|
5268 |
|
5269 | return method(fn);
|
5270 | }
|
5271 | };
|
5272 |
|
5273 |
|
5274 | },
|
5275 |
|
5276 | function (module, exports, __webpack_require__) {
|
5277 |
|
5278 | var Util = __webpack_require__(0);
|
5279 |
|
5280 | var Event = function Event(type, event, bubbles, cancelable) {
|
5281 | this.type = type;
|
5282 | this.target = null;
|
5283 | this.currentTarget = null;
|
5284 | this.bubbles = bubbles;
|
5285 | this.cancelable = cancelable;
|
5286 | this.timeStamp = new Date().getTime();
|
5287 | this.defaultPrevented = false;
|
5288 | this.propagationStopped = false;
|
5289 | this.removed = false;
|
5290 | this.event = event;
|
5291 | };
|
5292 |
|
5293 | Util.augment(Event, {
|
5294 | preventDefault: function preventDefault() {
|
5295 | this.defaultPrevented = this.cancelable && true;
|
5296 | },
|
5297 | stopPropagation: function stopPropagation() {
|
5298 | this.propagationStopped = true;
|
5299 | },
|
5300 | remove: function remove() {
|
5301 | this.remove = true;
|
5302 | },
|
5303 | clone: function clone() {
|
5304 | return Util.clone(this);
|
5305 | },
|
5306 | toString: function toString() {
|
5307 | return '[Event (type=' + this.type + ')]';
|
5308 | }
|
5309 | });
|
5310 |
|
5311 | module.exports = Event;
|
5312 |
|
5313 |
|
5314 | },
|
5315 |
|
5316 | function (module, exports, __webpack_require__) {
|
5317 |
|
5318 | var Util = __webpack_require__(0);
|
5319 | var Element = __webpack_require__(88);
|
5320 | var Shape = __webpack_require__(262);
|
5321 | var SHAPE_MAP = {};
|
5322 | var INDEX = '_INDEX';
|
5323 |
|
5324 | function find(children, x, y) {
|
5325 | var rst = void 0;
|
5326 | for (var i = children.length - 1; i >= 0; i--) {
|
5327 | var child = children[i];
|
5328 | if (child.__cfg.visible && child.__cfg.capture) {
|
5329 | if (child.isGroup) {
|
5330 | rst = child.getShape(x, y);
|
5331 | } else if (child.isHit(x, y)) {
|
5332 | rst = child;
|
5333 | }
|
5334 | }
|
5335 | if (rst) {
|
5336 | break;
|
5337 | }
|
5338 | }
|
5339 | return rst;
|
5340 | }
|
5341 |
|
5342 | function getComparer(compare) {
|
5343 | return function (left, right) {
|
5344 | var result = compare(left, right);
|
5345 | return result === 0 ? left[INDEX] - right[INDEX] : result;
|
5346 | };
|
5347 | }
|
5348 |
|
5349 | var Group = function Group(cfg) {
|
5350 | Group.superclass.constructor.call(this, cfg);
|
5351 | this.set('children', []);
|
5352 |
|
5353 | this._beforeRenderUI();
|
5354 | this._renderUI();
|
5355 | this._bindUI();
|
5356 | };
|
5357 |
|
5358 | function initClassCfgs(c) {
|
5359 | if (c.__cfg || c === Group) {
|
5360 | return;
|
5361 | }
|
5362 | var superCon = c.superclass.constructor;
|
5363 | if (superCon && !superCon.__cfg) {
|
5364 | initClassCfgs(superCon);
|
5365 | }
|
5366 | c.__cfg = {};
|
5367 |
|
5368 | Util.merge(c.__cfg, superCon.__cfg);
|
5369 | Util.merge(c.__cfg, c.CFG);
|
5370 | }
|
5371 |
|
5372 | Util.extend(Group, Element);
|
5373 |
|
5374 | Util.augment(Group, {
|
5375 | isGroup: true,
|
5376 | canFill: true,
|
5377 | canStroke: true,
|
5378 | getDefaultCfg: function getDefaultCfg() {
|
5379 | initClassCfgs(this.constructor);
|
5380 | return Util.merge({}, this.constructor.__cfg);
|
5381 | },
|
5382 | _beforeRenderUI: function _beforeRenderUI() {},
|
5383 | _renderUI: function _renderUI() {},
|
5384 | _bindUI: function _bindUI() {},
|
5385 | addShape: function addShape(type, cfg) {
|
5386 | var canvas = this.get('canvas');
|
5387 | cfg = cfg || {};
|
5388 | var shapeType = SHAPE_MAP[type];
|
5389 | if (!shapeType) {
|
5390 | shapeType = Util.upperFirst(type);
|
5391 | SHAPE_MAP[type] = shapeType;
|
5392 | }
|
5393 | if (cfg.attrs) {
|
5394 | var attrs = cfg.attrs;
|
5395 | if (type === 'text') {
|
5396 |
|
5397 | var topFontFamily = canvas.get('fontFamily');
|
5398 | if (topFontFamily) {
|
5399 | attrs.fontFamily = attrs.fontFamily ? attrs.fontFamily : topFontFamily;
|
5400 | }
|
5401 | }
|
5402 | }
|
5403 | cfg.canvas = canvas;
|
5404 | cfg.type = type;
|
5405 | var rst = new Shape[shapeType](cfg);
|
5406 | this.add(rst);
|
5407 | return rst;
|
5408 | },
|
5409 |
|
5410 | |
5411 |
|
5412 |
|
5413 |
|
5414 |
|
5415 | addGroup: function addGroup(param, cfg) {
|
5416 | var canvas = this.get('canvas');
|
5417 | var rst = void 0;
|
5418 | cfg = Util.merge({}, cfg);
|
5419 | if (Util.isFunction(param)) {
|
5420 | if (cfg) {
|
5421 | cfg.canvas = canvas;
|
5422 | cfg.parent = this;
|
5423 | rst = new param(cfg);
|
5424 | } else {
|
5425 | rst = new param({
|
5426 | canvas: canvas,
|
5427 | parent: this
|
5428 | });
|
5429 | }
|
5430 | this.add(rst);
|
5431 | } else if (Util.isObject(param)) {
|
5432 | param.canvas = canvas;
|
5433 | rst = new Group(param);
|
5434 | this.add(rst);
|
5435 | } else if (param === undefined) {
|
5436 | rst = new Group();
|
5437 | this.add(rst);
|
5438 | } else {
|
5439 | return false;
|
5440 | }
|
5441 | return rst;
|
5442 | },
|
5443 |
|
5444 | |
5445 |
|
5446 |
|
5447 |
|
5448 |
|
5449 |
|
5450 | renderBack: function renderBack(padding, attrs) {
|
5451 | var backShape = this.get('backShape');
|
5452 | var innerBox = this.getBBox();
|
5453 |
|
5454 | Util.merge(attrs, {
|
5455 | x: innerBox.minX - padding[3],
|
5456 | y: innerBox.minY - padding[0],
|
5457 | width: innerBox.width + padding[1] + padding[3],
|
5458 | height: innerBox.height + padding[0] + padding[2]
|
5459 | });
|
5460 | if (backShape) {
|
5461 | backShape.attr(attrs);
|
5462 | } else {
|
5463 | backShape = this.addShape('rect', {
|
5464 | zIndex: -1,
|
5465 | attrs: attrs
|
5466 | });
|
5467 | }
|
5468 | this.set('backShape', backShape);
|
5469 | this.sort();
|
5470 | return backShape;
|
5471 | },
|
5472 | removeChild: function removeChild(item, destroy) {
|
5473 | if (arguments.length >= 2) {
|
5474 | if (this.contain(item)) {
|
5475 | item.remove(destroy);
|
5476 | }
|
5477 | } else {
|
5478 | if (arguments.length === 1) {
|
5479 | if (Util.isBoolean(item)) {
|
5480 | destroy = item;
|
5481 | } else {
|
5482 | if (this.contain(item)) {
|
5483 | item.remove(true);
|
5484 | }
|
5485 | return this;
|
5486 | }
|
5487 | }
|
5488 | if (arguments.length === 0) {
|
5489 | destroy = true;
|
5490 | }
|
5491 |
|
5492 | Group.superclass.remove.call(this, destroy);
|
5493 | }
|
5494 | return this;
|
5495 | },
|
5496 |
|
5497 | |
5498 |
|
5499 |
|
5500 |
|
5501 |
|
5502 | add: function add(items) {
|
5503 | var self = this;
|
5504 | var children = self.get('children');
|
5505 | if (Util.isArray(items)) {
|
5506 | Util.each(items, function (item) {
|
5507 | var parent = item.get('parent');
|
5508 | if (parent) {
|
5509 | parent.removeChild(item, false);
|
5510 | }
|
5511 | self.__setEvn(item);
|
5512 | });
|
5513 | children.push.apply(children, items);
|
5514 | } else {
|
5515 | var item = items;
|
5516 | var parent = item.get('parent');
|
5517 | if (parent) {
|
5518 | parent.removeChild(item, false);
|
5519 | }
|
5520 | self.__setEvn(item);
|
5521 | children.push(item);
|
5522 | }
|
5523 | return self;
|
5524 | },
|
5525 | contain: function contain(item) {
|
5526 | var children = this.get('children');
|
5527 | return children.indexOf(item) > -1;
|
5528 | },
|
5529 | getChildByIndex: function getChildByIndex(index) {
|
5530 | var children = this.get('children');
|
5531 | return children[index];
|
5532 | },
|
5533 | getFirst: function getFirst() {
|
5534 | return this.getChildByIndex(0);
|
5535 | },
|
5536 | getLast: function getLast() {
|
5537 | var lastIndex = this.get('children').length - 1;
|
5538 | return this.getChildByIndex(lastIndex);
|
5539 | },
|
5540 | __setEvn: function __setEvn(item) {
|
5541 | var self = this;
|
5542 | item.__cfg.parent = self;
|
5543 | item.__cfg.context = self.__cfg.context;
|
5544 | item.__cfg.canvas = self.__cfg.canvas;
|
5545 | var clip = item.__attrs.clip;
|
5546 | if (clip) {
|
5547 | clip.setSilent('parent', self);
|
5548 | clip.setSilent('context', self.get('context'));
|
5549 | }
|
5550 | var children = item.__cfg.children;
|
5551 | if (children) {
|
5552 | Util.each(children, function (child) {
|
5553 | item.__setEvn(child);
|
5554 | });
|
5555 | }
|
5556 | },
|
5557 | getBBox: function getBBox() {
|
5558 | var self = this;
|
5559 | var minX = Infinity;
|
5560 | var maxX = -Infinity;
|
5561 | var minY = Infinity;
|
5562 | var maxY = -Infinity;
|
5563 | var children = self.get('children');
|
5564 | Util.each(children, function (child) {
|
5565 | if (child.get('visible')) {
|
5566 | var _box = child.getBBox();
|
5567 | if (!_box) {
|
5568 | return true;
|
5569 | }
|
5570 |
|
5571 | var leftTop = [_box.minX, _box.minY, 1];
|
5572 | var leftBottom = [_box.minX, _box.maxY, 1];
|
5573 | var rightTop = [_box.maxX, _box.minY, 1];
|
5574 | var rightBottom = [_box.maxX, _box.maxY, 1];
|
5575 |
|
5576 | child.apply(leftTop);
|
5577 | child.apply(leftBottom);
|
5578 | child.apply(rightTop);
|
5579 | child.apply(rightBottom);
|
5580 |
|
5581 | var boxMinX = Math.min(leftTop[0], leftBottom[0], rightTop[0], rightBottom[0]);
|
5582 | var boxMaxX = Math.max(leftTop[0], leftBottom[0], rightTop[0], rightBottom[0]);
|
5583 | var boxMinY = Math.min(leftTop[1], leftBottom[1], rightTop[1], rightBottom[1]);
|
5584 | var boxMaxY = Math.max(leftTop[1], leftBottom[1], rightTop[1], rightBottom[1]);
|
5585 |
|
5586 | if (boxMinX < minX) {
|
5587 | minX = boxMinX;
|
5588 | }
|
5589 |
|
5590 | if (boxMaxX > maxX) {
|
5591 | maxX = boxMaxX;
|
5592 | }
|
5593 |
|
5594 | if (boxMinY < minY) {
|
5595 | minY = boxMinY;
|
5596 | }
|
5597 |
|
5598 | if (boxMaxY > maxY) {
|
5599 | maxY = boxMaxY;
|
5600 | }
|
5601 | }
|
5602 | });
|
5603 | var box = {
|
5604 | minX: minX,
|
5605 | minY: minY,
|
5606 | maxX: maxX,
|
5607 | maxY: maxY
|
5608 | };
|
5609 | box.x = box.minX;
|
5610 | box.y = box.minY;
|
5611 | box.width = box.maxX - box.minX;
|
5612 | box.height = box.maxY - box.minY;
|
5613 | return box;
|
5614 | },
|
5615 | drawInner: function drawInner(context) {
|
5616 | var children = this.get('children');
|
5617 | for (var i = 0; i < children.length; i++) {
|
5618 | var child = children[i];
|
5619 | child.draw(context);
|
5620 | }
|
5621 | return this;
|
5622 | },
|
5623 | getCount: function getCount() {
|
5624 | return this.get('children').length;
|
5625 | },
|
5626 | sort: function sort() {
|
5627 | var children = this.get('children');
|
5628 |
|
5629 | Util.each(children, function (child, index) {
|
5630 | child[INDEX] = index;
|
5631 | return child;
|
5632 | });
|
5633 |
|
5634 | children.sort(getComparer(function (obj1, obj2) {
|
5635 | return obj1.get('zIndex') - obj2.get('zIndex');
|
5636 | }));
|
5637 |
|
5638 | return this;
|
5639 | },
|
5640 | find: function find(id) {
|
5641 | return this.findBy(function (item) {
|
5642 | return item.get('id') === id;
|
5643 | });
|
5644 | },
|
5645 |
|
5646 | |
5647 |
|
5648 |
|
5649 |
|
5650 |
|
5651 | findBy: function findBy(fn) {
|
5652 | var children = this.get('children');
|
5653 | var rst = null;
|
5654 |
|
5655 | Util.each(children, function (item) {
|
5656 | if (fn(item)) {
|
5657 | rst = item;
|
5658 | } else if (item.findBy) {
|
5659 | rst = item.findBy(fn);
|
5660 | }
|
5661 | if (rst) {
|
5662 | return false;
|
5663 | }
|
5664 | });
|
5665 | return rst;
|
5666 | },
|
5667 | findAllBy: function findAllBy(fn) {
|
5668 | var children = this.get('children');
|
5669 | var rst = [];
|
5670 | var childRst = [];
|
5671 | Util.each(children, function (item) {
|
5672 | if (fn(item)) {
|
5673 | rst.push(item);
|
5674 | }
|
5675 | if (item.findAllBy) {
|
5676 | childRst = item.findAllBy(fn);
|
5677 | rst = rst.concat(childRst);
|
5678 | }
|
5679 | });
|
5680 | return rst;
|
5681 | },
|
5682 |
|
5683 | |
5684 |
|
5685 |
|
5686 |
|
5687 |
|
5688 |
|
5689 | getShape: function getShape(x, y) {
|
5690 | var self = this;
|
5691 | var clip = self.__attrs.clip;
|
5692 | var children = self.__cfg.children;
|
5693 | var rst = void 0;
|
5694 | if (clip) {
|
5695 | if (clip.inside(x, y)) {
|
5696 | rst = find(children, x, y);
|
5697 | }
|
5698 | } else {
|
5699 | rst = find(children, x, y);
|
5700 | }
|
5701 | return rst;
|
5702 | },
|
5703 | clearTotalMatrix: function clearTotalMatrix() {
|
5704 | var m = this.get('totalMatrix');
|
5705 | if (m) {
|
5706 | this.setSilent('totalMatrix', null);
|
5707 | var children = this.__cfg.children;
|
5708 | for (var i = 0; i < children.length; i++) {
|
5709 | var child = children[i];
|
5710 | child.clearTotalMatrix();
|
5711 | }
|
5712 | }
|
5713 | },
|
5714 | clear: function clear() {
|
5715 | var children = this.get('children');
|
5716 |
|
5717 | while (children.length !== 0) {
|
5718 | children[children.length - 1].remove();
|
5719 | }
|
5720 | return this;
|
5721 | },
|
5722 | destroy: function destroy() {
|
5723 | if (this.get('destroyed')) {
|
5724 | return;
|
5725 | }
|
5726 | this.clear();
|
5727 | Group.superclass.destroy.call(this);
|
5728 | }
|
5729 | });
|
5730 |
|
5731 | module.exports = Group;
|
5732 |
|
5733 |
|
5734 | },
|
5735 |
|
5736 | function (module, exports, __webpack_require__) {
|
5737 |
|
5738 | var Util = __webpack_require__(0);
|
5739 | var Attribute = __webpack_require__(228);
|
5740 | var Transform = __webpack_require__(229);
|
5741 | var Animate = __webpack_require__(233);
|
5742 | var Format = __webpack_require__(97);
|
5743 | var EventEmitter = __webpack_require__(261);
|
5744 |
|
5745 | var SHAPE_ATTRS = ['fillStyle', 'font', 'globalAlpha', 'lineCap', 'lineWidth', 'lineJoin', 'miterLimit', 'shadowBlur', 'shadowColor', 'shadowOffsetX', 'shadowOffsetY', 'strokeStyle', 'textAlign', 'textBaseline', 'lineDash'];
|
5746 |
|
5747 | var Element = function Element(cfg) {
|
5748 | this.__cfg = {
|
5749 | zIndex: 0,
|
5750 | capture: true,
|
5751 | visible: true,
|
5752 | destroyed: false
|
5753 | };
|
5754 |
|
5755 | Util.assign(this.__cfg, this.getDefaultCfg(), cfg);
|
5756 | this.initAttrs(this.__cfg.attrs);
|
5757 | this.initTransform();
|
5758 | this.init();
|
5759 | };
|
5760 |
|
5761 | Element.CFG = {
|
5762 | |
5763 |
|
5764 |
|
5765 |
|
5766 | id: null,
|
5767 | |
5768 |
|
5769 |
|
5770 |
|
5771 | zIndex: 0,
|
5772 | |
5773 |
|
5774 |
|
5775 |
|
5776 | canvas: null,
|
5777 | |
5778 |
|
5779 |
|
5780 |
|
5781 | parent: null,
|
5782 | |
5783 |
|
5784 |
|
5785 |
|
5786 |
|
5787 |
|
5788 |
|
5789 |
|
5790 | capture: true,
|
5791 | |
5792 |
|
5793 |
|
5794 |
|
5795 | context: null,
|
5796 | |
5797 |
|
5798 |
|
5799 |
|
5800 | visible: true,
|
5801 | |
5802 |
|
5803 |
|
5804 |
|
5805 | destroyed: false
|
5806 | };
|
5807 |
|
5808 | Util.augment(Element, Attribute, Transform, EventEmitter, Animate, {
|
5809 | init: function init() {
|
5810 | this.setSilent('animable', true);
|
5811 | this.setSilent('animating', false);
|
5812 | var attrs = this.__attrs;
|
5813 | if (attrs && attrs.rotate) {
|
5814 | this.rotateAtStart(attrs.rotate);
|
5815 | }
|
5816 | },
|
5817 | getParent: function getParent() {
|
5818 | return this.get('parent');
|
5819 | },
|
5820 |
|
5821 | |
5822 |
|
5823 |
|
5824 |
|
5825 |
|
5826 | getDefaultCfg: function getDefaultCfg() {
|
5827 | return {};
|
5828 | },
|
5829 | set: function set(name, value) {
|
5830 | var m = '__set' + Util.upperFirst(name);
|
5831 |
|
5832 | if (this[m]) {
|
5833 | value = this[m](value);
|
5834 | }
|
5835 | this.__cfg[name] = value;
|
5836 | return this;
|
5837 | },
|
5838 | setSilent: function setSilent(name, value) {
|
5839 | this.__cfg[name] = value;
|
5840 | },
|
5841 | get: function get(name) {
|
5842 | return this.__cfg[name];
|
5843 | },
|
5844 | draw: function draw(context) {
|
5845 | if (this.get('destroyed')) {
|
5846 | return;
|
5847 | }
|
5848 | if (this.get('visible')) {
|
5849 | this.setContext(context);
|
5850 | this.drawInner(context);
|
5851 | this.restoreContext(context);
|
5852 | }
|
5853 | },
|
5854 | setContext: function setContext(context) {
|
5855 | var clip = this.__attrs.clip;
|
5856 | context.save();
|
5857 | if (clip) {
|
5858 |
|
5859 | clip.resetTransform(context);
|
5860 | clip.createPath(context);
|
5861 | context.clip();
|
5862 |
|
5863 | }
|
5864 | this.resetContext(context);
|
5865 | this.resetTransform(context);
|
5866 | },
|
5867 | restoreContext: function restoreContext(context) {
|
5868 | context.restore();
|
5869 | },
|
5870 | resetContext: function resetContext(context) {
|
5871 | var elAttrs = this.__attrs;
|
5872 |
|
5873 | if (!this.isGroup) {
|
5874 |
|
5875 | for (var k in elAttrs) {
|
5876 | if (SHAPE_ATTRS.indexOf(k) > -1) {
|
5877 |
|
5878 | var v = elAttrs[k];
|
5879 | if (k === 'fillStyle') {
|
5880 | v = Format.parseStyle(v, this);
|
5881 | }
|
5882 | if (k === 'strokeStyle') {
|
5883 | v = Format.parseStyle(v, this);
|
5884 | }
|
5885 | if (k === 'lineDash' && context.setLineDash) {
|
5886 | if (Util.isArray(v)) {
|
5887 | context.setLineDash(v);
|
5888 | } else if (Util.isString(v)) {
|
5889 | context.setLineDash(v.split(' '));
|
5890 | }
|
5891 | } else {
|
5892 | context[k] = v;
|
5893 | }
|
5894 | }
|
5895 | }
|
5896 | }
|
5897 | },
|
5898 | drawInner: function drawInner() /* context */{},
|
5899 | show: function show() {
|
5900 | this.set('visible', true);
|
5901 | return this;
|
5902 | },
|
5903 | hide: function hide() {
|
5904 | this.set('visible', false);
|
5905 | return this;
|
5906 | },
|
5907 | remove: function remove(destroy) {
|
5908 | if (destroy === undefined) {
|
5909 | destroy = true;
|
5910 | }
|
5911 |
|
5912 | if (this.get('parent')) {
|
5913 | var parent = this.get('parent');
|
5914 | var children = parent.get('children');
|
5915 | Util.remove(children, this);
|
5916 | }
|
5917 |
|
5918 | if (destroy) {
|
5919 | this.destroy();
|
5920 | }
|
5921 |
|
5922 | return this;
|
5923 | },
|
5924 | destroy: function destroy() {
|
5925 | var destroyed = this.get('destroyed');
|
5926 |
|
5927 | if (destroyed) {
|
5928 | return;
|
5929 | }
|
5930 | this.__cfg = {};
|
5931 | this.__attrs = null;
|
5932 | this.removeEvent();
|
5933 | this.set('destroyed', true);
|
5934 | },
|
5935 | __setZIndex: function __setZIndex(zIndex) {
|
5936 | this.__cfg.zIndex = zIndex;
|
5937 |
|
5938 | if (!Util.isNil(this.get('parent'))) {
|
5939 | this.get('parent').sort();
|
5940 | }
|
5941 | return zIndex;
|
5942 | },
|
5943 | __setAttrs: function __setAttrs(attrs) {
|
5944 | this.attr(attrs);
|
5945 | return attrs;
|
5946 | },
|
5947 | setZIndex: function setZIndex(zIndex) {
|
5948 | this.__cfg.zIndex = zIndex;
|
5949 | return zIndex;
|
5950 | },
|
5951 | clone: function clone() {
|
5952 | return Util.clone(this);
|
5953 | },
|
5954 | getBBox: function getBBox() {
|
5955 | return {
|
5956 | minX: 0,
|
5957 | maxX: 0,
|
5958 | minY: 0,
|
5959 | maxY: 0
|
5960 | };
|
5961 | }
|
5962 | });
|
5963 |
|
5964 | module.exports = Element;
|
5965 |
|
5966 |
|
5967 | },
|
5968 |
|
5969 | function (module, __webpack_exports__, __webpack_require__) {
|
5970 |
|
5971 | "use strict";
|
5972 |
|
5973 | __webpack_require__.d(__webpack_exports__, "a", function () {
|
5974 | return deg2rad;
|
5975 | });
|
5976 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
5977 | return rad2deg;
|
5978 | });
|
5979 | var deg2rad = Math.PI / 180;
|
5980 | var rad2deg = 180 / Math.PI;
|
5981 |
|
5982 |
|
5983 | },
|
5984 |
|
5985 | function (module, __webpack_exports__, __webpack_require__) {
|
5986 |
|
5987 | "use strict";
|
5988 |
|
5989 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
5990 | return rgbBasis;
|
5991 | });
|
5992 | __webpack_require__.d(__webpack_exports__, "c", function () {
|
5993 | return rgbBasisClosed;
|
5994 | });
|
5995 | var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
|
5996 | var __WEBPACK_IMPORTED_MODULE_1__basis__ = __webpack_require__(51);
|
5997 | var __WEBPACK_IMPORTED_MODULE_2__basisClosed__ = __webpack_require__(91);
|
5998 | var __WEBPACK_IMPORTED_MODULE_3__color__ = __webpack_require__(19);
|
5999 |
|
6000 | __webpack_exports__["a"] = function rgbGamma(y) {
|
6001 | var color = Object(__WEBPACK_IMPORTED_MODULE_3__color__["b" ])(y);
|
6002 |
|
6003 | function rgb(start, end) {
|
6004 | var r = color((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["f" ])(start)).r, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["f" ])(end)).r),
|
6005 | g = color(start.g, end.g),
|
6006 | b = color(start.b, end.b),
|
6007 | opacity = Object(__WEBPACK_IMPORTED_MODULE_3__color__["a" ])(start.opacity, end.opacity);
|
6008 | return function (t) {
|
6009 | start.r = r(t);
|
6010 | start.g = g(t);
|
6011 | start.b = b(t);
|
6012 | start.opacity = opacity(t);
|
6013 | return start + "";
|
6014 | };
|
6015 | }
|
6016 |
|
6017 | rgb.gamma = rgbGamma;
|
6018 |
|
6019 | return rgb;
|
6020 | }(1);
|
6021 |
|
6022 | function rgbSpline(spline) {
|
6023 | return function (colors) {
|
6024 | var n = colors.length,
|
6025 | r = new Array(n),
|
6026 | g = new Array(n),
|
6027 | b = new Array(n),
|
6028 | i,
|
6029 | color;
|
6030 | for (i = 0; i < n; ++i) {
|
6031 | color = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["f" ])(colors[i]);
|
6032 | r[i] = color.r || 0;
|
6033 | g[i] = color.g || 0;
|
6034 | b[i] = color.b || 0;
|
6035 | }
|
6036 | r = spline(r);
|
6037 | g = spline(g);
|
6038 | b = spline(b);
|
6039 | color.opacity = 1;
|
6040 | return function (t) {
|
6041 | color.r = r(t);
|
6042 | color.g = g(t);
|
6043 | color.b = b(t);
|
6044 | return color + "";
|
6045 | };
|
6046 | };
|
6047 | }
|
6048 |
|
6049 | var rgbBasis = rgbSpline(__WEBPACK_IMPORTED_MODULE_1__basis__["b" ]);
|
6050 | var rgbBasisClosed = rgbSpline(__WEBPACK_IMPORTED_MODULE_2__basisClosed__["a" ]);
|
6051 |
|
6052 |
|
6053 | },
|
6054 |
|
6055 | function (module, __webpack_exports__, __webpack_require__) {
|
6056 |
|
6057 | "use strict";
|
6058 |
|
6059 | var __WEBPACK_IMPORTED_MODULE_0__basis__ = __webpack_require__(51);
|
6060 |
|
6061 | __webpack_exports__["a"] = function (values) {
|
6062 | var n = values.length;
|
6063 | return function (t) {
|
6064 | var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
|
6065 | v0 = values[(i + n - 1) % n],
|
6066 | v1 = values[i % n],
|
6067 | v2 = values[(i + 1) % n],
|
6068 | v3 = values[(i + 2) % n];
|
6069 | return Object(__WEBPACK_IMPORTED_MODULE_0__basis__["a" ])((t - i / n) * n, v0, v1, v2, v3);
|
6070 | };
|
6071 | };
|
6072 |
|
6073 |
|
6074 | },
|
6075 |
|
6076 | function (module, __webpack_exports__, __webpack_require__) {
|
6077 |
|
6078 | "use strict";
|
6079 |
|
6080 | __webpack_exports__["a"] = function (x) {
|
6081 | return function () {
|
6082 | return x;
|
6083 | };
|
6084 | };
|
6085 |
|
6086 |
|
6087 | },
|
6088 |
|
6089 | function (module, __webpack_exports__, __webpack_require__) {
|
6090 |
|
6091 | "use strict";
|
6092 |
|
6093 | var __WEBPACK_IMPORTED_MODULE_0__value__ = __webpack_require__(48);
|
6094 |
|
6095 | __webpack_exports__["a"] = function (a, b) {
|
6096 | var nb = b ? b.length : 0,
|
6097 | na = a ? Math.min(nb, a.length) : 0,
|
6098 | x = new Array(na),
|
6099 | c = new Array(nb),
|
6100 | i;
|
6101 |
|
6102 | for (i = 0; i < na; ++i) {
|
6103 | x[i] = Object(__WEBPACK_IMPORTED_MODULE_0__value__["a" ])(a[i], b[i]);
|
6104 | }for (; i < nb; ++i) {
|
6105 | c[i] = b[i];
|
6106 | }return function (t) {
|
6107 | for (i = 0; i < na; ++i) {
|
6108 | c[i] = x[i](t);
|
6109 | }return c;
|
6110 | };
|
6111 | };
|
6112 |
|
6113 |
|
6114 | },
|
6115 |
|
6116 | function (module, __webpack_exports__, __webpack_require__) {
|
6117 |
|
6118 | "use strict";
|
6119 |
|
6120 | __webpack_exports__["a"] = function (a, b) {
|
6121 | var d = new Date();
|
6122 | return a = +a, b -= a, function (t) {
|
6123 | return d.setTime(a + b * t), d;
|
6124 | };
|
6125 | };
|
6126 |
|
6127 |
|
6128 | },
|
6129 |
|
6130 | function (module, __webpack_exports__, __webpack_require__) {
|
6131 |
|
6132 | "use strict";
|
6133 |
|
6134 | var __WEBPACK_IMPORTED_MODULE_0__value__ = __webpack_require__(48);
|
6135 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
6136 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
6137 | } : function (obj) {
|
6138 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
6139 | };
|
6140 |
|
6141 | __webpack_exports__["a"] = function (a, b) {
|
6142 | var i = {},
|
6143 | c = {},
|
6144 | k;
|
6145 |
|
6146 | if (a === null || (typeof a === "undefined" ? "undefined" : _typeof(a)) !== "object") a = {};
|
6147 | if (b === null || (typeof b === "undefined" ? "undefined" : _typeof(b)) !== "object") b = {};
|
6148 |
|
6149 | for (k in b) {
|
6150 | if (k in a) {
|
6151 | i[k] = Object(__WEBPACK_IMPORTED_MODULE_0__value__["a" ])(a[k], b[k]);
|
6152 | } else {
|
6153 | c[k] = b[k];
|
6154 | }
|
6155 | }
|
6156 |
|
6157 | return function (t) {
|
6158 | for (k in i) {
|
6159 | c[k] = i[k](t);
|
6160 | }return c;
|
6161 | };
|
6162 | };
|
6163 |
|
6164 |
|
6165 | },
|
6166 |
|
6167 | function (module, __webpack_exports__, __webpack_require__) {
|
6168 |
|
6169 | "use strict";
|
6170 |
|
6171 | var __WEBPACK_IMPORTED_MODULE_0__number__ = __webpack_require__(29);
|
6172 |
|
6173 | var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
|
6174 | reB = new RegExp(reA.source, "g");
|
6175 |
|
6176 | function zero(b) {
|
6177 | return function () {
|
6178 | return b;
|
6179 | };
|
6180 | }
|
6181 |
|
6182 | function one(b) {
|
6183 | return function (t) {
|
6184 | return b(t) + "";
|
6185 | };
|
6186 | }
|
6187 |
|
6188 | __webpack_exports__["a"] = function (a, b) {
|
6189 | var bi = reA.lastIndex = reB.lastIndex = 0,
|
6190 |
|
6191 |
|
6192 | am,
|
6193 |
|
6194 |
|
6195 | bm,
|
6196 |
|
6197 |
|
6198 | bs,
|
6199 |
|
6200 |
|
6201 | i = -1,
|
6202 |
|
6203 |
|
6204 | s = [],
|
6205 |
|
6206 |
|
6207 | q = [];
|
6208 |
|
6209 |
|
6210 | a = a + "", b = b + "";
|
6211 |
|
6212 |
|
6213 | while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
|
6214 | if ((bs = bm.index) > bi) {
|
6215 |
|
6216 | bs = b.slice(bi, bs);
|
6217 | if (s[i]) s[i] += bs;
|
6218 | else s[++i] = bs;
|
6219 | }
|
6220 | if ((am = am[0]) === (bm = bm[0])) {
|
6221 |
|
6222 | if (s[i]) s[i] += bm;
|
6223 | else s[++i] = bm;
|
6224 | } else {
|
6225 |
|
6226 | s[++i] = null;
|
6227 | q.push({ i: i, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" ])(am, bm) });
|
6228 | }
|
6229 | bi = reB.lastIndex;
|
6230 | }
|
6231 |
|
6232 |
|
6233 | if (bi < b.length) {
|
6234 | bs = b.slice(bi);
|
6235 | if (s[i]) s[i] += bs;
|
6236 | else s[++i] = bs;
|
6237 | }
|
6238 |
|
6239 |
|
6240 |
|
6241 | return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function (t) {
|
6242 | for (var i = 0, o; i < b; ++i) {
|
6243 | s[(o = q[i]).i] = o.x(t);
|
6244 | }return s.join("");
|
6245 | });
|
6246 | };
|
6247 |
|
6248 |
|
6249 | },
|
6250 |
|
6251 | function (module, exports, __webpack_require__) {
|
6252 |
|
6253 | var Util = __webpack_require__(0);
|
6254 |
|
6255 | var regexTags = /[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig;
|
6256 | var regexDot = /[^\s\,]+/ig;
|
6257 | var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
|
6258 | var regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;
|
6259 | var regexPR = /^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;
|
6260 | var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/ig;
|
6261 | var numColorCache = {};
|
6262 |
|
6263 | function addStop(steps, gradient) {
|
6264 | var arr = steps.match(regexColorStop);
|
6265 | Util.each(arr, function (item) {
|
6266 | item = item.split(':');
|
6267 | gradient.addColorStop(item[0], item[1]);
|
6268 | });
|
6269 | }
|
6270 |
|
6271 | function parseLineGradient(color, self) {
|
6272 | var arr = regexLG.exec(color);
|
6273 | var angle = Util.mod(Util.toRadian(parseFloat(arr[1])), Math.PI * 2);
|
6274 | var steps = arr[2];
|
6275 | var box = self.getBBox();
|
6276 | var start = void 0;
|
6277 | var end = void 0;
|
6278 |
|
6279 | if (angle >= 0 && angle < 0.5 * Math.PI) {
|
6280 | start = {
|
6281 | x: box.minX,
|
6282 | y: box.minY
|
6283 | };
|
6284 | end = {
|
6285 | x: box.maxX,
|
6286 | y: box.maxY
|
6287 | };
|
6288 | } else if (0.5 * Math.PI <= angle && angle < Math.PI) {
|
6289 | start = {
|
6290 | x: box.maxX,
|
6291 | y: box.minY
|
6292 | };
|
6293 | end = {
|
6294 | x: box.minX,
|
6295 | y: box.maxY
|
6296 | };
|
6297 | } else if (Math.PI <= angle && angle < 1.5 * Math.PI) {
|
6298 | start = {
|
6299 | x: box.maxX,
|
6300 | y: box.maxY
|
6301 | };
|
6302 | end = {
|
6303 | x: box.minX,
|
6304 | y: box.minY
|
6305 | };
|
6306 | } else {
|
6307 | start = {
|
6308 | x: box.minX,
|
6309 | y: box.maxY
|
6310 | };
|
6311 | end = {
|
6312 | x: box.maxX,
|
6313 | y: box.minY
|
6314 | };
|
6315 | }
|
6316 |
|
6317 | var tanTheta = Math.tan(angle);
|
6318 | var tanTheta2 = tanTheta * tanTheta;
|
6319 |
|
6320 | var x = (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.x;
|
6321 | var y = tanTheta * (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.y;
|
6322 | var context = self.get('context');
|
6323 | var gradient = context.createLinearGradient(start.x, start.y, x, y);
|
6324 | addStop(steps, gradient);
|
6325 | return gradient;
|
6326 | }
|
6327 |
|
6328 | function parseRadialGradient(color, self) {
|
6329 | var arr = regexRG.exec(color);
|
6330 | var fx = parseFloat(arr[1]);
|
6331 | var fy = parseFloat(arr[2]);
|
6332 | var fr = parseFloat(arr[3]);
|
6333 | var steps = arr[4];
|
6334 | var box = self.getBBox();
|
6335 | var context = self.get('context');
|
6336 | var width = box.maxX - box.minX;
|
6337 | var height = box.maxY - box.minY;
|
6338 | var r = Math.sqrt(width * width + height * height) / 2;
|
6339 | var gradient = context.createRadialGradient(box.minX + width * fx, box.minY + height * fy, fr * r, box.minX + width / 2, box.minY + height / 2, r);
|
6340 | addStop(steps, gradient);
|
6341 | return gradient;
|
6342 | }
|
6343 |
|
6344 | function parsePattern(color, self) {
|
6345 | if (self.get('patternSource') && self.get('patternSource') === color) {
|
6346 | return self.get('pattern');
|
6347 | }
|
6348 | var pattern = void 0;
|
6349 | var img = void 0;
|
6350 | var arr = regexPR.exec(color);
|
6351 | var repeat = arr[1];
|
6352 | var source = arr[2];
|
6353 |
|
6354 |
|
6355 | function onload() {
|
6356 |
|
6357 | var context = self.get('context');
|
6358 | pattern = context.createPattern(img, repeat);
|
6359 | self.setSilent('pattern', pattern);
|
6360 | self.setSilent('patternSource', color);
|
6361 | }
|
6362 |
|
6363 | switch (repeat) {
|
6364 | case 'a':
|
6365 | repeat = 'repeat';
|
6366 | break;
|
6367 | case 'x':
|
6368 | repeat = 'repeat-x';
|
6369 | break;
|
6370 | case 'y':
|
6371 | repeat = 'repeat-y';
|
6372 | break;
|
6373 | case 'n':
|
6374 | repeat = 'no-repeat';
|
6375 | break;
|
6376 | default:
|
6377 | repeat = 'no-repeat';
|
6378 | }
|
6379 |
|
6380 | img = new Image();
|
6381 |
|
6382 | if (!source.match(/^data:/i)) {
|
6383 |
|
6384 | img.crossOrigin = 'Anonymous';
|
6385 | }
|
6386 | img.src = source;
|
6387 |
|
6388 | if (img.complete) {
|
6389 | onload();
|
6390 | } else {
|
6391 | img.onload = onload;
|
6392 |
|
6393 | img.src = img.src;
|
6394 | }
|
6395 |
|
6396 | return pattern;
|
6397 | }
|
6398 |
|
6399 | module.exports = {
|
6400 | parsePath: function parsePath(path) {
|
6401 | path = path || [];
|
6402 | if (Util.isArray(path)) {
|
6403 | return path;
|
6404 | }
|
6405 |
|
6406 | if (Util.isString(path)) {
|
6407 | path = path.match(regexTags);
|
6408 | Util.each(path, function (item, index) {
|
6409 | item = item.match(regexDot);
|
6410 | if (item[0].length > 1) {
|
6411 | var tag = item[0].charAt(0);
|
6412 | item.splice(1, 0, item[0].substr(1));
|
6413 | item[0] = tag;
|
6414 | }
|
6415 | Util.each(item, function (sub, i) {
|
6416 | if (!isNaN(sub)) {
|
6417 | item[i] = +sub;
|
6418 | }
|
6419 | });
|
6420 | path[index] = item;
|
6421 | });
|
6422 | return path;
|
6423 | }
|
6424 | },
|
6425 | parseStyle: function parseStyle(color, self) {
|
6426 | if (Util.isString(color)) {
|
6427 | if (color[1] === '(' || color[2] === '(') {
|
6428 | if (color[0] === 'l') {
|
6429 |
|
6430 | return parseLineGradient(color, self);
|
6431 | } else if (color[0] === 'r') {
|
6432 |
|
6433 | return parseRadialGradient(color, self);
|
6434 | } else if (color[0] === 'p') {
|
6435 |
|
6436 | return parsePattern(color, self);
|
6437 | }
|
6438 | }
|
6439 | return color;
|
6440 | }
|
6441 | },
|
6442 | numberToColor: function numberToColor(num) {
|
6443 |
|
6444 | var color = numColorCache[num];
|
6445 | if (!color) {
|
6446 | var str = num.toString(16);
|
6447 | for (var i = str.length; i < 6; i++) {
|
6448 | str = '0' + str;
|
6449 | }
|
6450 | color = '#' + str;
|
6451 | numColorCache[num] = color;
|
6452 | }
|
6453 | return color;
|
6454 | }
|
6455 | };
|
6456 |
|
6457 |
|
6458 | },
|
6459 |
|
6460 | function (module, exports, __webpack_require__) {
|
6461 |
|
6462 | var Util = __webpack_require__(0);
|
6463 | var Shape = __webpack_require__(1);
|
6464 | var Inside = __webpack_require__(2);
|
6465 |
|
6466 | var Rect = function Rect(cfg) {
|
6467 | Rect.superclass.constructor.call(this, cfg);
|
6468 | };
|
6469 |
|
6470 | Rect.ATTRS = {
|
6471 | x: 0,
|
6472 | y: 0,
|
6473 | width: 0,
|
6474 | height: 0,
|
6475 | radius: 0,
|
6476 | lineWidth: 1
|
6477 | };
|
6478 |
|
6479 | Util.extend(Rect, Shape);
|
6480 |
|
6481 | Util.augment(Rect, {
|
6482 | canFill: true,
|
6483 | canStroke: true,
|
6484 | type: 'rect',
|
6485 | getDefaultAttrs: function getDefaultAttrs() {
|
6486 | return {
|
6487 | lineWidth: 1,
|
6488 | radius: 0
|
6489 | };
|
6490 | },
|
6491 | calculateBox: function calculateBox() {
|
6492 | var self = this;
|
6493 | var attrs = self.__attrs;
|
6494 | var x = attrs.x;
|
6495 | var y = attrs.y;
|
6496 | var width = attrs.width;
|
6497 | var height = attrs.height;
|
6498 | var lineWidth = attrs.lineWidth;
|
6499 |
|
6500 | var halfWidth = lineWidth / 2;
|
6501 | return {
|
6502 | minX: x - halfWidth,
|
6503 | minY: y - halfWidth,
|
6504 | maxX: x + width + halfWidth,
|
6505 | maxY: y + height + halfWidth
|
6506 | };
|
6507 | },
|
6508 | isPointInPath: function isPointInPath(x, y) {
|
6509 | var self = this;
|
6510 | var fill = self.hasFill();
|
6511 | var stroke = self.hasStroke();
|
6512 |
|
6513 | if (fill && stroke) {
|
6514 | return self.__isPointInFill(x, y) || self.__isPointInStroke(x, y);
|
6515 | }
|
6516 |
|
6517 | if (fill) {
|
6518 | return self.__isPointInFill(x, y);
|
6519 | }
|
6520 |
|
6521 | if (stroke) {
|
6522 | return self.__isPointInStroke(x, y);
|
6523 | }
|
6524 |
|
6525 | return false;
|
6526 | },
|
6527 | __isPointInFill: function __isPointInFill(x, y) {
|
6528 | var context = this.get('context');
|
6529 |
|
6530 | if (!context) return false;
|
6531 | this.createPath();
|
6532 | return context.isPointInPath(x, y);
|
6533 | },
|
6534 | __isPointInStroke: function __isPointInStroke(x, y) {
|
6535 | var self = this;
|
6536 | var attrs = self.__attrs;
|
6537 | var rx = attrs.x;
|
6538 | var ry = attrs.y;
|
6539 | var width = attrs.width;
|
6540 | var height = attrs.height;
|
6541 | var radius = attrs.radius;
|
6542 | var lineWidth = attrs.lineWidth;
|
6543 |
|
6544 | if (radius === 0) {
|
6545 | var halfWidth = lineWidth / 2;
|
6546 | return Inside.line(rx - halfWidth, ry, rx + width + halfWidth, ry, lineWidth, x, y) || Inside.line(rx + width, ry - halfWidth, rx + width, ry + height + halfWidth, lineWidth, x, y) || Inside.line(rx + width + halfWidth, ry + height, rx - halfWidth, ry + height, lineWidth, x, y) || Inside.line(rx, ry + height + halfWidth, rx, ry - halfWidth, lineWidth, x, y);
|
6547 | }
|
6548 |
|
6549 | return Inside.line(rx + radius, ry, rx + width - radius, ry, lineWidth, x, y) || Inside.line(rx + width, ry + radius, rx + width, ry + height - radius, lineWidth, x, y) || Inside.line(rx + width - radius, ry + height, rx + radius, ry + height, lineWidth, x, y) || Inside.line(rx, ry + height - radius, rx, ry + radius, lineWidth, x, y) || Inside.arcline(rx + width - radius, ry + radius, radius, 1.5 * Math.PI, 2 * Math.PI, false, lineWidth, x, y) || Inside.arcline(rx + width - radius, ry + height - radius, radius, 0, 0.5 * Math.PI, false, lineWidth, x, y) || Inside.arcline(rx + radius, ry + height - radius, radius, 0.5 * Math.PI, Math.PI, false, lineWidth, x, y) || Inside.arcline(rx + radius, ry + radius, radius, Math.PI, 1.5 * Math.PI, false, lineWidth, x, y);
|
6550 | },
|
6551 | createPath: function createPath(context) {
|
6552 | var self = this;
|
6553 | var attrs = self.__attrs;
|
6554 | var x = attrs.x;
|
6555 | var y = attrs.y;
|
6556 | var width = attrs.width;
|
6557 | var height = attrs.height;
|
6558 | var radius = attrs.radius;
|
6559 | context = context || self.get('context');
|
6560 |
|
6561 | context.beginPath();
|
6562 | if (radius === 0) {
|
6563 |
|
6564 | context.rect(x, y, width, height);
|
6565 | } else {
|
6566 | context.moveTo(x + radius, y);
|
6567 | context.lineTo(x + width - radius, y);
|
6568 | context.arc(x + width - radius, y + radius, radius, -Math.PI / 2, 0, false);
|
6569 | context.lineTo(x + width, y + height - radius);
|
6570 | context.arc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2, false);
|
6571 | context.lineTo(x + radius, y + height);
|
6572 | context.arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI, false);
|
6573 | context.lineTo(x, y + radius);
|
6574 | context.arc(x + radius, y + radius, radius, Math.PI, Math.PI * 3 / 2, false);
|
6575 | context.closePath();
|
6576 | }
|
6577 | }
|
6578 | });
|
6579 |
|
6580 | module.exports = Rect;
|
6581 |
|
6582 |
|
6583 | },
|
6584 |
|
6585 | function (module, exports, __webpack_require__) {
|
6586 |
|
6587 | var Util = __webpack_require__(0);
|
6588 | var Shape = __webpack_require__(1);
|
6589 | var Inside = __webpack_require__(2);
|
6590 |
|
6591 | var Circle = function Circle(cfg) {
|
6592 | Circle.superclass.constructor.call(this, cfg);
|
6593 | };
|
6594 |
|
6595 | Circle.ATTRS = {
|
6596 | x: 0,
|
6597 | y: 0,
|
6598 | r: 0,
|
6599 | lineWidth: 1
|
6600 | };
|
6601 |
|
6602 | Util.extend(Circle, Shape);
|
6603 |
|
6604 | Util.augment(Circle, {
|
6605 | canFill: true,
|
6606 | canStroke: true,
|
6607 | type: 'circle',
|
6608 | getDefaultAttrs: function getDefaultAttrs() {
|
6609 | return {
|
6610 | lineWidth: 1
|
6611 | };
|
6612 | },
|
6613 | calculateBox: function calculateBox() {
|
6614 | var attrs = this.__attrs;
|
6615 | var cx = attrs.x;
|
6616 | var cy = attrs.y;
|
6617 | var r = attrs.r;
|
6618 | var lineWidth = attrs.lineWidth;
|
6619 | var halfWidth = lineWidth / 2 + r;
|
6620 | return {
|
6621 | minX: cx - halfWidth,
|
6622 | minY: cy - halfWidth,
|
6623 | maxX: cx + halfWidth,
|
6624 | maxY: cy + halfWidth
|
6625 | };
|
6626 | },
|
6627 | isPointInPath: function isPointInPath(x, y) {
|
6628 | var fill = this.hasFill();
|
6629 | var stroke = this.hasStroke();
|
6630 | if (fill && stroke) {
|
6631 | return this.__isPointInFill(x, y) || this.__isPointInStroke(x, y);
|
6632 | }
|
6633 |
|
6634 | if (fill) {
|
6635 | return this.__isPointInFill(x, y);
|
6636 | }
|
6637 |
|
6638 | if (stroke) {
|
6639 | return this.__isPointInStroke(x, y);
|
6640 | }
|
6641 |
|
6642 | return false;
|
6643 | },
|
6644 | __isPointInFill: function __isPointInFill(x, y) {
|
6645 | var attrs = this.__attrs;
|
6646 | var cx = attrs.x;
|
6647 | var cy = attrs.y;
|
6648 | var r = attrs.r;
|
6649 |
|
6650 | return Inside.circle(cx, cy, r, x, y);
|
6651 | },
|
6652 | __isPointInStroke: function __isPointInStroke(x, y) {
|
6653 | var attrs = this.__attrs;
|
6654 | var cx = attrs.x;
|
6655 | var cy = attrs.y;
|
6656 | var r = attrs.r;
|
6657 | var lineWidth = attrs.lineWidth;
|
6658 |
|
6659 | return Inside.arcline(cx, cy, r, 0, Math.PI * 2, false, lineWidth, x, y);
|
6660 | },
|
6661 | createPath: function createPath(context) {
|
6662 | var attrs = this.__attrs;
|
6663 | var cx = attrs.x;
|
6664 | var cy = attrs.y;
|
6665 | var r = attrs.r;
|
6666 | context = context || self.get('context');
|
6667 |
|
6668 | context.beginPath();
|
6669 | context.arc(cx, cy, r, 0, Math.PI * 2, false);
|
6670 | }
|
6671 | });
|
6672 |
|
6673 | module.exports = Circle;
|
6674 |
|
6675 |
|
6676 | },
|
6677 |
|
6678 | function (module, exports, __webpack_require__) {
|
6679 |
|
6680 | var Util = __webpack_require__(0);
|
6681 | var Shape = __webpack_require__(1);
|
6682 | var Inside = __webpack_require__(2);
|
6683 | var mat3 = __webpack_require__(3).mat3;
|
6684 | var vec3 = __webpack_require__(3).vec3;
|
6685 |
|
6686 | var Ellipse = function Ellipse(cfg) {
|
6687 | Ellipse.superclass.constructor.call(this, cfg);
|
6688 | };
|
6689 |
|
6690 | Ellipse.ATTRS = {
|
6691 | x: 0,
|
6692 | y: 0,
|
6693 | rx: 1,
|
6694 | ry: 1,
|
6695 | lineWidth: 1
|
6696 | };
|
6697 |
|
6698 | Util.extend(Ellipse, Shape);
|
6699 |
|
6700 | Util.augment(Ellipse, {
|
6701 | canFill: true,
|
6702 | canStroke: true,
|
6703 | type: 'ellipse',
|
6704 | getDefaultAttrs: function getDefaultAttrs() {
|
6705 | return {
|
6706 | lineWidth: 1
|
6707 | };
|
6708 | },
|
6709 | calculateBox: function calculateBox() {
|
6710 | var attrs = this.__attrs;
|
6711 | var cx = attrs.x;
|
6712 | var cy = attrs.y;
|
6713 | var rx = attrs.rx;
|
6714 | var ry = attrs.ry;
|
6715 | var lineWidth = attrs.lineWidth;
|
6716 | var halfXWidth = rx + lineWidth / 2;
|
6717 | var halfYWidth = ry + lineWidth / 2;
|
6718 |
|
6719 | return {
|
6720 | minX: cx - halfXWidth,
|
6721 | minY: cy - halfYWidth,
|
6722 | maxX: cx + halfXWidth,
|
6723 | maxY: cy + halfYWidth
|
6724 | };
|
6725 | },
|
6726 | isPointInPath: function isPointInPath(x, y) {
|
6727 | var fill = this.hasFill();
|
6728 | var stroke = this.hasStroke();
|
6729 |
|
6730 | if (fill && stroke) {
|
6731 | return this.__isPointInFill(x, y) || this.__isPointInStroke(x, y);
|
6732 | }
|
6733 |
|
6734 | if (fill) {
|
6735 | return this.__isPointInFill(x, y);
|
6736 | }
|
6737 |
|
6738 | if (stroke) {
|
6739 | return this.__isPointInStroke(x, y);
|
6740 | }
|
6741 |
|
6742 | return false;
|
6743 | },
|
6744 | __isPointInFill: function __isPointInFill(x, y) {
|
6745 | var attrs = this.__attrs;
|
6746 | var cx = attrs.x;
|
6747 | var cy = attrs.y;
|
6748 | var rx = attrs.rx;
|
6749 | var ry = attrs.ry;
|
6750 |
|
6751 | var r = rx > ry ? rx : ry;
|
6752 | var scaleX = rx > ry ? 1 : rx / ry;
|
6753 | var scaleY = rx > ry ? ry / rx : 1;
|
6754 |
|
6755 | var p = [x, y, 1];
|
6756 | var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
6757 | mat3.scale(m, m, [scaleX, scaleY]);
|
6758 | mat3.translate(m, m, [cx, cy]);
|
6759 | var inm = mat3.invert([], m);
|
6760 | vec3.transformMat3(p, p, inm);
|
6761 |
|
6762 | return Inside.circle(0, 0, r, p[0], p[1]);
|
6763 | },
|
6764 | __isPointInStroke: function __isPointInStroke(x, y) {
|
6765 | var attrs = this.__attrs;
|
6766 | var cx = attrs.x;
|
6767 | var cy = attrs.y;
|
6768 | var rx = attrs.rx;
|
6769 | var ry = attrs.ry;
|
6770 | var lineWidth = attrs.lineWidth;
|
6771 |
|
6772 | var r = rx > ry ? rx : ry;
|
6773 | var scaleX = rx > ry ? 1 : rx / ry;
|
6774 | var scaleY = rx > ry ? ry / rx : 1;
|
6775 | var p = [x, y, 1];
|
6776 | var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
6777 | mat3.scale(m, m, [scaleX, scaleY]);
|
6778 | mat3.translate(m, m, [cx, cy]);
|
6779 | var inm = mat3.invert([], m);
|
6780 | vec3.transformMat3(p, p, inm);
|
6781 |
|
6782 | return Inside.arcline(0, 0, r, 0, Math.PI * 2, false, lineWidth, p[0], p[1]);
|
6783 | },
|
6784 | createPath: function createPath(context) {
|
6785 | var attrs = this.__attrs;
|
6786 | var cx = attrs.x;
|
6787 | var cy = attrs.y;
|
6788 | var rx = attrs.rx;
|
6789 | var ry = attrs.ry;
|
6790 |
|
6791 | context = context || self.get('context');
|
6792 | var r = rx > ry ? rx : ry;
|
6793 | var scaleX = rx > ry ? 1 : rx / ry;
|
6794 | var scaleY = rx > ry ? ry / rx : 1;
|
6795 |
|
6796 | var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
6797 | mat3.scale(m, m, [scaleX, scaleY]);
|
6798 | mat3.translate(m, m, [cx, cy]);
|
6799 | context.beginPath();
|
6800 | context.save();
|
6801 | context.transform(m[0], m[1], m[3], m[4], m[6], m[7]);
|
6802 | context.arc(0, 0, r, 0, Math.PI * 2);
|
6803 | context.restore();
|
6804 | context.closePath();
|
6805 | }
|
6806 | });
|
6807 |
|
6808 | module.exports = Ellipse;
|
6809 |
|
6810 |
|
6811 | },
|
6812 |
|
6813 | function (module, exports, __webpack_require__) {
|
6814 |
|
6815 | var Util = __webpack_require__(0);
|
6816 | var Shape = __webpack_require__(1);
|
6817 | var PathSegment = __webpack_require__(263);
|
6818 | var Format = __webpack_require__(97);
|
6819 | var Arrow = __webpack_require__(15);
|
6820 | var PathUtil = __webpack_require__(46);
|
6821 | var CubicMath = __webpack_require__(30);
|
6822 |
|
6823 | var Path = function Path(cfg) {
|
6824 | Path.superclass.constructor.call(this, cfg);
|
6825 | };
|
6826 |
|
6827 | Path.ATTRS = {
|
6828 | path: null,
|
6829 | lineWidth: 1,
|
6830 | curve: null,
|
6831 | tCache: null,
|
6832 | startArrow: false,
|
6833 | endArrow: false
|
6834 | };
|
6835 |
|
6836 | Util.extend(Path, Shape);
|
6837 |
|
6838 | Util.augment(Path, {
|
6839 | canFill: true,
|
6840 | canStroke: true,
|
6841 | type: 'path',
|
6842 | getDefaultAttrs: function getDefaultAttrs() {
|
6843 | return {
|
6844 | lineWidth: 1,
|
6845 | startArrow: false,
|
6846 | endArrow: false
|
6847 | };
|
6848 | },
|
6849 | __afterSetAttrPath: function __afterSetAttrPath(path) {
|
6850 | var self = this;
|
6851 | if (Util.isNil(path)) {
|
6852 | self.setSilent('segments', null);
|
6853 | self.setSilent('box', undefined);
|
6854 | return;
|
6855 | }
|
6856 | var pathArray = Format.parsePath(path);
|
6857 | var preSegment = void 0;
|
6858 | var segments = [];
|
6859 |
|
6860 | if (!Util.isArray(pathArray) || pathArray.length === 0 || pathArray[0][0] !== 'M' && pathArray[0][0] !== 'm') {
|
6861 | return;
|
6862 | }
|
6863 | var count = pathArray.length;
|
6864 | for (var i = 0; i < pathArray.length; i++) {
|
6865 | var item = pathArray[i];
|
6866 | preSegment = new PathSegment(item, preSegment, i === count - 1);
|
6867 | segments.push(preSegment);
|
6868 | }
|
6869 | self.setSilent('segments', segments);
|
6870 | self.set('tCache', null);
|
6871 | this.setSilent('box', null);
|
6872 | },
|
6873 | __afterSetAttrAll: function __afterSetAttrAll(objs) {
|
6874 | if (objs.path) {
|
6875 | this.__afterSetAttrPath(objs.path);
|
6876 | }
|
6877 | },
|
6878 | calculateBox: function calculateBox() {
|
6879 | var self = this;
|
6880 | var attrs = self.__attrs;
|
6881 | var lineWidth = attrs.lineWidth;
|
6882 | var lineAppendWidth = attrs.lineAppendWidth || 0;
|
6883 | var segments = self.get('segments');
|
6884 |
|
6885 | if (!segments) {
|
6886 | return null;
|
6887 | }
|
6888 | lineWidth += lineAppendWidth;
|
6889 | var minX = Infinity;
|
6890 | var maxX = -Infinity;
|
6891 | var minY = Infinity;
|
6892 | var maxY = -Infinity;
|
6893 | Util.each(segments, function (segment) {
|
6894 | segment.getBBox(lineWidth);
|
6895 | var box = segment.box;
|
6896 | if (box) {
|
6897 | if (box.minX < minX) {
|
6898 | minX = box.minX;
|
6899 | }
|
6900 |
|
6901 | if (box.maxX > maxX) {
|
6902 | maxX = box.maxX;
|
6903 | }
|
6904 |
|
6905 | if (box.minY < minY) {
|
6906 | minY = box.minY;
|
6907 | }
|
6908 |
|
6909 | if (box.maxY > maxY) {
|
6910 | maxY = box.maxY;
|
6911 | }
|
6912 | }
|
6913 | });
|
6914 | return {
|
6915 | minX: minX,
|
6916 | minY: minY,
|
6917 | maxX: maxX,
|
6918 | maxY: maxY
|
6919 | };
|
6920 | },
|
6921 | isPointInPath: function isPointInPath(x, y) {
|
6922 | var self = this;
|
6923 | var fill = self.hasFill();
|
6924 | var stroke = self.hasStroke();
|
6925 |
|
6926 | if (fill && stroke) {
|
6927 | return self.__isPointInFill(x, y) || self.__isPointInStroke(x, y);
|
6928 | }
|
6929 |
|
6930 | if (fill) {
|
6931 | return self.__isPointInFill(x, y);
|
6932 | }
|
6933 |
|
6934 | if (stroke) {
|
6935 | return self.__isPointInStroke(x, y);
|
6936 | }
|
6937 |
|
6938 | return false;
|
6939 | },
|
6940 | __isPointInFill: function __isPointInFill(x, y) {
|
6941 | var self = this;
|
6942 | var context = self.get('context');
|
6943 | if (!context) return undefined;
|
6944 | self.createPath();
|
6945 | return context.isPointInPath(x, y);
|
6946 | },
|
6947 | __isPointInStroke: function __isPointInStroke(x, y) {
|
6948 | var self = this;
|
6949 | var segments = self.get('segments');
|
6950 | if (!Util.isEmpty(segments)) {
|
6951 | var attrs = self.__attrs;
|
6952 | var lineWidth = attrs.lineWidth;
|
6953 | var appendWidth = attrs.lineAppendWidth || 0;
|
6954 | lineWidth += appendWidth;
|
6955 | for (var i = 0, l = segments.length; i < l; i++) {
|
6956 | if (segments[i].isInside(x, y, lineWidth)) {
|
6957 | return true;
|
6958 | }
|
6959 | }
|
6960 | }
|
6961 |
|
6962 | return false;
|
6963 | },
|
6964 | __setTcache: function __setTcache() {
|
6965 | var totalLength = 0;
|
6966 | var tempLength = 0;
|
6967 | var tCache = [];
|
6968 | var segmentT = void 0;
|
6969 | var segmentL = void 0;
|
6970 | var segmentN = void 0;
|
6971 | var l = void 0;
|
6972 | var curve = this.curve;
|
6973 |
|
6974 | if (!curve) {
|
6975 | return;
|
6976 | }
|
6977 |
|
6978 | Util.each(curve, function (segment, i) {
|
6979 | segmentN = curve[i + 1];
|
6980 | l = segment.length;
|
6981 | if (segmentN) {
|
6982 | totalLength += CubicMath.len(segment[l - 2], segment[l - 1], segmentN[1], segmentN[2], segmentN[3], segmentN[4], segmentN[5], segmentN[6]);
|
6983 | }
|
6984 | });
|
6985 |
|
6986 | Util.each(curve, function (segment, i) {
|
6987 | segmentN = curve[i + 1];
|
6988 | l = segment.length;
|
6989 | if (segmentN) {
|
6990 | segmentT = [];
|
6991 | segmentT[0] = tempLength / totalLength;
|
6992 | segmentL = CubicMath.len(segment[l - 2], segment[l - 1], segmentN[1], segmentN[2], segmentN[3], segmentN[4], segmentN[5], segmentN[6]);
|
6993 | tempLength += segmentL;
|
6994 | segmentT[1] = tempLength / totalLength;
|
6995 | tCache.push(segmentT);
|
6996 | }
|
6997 | });
|
6998 |
|
6999 | this.tCache = tCache;
|
7000 | },
|
7001 | __calculateCurve: function __calculateCurve() {
|
7002 | var self = this;
|
7003 | var attrs = self.__attrs;
|
7004 | var path = attrs.path;
|
7005 | this.curve = PathUtil.pathTocurve(path);
|
7006 | },
|
7007 | getPoint: function getPoint(t) {
|
7008 | var tCache = this.tCache;
|
7009 | var subt = void 0;
|
7010 | var index = void 0;
|
7011 |
|
7012 | if (!tCache) {
|
7013 | this.__calculateCurve();
|
7014 | this.__setTcache();
|
7015 | tCache = this.tCache;
|
7016 | }
|
7017 |
|
7018 | var curve = this.curve;
|
7019 |
|
7020 | if (!tCache) {
|
7021 | if (curve) {
|
7022 | return {
|
7023 | x: curve[0][1],
|
7024 | y: curve[0][2]
|
7025 | };
|
7026 | }
|
7027 | return null;
|
7028 | }
|
7029 | Util.each(tCache, function (v, i) {
|
7030 | if (t >= v[0] && t <= v[1]) {
|
7031 | subt = (t - v[0]) / (v[1] - v[0]);
|
7032 | index = i;
|
7033 | }
|
7034 | });
|
7035 | var seg = curve[index];
|
7036 | if (Util.isNil(seg) || Util.isNil(index)) {
|
7037 | return null;
|
7038 | }
|
7039 | var l = seg.length;
|
7040 | var nextSeg = curve[index + 1];
|
7041 | return {
|
7042 | x: CubicMath.at(seg[l - 2], nextSeg[1], nextSeg[3], nextSeg[5], 1 - subt),
|
7043 | y: CubicMath.at(seg[l - 1], nextSeg[2], nextSeg[4], nextSeg[6], 1 - subt)
|
7044 | };
|
7045 | },
|
7046 | createPath: function createPath(context) {
|
7047 | var self = this;
|
7048 | var attrs = self.__attrs;
|
7049 | var segments = self.get('segments');
|
7050 |
|
7051 | if (!Util.isArray(segments)) return;
|
7052 |
|
7053 | context = context || self.get('context');
|
7054 |
|
7055 | context.beginPath();
|
7056 |
|
7057 | var path = attrs.path;
|
7058 | var startPoint = void 0;
|
7059 | var endPoint = void 0;
|
7060 | var closed = false;
|
7061 | if (path[path.length - 1] === 'z' || path[path.length - 1] === 'Z' || attrs.fill) {
|
7062 |
|
7063 | closed = true;
|
7064 | }
|
7065 |
|
7066 | var segmentsLen = segments.length;
|
7067 | if (segmentsLen > 1 && !closed) {
|
7068 | startPoint = segments[0].endPoint;
|
7069 | endPoint = segments[1].endPoint;
|
7070 | Arrow.addStartArrow(context, attrs, endPoint.x, endPoint.y, startPoint.x, startPoint.y);
|
7071 | }
|
7072 |
|
7073 | for (var i = 0, l = segmentsLen; i < l; i++) {
|
7074 | segments[i].draw(context);
|
7075 | }
|
7076 |
|
7077 | if (segmentsLen > 1 && !closed) {
|
7078 | startPoint = segments[segmentsLen - 2].endPoint;
|
7079 | endPoint = segments[segmentsLen - 1].endPoint;
|
7080 | Arrow.addEndArrow(context, attrs, startPoint.x, startPoint.y, endPoint.x, endPoint.y);
|
7081 | }
|
7082 | }
|
7083 | });
|
7084 |
|
7085 | module.exports = Path;
|
7086 |
|
7087 |
|
7088 | },
|
7089 |
|
7090 | function (module, exports, __webpack_require__) {
|
7091 |
|
7092 | var Util = __webpack_require__(0);
|
7093 | var Shape = __webpack_require__(1);
|
7094 | var Inside = __webpack_require__(2);
|
7095 |
|
7096 | var CText = function CText(cfg) {
|
7097 | CText.superclass.constructor.call(this, cfg);
|
7098 | };
|
7099 |
|
7100 | CText.ATTRS = {
|
7101 | x: 0,
|
7102 | y: 0,
|
7103 | text: null,
|
7104 | fontSize: 12,
|
7105 | fontFamily: 'sans-serif',
|
7106 | fontStyle: 'normal',
|
7107 | fontWeight: 'normal',
|
7108 | fontVariant: 'normal',
|
7109 | textAlign: 'start',
|
7110 | textBaseline: 'bottom',
|
7111 | lineHeight: null,
|
7112 | textArr: null
|
7113 | };
|
7114 |
|
7115 | Util.extend(CText, Shape);
|
7116 |
|
7117 | Util.augment(CText, {
|
7118 | canFill: true,
|
7119 | canStroke: true,
|
7120 | type: 'text',
|
7121 | getDefaultAttrs: function getDefaultAttrs() {
|
7122 | return {
|
7123 | lineWidth: 1,
|
7124 | lineCount: 1,
|
7125 | fontSize: 12,
|
7126 | fontFamily: 'sans-serif',
|
7127 | fontStyle: 'normal',
|
7128 | fontWeight: 'normal',
|
7129 | fontVariant: 'normal',
|
7130 | textAlign: 'start',
|
7131 | textBaseline: 'bottom'
|
7132 | };
|
7133 | },
|
7134 | initTransform: function initTransform() {
|
7135 | this.attr('matrix', [1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
7136 | var fontSize = this.__attrs.fontSize;
|
7137 | if (fontSize && +fontSize < 12) {
|
7138 |
|
7139 | this.transform([['t', -1 * this.__attrs.x, -1 * this.__attrs.y], ['s', +fontSize / 12, +fontSize / 12], ['t', this.__attrs.x, this.__attrs.y]]);
|
7140 | }
|
7141 | },
|
7142 | __assembleFont: function __assembleFont() {
|
7143 |
|
7144 | var attrs = this.__attrs;
|
7145 | var fontSize = attrs.fontSize;
|
7146 | var fontFamily = attrs.fontFamily;
|
7147 | var fontWeight = attrs.fontWeight;
|
7148 | var fontStyle = attrs.fontStyle;
|
7149 | var fontVariant = attrs.fontVariant;
|
7150 |
|
7151 | attrs.font = [fontStyle, fontVariant, fontWeight, fontSize + 'px', fontFamily].join(' ');
|
7152 | },
|
7153 | __afterSetAttrFontSize: function __afterSetAttrFontSize() {
|
7154 | |
7155 |
|
7156 |
|
7157 | this.__assembleFont();
|
7158 | },
|
7159 | __afterSetAttrFontFamily: function __afterSetAttrFontFamily() {
|
7160 | this.__assembleFont();
|
7161 | },
|
7162 | __afterSetAttrFontWeight: function __afterSetAttrFontWeight() {
|
7163 | this.__assembleFont();
|
7164 | },
|
7165 | __afterSetAttrFontStyle: function __afterSetAttrFontStyle() {
|
7166 | this.__assembleFont();
|
7167 | },
|
7168 | __afterSetAttrFontVariant: function __afterSetAttrFontVariant() {
|
7169 | this.__assembleFont();
|
7170 | },
|
7171 | __afterSetAttrFont: function __afterSetAttrFont() {
|
7172 |
|
7173 | },
|
7174 | __afterSetAttrText: function __afterSetAttrText() {
|
7175 | var attrs = this.__attrs;
|
7176 | var text = attrs.text;
|
7177 | var textArr = void 0;
|
7178 | if (Util.isString(text) && text.indexOf('\n') !== -1) {
|
7179 | textArr = text.split('\n');
|
7180 | var lineCount = textArr.length;
|
7181 | attrs.lineCount = lineCount;
|
7182 | attrs.textArr = textArr;
|
7183 | }
|
7184 |
|
7185 |
|
7186 | },
|
7187 | __getTextHeight: function __getTextHeight() {
|
7188 | var attrs = this.__attrs;
|
7189 | var lineCount = attrs.lineCount;
|
7190 | var fontSize = attrs.fontSize * 1;
|
7191 | if (lineCount > 1) {
|
7192 | var spaceingY = this.__getSpaceingY();
|
7193 | return fontSize * lineCount + spaceingY * (lineCount - 1);
|
7194 | }
|
7195 | return fontSize;
|
7196 | },
|
7197 |
|
7198 |
|
7199 | __afterSetAttrAll: function __afterSetAttrAll(objs) {
|
7200 | var self = this;
|
7201 | if ('fontSize' in objs || 'fontWeight' in objs || 'fontStyle' in objs || 'fontVariant' in objs || 'fontFamily' in objs) {
|
7202 | self.__assembleFont();
|
7203 | }
|
7204 |
|
7205 | if ('text' in objs) {
|
7206 | self.__afterSetAttrText(objs.text);
|
7207 | }
|
7208 | },
|
7209 | isHitBox: function isHitBox() {
|
7210 | return false;
|
7211 | },
|
7212 | calculateBox: function calculateBox() {
|
7213 | var self = this;
|
7214 | var attrs = self.__attrs;
|
7215 | var x = attrs.x;
|
7216 | var y = attrs.y;
|
7217 | var width = self.measureText();
|
7218 | if (!width) {
|
7219 |
|
7220 | return {
|
7221 | minX: x,
|
7222 | minY: y,
|
7223 | maxX: x,
|
7224 | maxY: y
|
7225 | };
|
7226 | }
|
7227 | var height = self.__getTextHeight();
|
7228 | var textAlign = attrs.textAlign;
|
7229 | var textBaseline = attrs.textBaseline;
|
7230 | var lineWidth = attrs.lineWidth;
|
7231 | var point = {
|
7232 | x: x,
|
7233 | y: y - height
|
7234 | };
|
7235 |
|
7236 | if (textAlign) {
|
7237 | if (textAlign === 'end' || textAlign === 'right') {
|
7238 | point.x -= width;
|
7239 | } else if (textAlign === 'center') {
|
7240 | point.x -= width / 2;
|
7241 | }
|
7242 | }
|
7243 |
|
7244 | if (textBaseline) {
|
7245 | if (textBaseline === 'top') {
|
7246 | point.y += height;
|
7247 | } else if (textBaseline === 'middle') {
|
7248 | point.y += height / 2;
|
7249 | }
|
7250 | }
|
7251 |
|
7252 | this.set('startPoint', point);
|
7253 | var halfWidth = lineWidth / 2;
|
7254 | return {
|
7255 | minX: point.x - halfWidth,
|
7256 | minY: point.y - halfWidth,
|
7257 | maxX: point.x + width + halfWidth,
|
7258 | maxY: point.y + height + halfWidth
|
7259 | };
|
7260 | },
|
7261 | __getSpaceingY: function __getSpaceingY() {
|
7262 | var attrs = this.__attrs;
|
7263 | var lineHeight = attrs.lineHeight;
|
7264 | var fontSize = attrs.fontSize * 1;
|
7265 | return lineHeight ? lineHeight - fontSize : fontSize * 0.14;
|
7266 | },
|
7267 | isPointInPath: function isPointInPath(x, y) {
|
7268 | var self = this;
|
7269 | var box = self.getBBox();
|
7270 | if (self.hasFill() || self.hasStroke()) {
|
7271 | return Inside.box(box.minX, box.maxX, box.minY, box.maxY, x, y);
|
7272 | }
|
7273 | },
|
7274 | drawInner: function drawInner(context) {
|
7275 | var self = this;
|
7276 | var attrs = self.__attrs;
|
7277 | var text = attrs.text;
|
7278 | if (!text) {
|
7279 | return;
|
7280 | }
|
7281 | var textArr = attrs.textArr;
|
7282 | var fontSize = attrs.fontSize * 1;
|
7283 | var spaceingY = self.__getSpaceingY();
|
7284 | var x = attrs.x;
|
7285 | var y = attrs.y;
|
7286 | var textBaseline = attrs.textBaseline;
|
7287 | var height = void 0;
|
7288 | if (textArr) {
|
7289 | var box = self.getBBox();
|
7290 | height = box.maxY - box.minY;
|
7291 | }
|
7292 | var subY = void 0;
|
7293 |
|
7294 | context.beginPath();
|
7295 | if (self.hasFill()) {
|
7296 | var fillOpacity = attrs.fillOpacity;
|
7297 | if (!Util.isNil(fillOpacity) && fillOpacity !== 1) {
|
7298 | context.globalAlpha = fillOpacity;
|
7299 | }
|
7300 | if (textArr) {
|
7301 | Util.each(textArr, function (subText, index) {
|
7302 | subY = y + index * (spaceingY + fontSize) - height + fontSize;
|
7303 | if (textBaseline === 'middle') subY += height - fontSize - (height - fontSize) / 2;
|
7304 | if (textBaseline === 'top') subY += height - fontSize;
|
7305 | context.fillText(subText, x, subY);
|
7306 | });
|
7307 | } else {
|
7308 | context.fillText(text, x, y);
|
7309 | }
|
7310 | }
|
7311 |
|
7312 | if (self.hasStroke()) {
|
7313 | if (textArr) {
|
7314 | Util.each(textArr, function (subText, index) {
|
7315 | subY = y + index * (spaceingY + fontSize) - height + fontSize;
|
7316 | if (textBaseline === 'middle') subY += height - fontSize - (height - fontSize) / 2;
|
7317 | if (textBaseline === 'top') subY += height - fontSize;
|
7318 | context.strokeText(subText, x, subY);
|
7319 | });
|
7320 | } else {
|
7321 | context.strokeText(text, x, y);
|
7322 | }
|
7323 | }
|
7324 | },
|
7325 | measureText: function measureText() {
|
7326 | var self = this;
|
7327 | var attrs = self.__attrs;
|
7328 | var text = attrs.text;
|
7329 | var font = attrs.font;
|
7330 | var textArr = attrs.textArr;
|
7331 | var measureWidth = void 0;
|
7332 | var width = 0;
|
7333 |
|
7334 | if (Util.isNil(text)) return undefined;
|
7335 | var context = document.createElement('canvas').getContext('2d');
|
7336 | context.save();
|
7337 | context.font = font;
|
7338 | if (textArr) {
|
7339 | Util.each(textArr, function (subText) {
|
7340 | measureWidth = context.measureText(subText).width;
|
7341 | if (width < measureWidth) {
|
7342 | width = measureWidth;
|
7343 | }
|
7344 | context.restore();
|
7345 | });
|
7346 | } else {
|
7347 | width = context.measureText(text).width;
|
7348 | context.restore();
|
7349 | }
|
7350 | return width;
|
7351 | }
|
7352 | });
|
7353 |
|
7354 | module.exports = CText;
|
7355 |
|
7356 |
|
7357 | },
|
7358 |
|
7359 | function (module, exports, __webpack_require__) {
|
7360 |
|
7361 | var Util = __webpack_require__(0);
|
7362 | var Shape = __webpack_require__(1);
|
7363 | var Inside = __webpack_require__(2);
|
7364 | var Arrow = __webpack_require__(15);
|
7365 | var LineMath = __webpack_require__(52);
|
7366 |
|
7367 | var Line = function Line(cfg) {
|
7368 | Line.superclass.constructor.call(this, cfg);
|
7369 | };
|
7370 |
|
7371 | Line.ATTRS = {
|
7372 | x1: 0,
|
7373 | y1: 0,
|
7374 | x2: 0,
|
7375 | y2: 0,
|
7376 | lineWidth: 1,
|
7377 | startArrow: false,
|
7378 | endArrow: false
|
7379 | };
|
7380 |
|
7381 | Util.extend(Line, Shape);
|
7382 |
|
7383 | Util.augment(Line, {
|
7384 | canStroke: true,
|
7385 | type: 'line',
|
7386 | getDefaultAttrs: function getDefaultAttrs() {
|
7387 | return {
|
7388 | lineWidth: 1,
|
7389 | startArrow: false,
|
7390 | endArrow: false
|
7391 | };
|
7392 | },
|
7393 | calculateBox: function calculateBox() {
|
7394 | var attrs = this.__attrs;
|
7395 | var x1 = attrs.x1,
|
7396 | y1 = attrs.y1,
|
7397 | x2 = attrs.x2,
|
7398 | y2 = attrs.y2,
|
7399 | lineWidth = attrs.lineWidth;
|
7400 |
|
7401 | return LineMath.box(x1, y1, x2, y2, lineWidth);
|
7402 | },
|
7403 | isPointInPath: function isPointInPath(x, y) {
|
7404 | var attrs = this.__attrs;
|
7405 | var x1 = attrs.x1,
|
7406 | y1 = attrs.y1,
|
7407 | x2 = attrs.x2,
|
7408 | y2 = attrs.y2,
|
7409 | lineWidth = attrs.lineWidth;
|
7410 |
|
7411 | if (this.hasStroke()) {
|
7412 | return Inside.line(x1, y1, x2, y2, lineWidth, x, y);
|
7413 | }
|
7414 |
|
7415 | return false;
|
7416 | },
|
7417 | createPath: function createPath(context) {
|
7418 | var attrs = this.__attrs;
|
7419 | var x1 = attrs.x1,
|
7420 | y1 = attrs.y1,
|
7421 | x2 = attrs.x2,
|
7422 | y2 = attrs.y2;
|
7423 |
|
7424 | context = context || self.get('context');
|
7425 | context.beginPath();
|
7426 |
|
7427 | Arrow.addStartArrow(context, attrs, x1, y1, x2, y2);
|
7428 | context.moveTo(x1, y1);
|
7429 | context.lineTo(x2, y2);
|
7430 | Arrow.addEndArrow(context, attrs, x2, y2, x1, y1);
|
7431 | },
|
7432 | getPoint: function getPoint(t) {
|
7433 | var attrs = this.__attrs;
|
7434 | return {
|
7435 | x: LineMath.at(attrs.x1, attrs.x2, t),
|
7436 | y: LineMath.at(attrs.y1, attrs.y2, t)
|
7437 | };
|
7438 | }
|
7439 | });
|
7440 |
|
7441 | module.exports = Line;
|
7442 |
|
7443 |
|
7444 | },
|
7445 |
|
7446 | function (module, exports, __webpack_require__) {
|
7447 |
|
7448 | var Util = __webpack_require__(0);
|
7449 | var Shape = __webpack_require__(1);
|
7450 | var Inside = __webpack_require__(2);
|
7451 |
|
7452 | var CImage = function CImage(cfg) {
|
7453 | CImage.superclass.constructor.call(this, cfg);
|
7454 | };
|
7455 |
|
7456 | CImage.ATTRS = {
|
7457 | x: 0,
|
7458 | y: 0,
|
7459 | img: undefined,
|
7460 | width: 0,
|
7461 | height: 0,
|
7462 | sx: null,
|
7463 | sy: null,
|
7464 | swidth: null,
|
7465 | sheight: null
|
7466 | };
|
7467 |
|
7468 | Util.extend(CImage, Shape);
|
7469 |
|
7470 | Util.augment(CImage, {
|
7471 | type: 'image',
|
7472 | __afterSetAttrImg: function __afterSetAttrImg(img) {
|
7473 | this.__setAttrImg(img);
|
7474 | },
|
7475 | __afterSetAttrAll: function __afterSetAttrAll(params) {
|
7476 | if (params.img) {
|
7477 | this.__setAttrImg(params.img);
|
7478 | }
|
7479 | },
|
7480 | isHitBox: function isHitBox() {
|
7481 | return false;
|
7482 | },
|
7483 | calculateBox: function calculateBox() {
|
7484 | var attrs = this.__attrs;
|
7485 | var x = attrs.x;
|
7486 | var y = attrs.y;
|
7487 | var width = attrs.width;
|
7488 | var height = attrs.height;
|
7489 |
|
7490 | return {
|
7491 | minX: x,
|
7492 | minY: y,
|
7493 | maxX: x + width,
|
7494 | maxY: y + height
|
7495 | };
|
7496 | },
|
7497 | isPointInPath: function isPointInPath(x, y) {
|
7498 | var attrs = this.__attrs;
|
7499 | if (this.get('toDraw') || !attrs.img) {
|
7500 | return false;
|
7501 | }
|
7502 | var rx = attrs.x;
|
7503 | var ry = attrs.y;
|
7504 | var width = attrs.width;
|
7505 | var height = attrs.height;
|
7506 | return Inside.rect(rx, ry, width, height, x, y);
|
7507 | },
|
7508 | __setLoading: function __setLoading(loading) {
|
7509 | var canvas = this.get('canvas');
|
7510 | if (loading === false && this.get('toDraw') === true) {
|
7511 | this.__cfg.loading = false;
|
7512 | canvas.draw();
|
7513 | }
|
7514 | return loading;
|
7515 | },
|
7516 | __setAttrImg: function __setAttrImg(img) {
|
7517 | var self = this;
|
7518 | var attrs = self.__attrs;
|
7519 | if (Util.isString(img)) {
|
7520 | var image = new Image();
|
7521 | image.onload = function () {
|
7522 | if (self.get('destroyed')) return false;
|
7523 | self.attr('imgSrc', img);
|
7524 | self.attr('img', image);
|
7525 | var callback = self.get('callback');
|
7526 | if (callback) {
|
7527 | callback.call(self);
|
7528 | }
|
7529 | self.set('loading', false);
|
7530 | };
|
7531 | image.src = img;
|
7532 | self.set('loading', true);
|
7533 | } else if (img instanceof Image) {
|
7534 | if (!attrs.width) {
|
7535 | self.attr('width', img.width);
|
7536 | }
|
7537 |
|
7538 | if (!attrs.height) {
|
7539 | self.attr('height', img.height);
|
7540 | }
|
7541 | return img;
|
7542 | } else if (img instanceof HTMLElement && Util.isString(img.nodeName) && img.nodeName.toUpperCase() === 'CANVAS') {
|
7543 | if (!attrs.width) {
|
7544 | self.attr('width', Number(img.getAttribute('width')));
|
7545 | }
|
7546 |
|
7547 | if (!attrs.height) {
|
7548 | self.attr('height', Number(img.getAttribute('height')));
|
7549 | }
|
7550 | return img;
|
7551 | } else if (img instanceof ImageData) {
|
7552 | if (!attrs.width) {
|
7553 | self.attr('width', img.width);
|
7554 | }
|
7555 |
|
7556 | if (!attrs.height) {
|
7557 | self.attr('height', img.height);
|
7558 | }
|
7559 | return img;
|
7560 | } else {
|
7561 | return null;
|
7562 | }
|
7563 | },
|
7564 | drawInner: function drawInner(context) {
|
7565 | if (this.get('loading')) {
|
7566 | this.set('toDraw', true);
|
7567 | return;
|
7568 | }
|
7569 | this.__drawImage(context);
|
7570 | },
|
7571 | __drawImage: function __drawImage(context) {
|
7572 | var attrs = this.__attrs;
|
7573 | var x = attrs.x;
|
7574 | var y = attrs.y;
|
7575 | var img = attrs.img;
|
7576 | var width = attrs.width;
|
7577 | var height = attrs.height;
|
7578 | var sx = attrs.sx;
|
7579 | var sy = attrs.sy;
|
7580 | var swidth = attrs.swidth;
|
7581 | var sheight = attrs.sheight;
|
7582 | this.set('toDraw', false);
|
7583 |
|
7584 | if (img instanceof Image || img instanceof HTMLElement && Util.isString(img.nodeName) && img.nodeName.toUpperCase() === 'CANVAS') {
|
7585 | if (Util.isNil(sx) || Util.isNil(sy) || Util.isNil(swidth) || Util.isNil(sheight)) {
|
7586 | context.drawImage(img, x, y, width, height);
|
7587 | return;
|
7588 | }
|
7589 | if (!Util.isNil(sx) && !Util.isNil(sy) && !Util.isNil(swidth) && !Util.isNil(sheight)) {
|
7590 | context.drawImage(img, sx, sy, swidth, sheight, x, y, width, height);
|
7591 | return;
|
7592 | }
|
7593 | } else if (img instanceof ImageData) {
|
7594 | context.putImageData(img, x, y, sx || 0, sy || 0, swidth || width, sheight || height);
|
7595 | return;
|
7596 | }
|
7597 | return;
|
7598 | }
|
7599 | });
|
7600 |
|
7601 | module.exports = CImage;
|
7602 |
|
7603 |
|
7604 | },
|
7605 |
|
7606 | function (module, exports, __webpack_require__) {
|
7607 |
|
7608 | var Util = __webpack_require__(0);
|
7609 | var Shape = __webpack_require__(1);
|
7610 | var Inside = __webpack_require__(2);
|
7611 |
|
7612 | var Polygon = function Polygon(cfg) {
|
7613 | Polygon.superclass.constructor.call(this, cfg);
|
7614 | };
|
7615 |
|
7616 | Polygon.ATTRS = {
|
7617 | points: null,
|
7618 | lineWidth: 1
|
7619 | };
|
7620 |
|
7621 | Util.extend(Polygon, Shape);
|
7622 |
|
7623 | Util.augment(Polygon, {
|
7624 | canFill: true,
|
7625 | canStroke: true,
|
7626 | type: 'polygon',
|
7627 | getDefaultAttrs: function getDefaultAttrs() {
|
7628 | return {
|
7629 | lineWidth: 1
|
7630 | };
|
7631 | },
|
7632 | calculateBox: function calculateBox() {
|
7633 | var self = this;
|
7634 | var attrs = self.__attrs;
|
7635 | var points = attrs.points;
|
7636 | var lineWidth = attrs.lineWidth;
|
7637 | if (!points || points.length === 0) {
|
7638 | return null;
|
7639 | }
|
7640 | var minX = Infinity;
|
7641 | var minY = Infinity;
|
7642 | var maxX = -Infinity;
|
7643 | var maxY = -Infinity;
|
7644 |
|
7645 | Util.each(points, function (point) {
|
7646 | var x = point[0];
|
7647 | var y = point[1];
|
7648 | if (x < minX) {
|
7649 | minX = x;
|
7650 | }
|
7651 | if (x > maxX) {
|
7652 | maxX = x;
|
7653 | }
|
7654 |
|
7655 | if (y < minY) {
|
7656 | minY = y;
|
7657 | }
|
7658 |
|
7659 | if (y > maxY) {
|
7660 | maxY = y;
|
7661 | }
|
7662 | });
|
7663 |
|
7664 | var halfWidth = lineWidth / 2;
|
7665 | return {
|
7666 | minX: minX - halfWidth,
|
7667 | minY: minY - halfWidth,
|
7668 | maxX: maxX + halfWidth,
|
7669 | maxY: maxY + halfWidth
|
7670 | };
|
7671 | },
|
7672 | isPointInPath: function isPointInPath(x, y) {
|
7673 | var self = this;
|
7674 | var fill = self.hasFill();
|
7675 | var stroke = self.hasStroke();
|
7676 |
|
7677 | if (fill && stroke) {
|
7678 | return self.__isPointInFill(x, y) || self.__isPointInStroke(x, y);
|
7679 | }
|
7680 |
|
7681 | if (fill) {
|
7682 | return self.__isPointInFill(x, y);
|
7683 | }
|
7684 |
|
7685 | if (stroke) {
|
7686 | return self.__isPointInStroke(x, y);
|
7687 | }
|
7688 |
|
7689 | return false;
|
7690 | },
|
7691 | __isPointInFill: function __isPointInFill(x, y) {
|
7692 | var self = this;
|
7693 | var context = self.get('context');
|
7694 | self.createPath();
|
7695 | return context.isPointInPath(x, y);
|
7696 | },
|
7697 | __isPointInStroke: function __isPointInStroke(x, y) {
|
7698 | var self = this;
|
7699 | var attrs = self.__attrs;
|
7700 | var points = attrs.points;
|
7701 | if (points.length < 2) {
|
7702 | return false;
|
7703 | }
|
7704 | var lineWidth = attrs.lineWidth;
|
7705 | var outPoints = points.slice(0);
|
7706 | if (points.length >= 3) {
|
7707 | outPoints.push(points[0]);
|
7708 | }
|
7709 |
|
7710 | return Inside.polyline(outPoints, lineWidth, x, y);
|
7711 | },
|
7712 | createPath: function createPath(context) {
|
7713 | var self = this;
|
7714 | var attrs = self.__attrs;
|
7715 | var points = attrs.points;
|
7716 | if (points.length < 2) {
|
7717 | return;
|
7718 | }
|
7719 | context = context || self.get('context');
|
7720 | context.beginPath();
|
7721 | Util.each(points, function (point, index) {
|
7722 | if (index === 0) {
|
7723 | context.moveTo(point[0], point[1]);
|
7724 | } else {
|
7725 | context.lineTo(point[0], point[1]);
|
7726 | }
|
7727 | });
|
7728 | context.closePath();
|
7729 | }
|
7730 | });
|
7731 |
|
7732 | module.exports = Polygon;
|
7733 |
|
7734 |
|
7735 | },
|
7736 |
|
7737 | function (module, exports, __webpack_require__) {
|
7738 |
|
7739 | var Util = __webpack_require__(0);
|
7740 | var Shape = __webpack_require__(1);
|
7741 | var Inside = __webpack_require__(2);
|
7742 | var Arrow = __webpack_require__(15);
|
7743 | var LineMath = __webpack_require__(52);
|
7744 |
|
7745 | var Polyline = function Polyline(cfg) {
|
7746 | Polyline.superclass.constructor.call(this, cfg);
|
7747 | };
|
7748 |
|
7749 | Polyline.ATTRS = {
|
7750 | points: null,
|
7751 | lineWidth: 1,
|
7752 | startArrow: false,
|
7753 | endArrow: false,
|
7754 | tCache: null
|
7755 | };
|
7756 |
|
7757 | Util.extend(Polyline, Shape);
|
7758 |
|
7759 | Util.augment(Polyline, {
|
7760 | canStroke: true,
|
7761 | type: 'polyline',
|
7762 | tCache: null,
|
7763 | getDefaultAttrs: function getDefaultAttrs() {
|
7764 | return {
|
7765 | lineWidth: 1,
|
7766 | startArrow: false,
|
7767 | endArrow: false
|
7768 | };
|
7769 | },
|
7770 | calculateBox: function calculateBox() {
|
7771 | var self = this;
|
7772 | var attrs = self.__attrs;
|
7773 | var lineWidth = attrs.lineWidth;
|
7774 | var points = attrs.points;
|
7775 | if (!points || points.length === 0) {
|
7776 | return null;
|
7777 | }
|
7778 | var minX = Infinity;
|
7779 | var minY = Infinity;
|
7780 | var maxX = -Infinity;
|
7781 | var maxY = -Infinity;
|
7782 |
|
7783 | Util.each(points, function (point) {
|
7784 | var x = point[0];
|
7785 | var y = point[1];
|
7786 | if (x < minX) {
|
7787 | minX = x;
|
7788 | }
|
7789 | if (x > maxX) {
|
7790 | maxX = x;
|
7791 | }
|
7792 |
|
7793 | if (y < minY) {
|
7794 | minY = y;
|
7795 | }
|
7796 |
|
7797 | if (y > maxY) {
|
7798 | maxY = y;
|
7799 | }
|
7800 | });
|
7801 |
|
7802 | var halfWidth = lineWidth / 2;
|
7803 | return {
|
7804 | minX: minX - halfWidth,
|
7805 | minY: minY - halfWidth,
|
7806 | maxX: maxX + halfWidth,
|
7807 | maxY: maxY + halfWidth
|
7808 | };
|
7809 | },
|
7810 | __setTcache: function __setTcache() {
|
7811 | var self = this;
|
7812 | var attrs = self.__attrs;
|
7813 | var points = attrs.points;
|
7814 | var totalLength = 0;
|
7815 | var tempLength = 0;
|
7816 | var tCache = [];
|
7817 | var segmentT = void 0;
|
7818 | var segmentL = void 0;
|
7819 | if (!points || points.length === 0) {
|
7820 | return;
|
7821 | }
|
7822 |
|
7823 | Util.each(points, function (p, i) {
|
7824 | if (points[i + 1]) {
|
7825 | totalLength += LineMath.len(p[0], p[1], points[i + 1][0], points[i + 1][1]);
|
7826 | }
|
7827 | });
|
7828 | if (totalLength <= 0) {
|
7829 | return;
|
7830 | }
|
7831 | Util.each(points, function (p, i) {
|
7832 | if (points[i + 1]) {
|
7833 | segmentT = [];
|
7834 | segmentT[0] = tempLength / totalLength;
|
7835 | segmentL = LineMath.len(p[0], p[1], points[i + 1][0], points[i + 1][1]);
|
7836 | tempLength += segmentL;
|
7837 | segmentT[1] = tempLength / totalLength;
|
7838 | tCache.push(segmentT);
|
7839 | }
|
7840 | });
|
7841 | this.tCache = tCache;
|
7842 | },
|
7843 | isPointInPath: function isPointInPath(x, y) {
|
7844 | var self = this;
|
7845 | var attrs = self.__attrs;
|
7846 | if (self.hasStroke()) {
|
7847 | var points = attrs.points;
|
7848 | if (points.length < 2) {
|
7849 | return false;
|
7850 | }
|
7851 | var lineWidth = attrs.lineWidth;
|
7852 | return Inside.polyline(points, lineWidth, x, y);
|
7853 | }
|
7854 | return false;
|
7855 | },
|
7856 | createPath: function createPath(context) {
|
7857 | var self = this;
|
7858 | var attrs = self.__attrs;
|
7859 | var points = attrs.points;
|
7860 | var l = void 0;
|
7861 | var i = void 0;
|
7862 |
|
7863 | if (points.length < 2) {
|
7864 | return;
|
7865 | }
|
7866 | context = context || self.get('context');
|
7867 | context.beginPath();
|
7868 |
|
7869 | Arrow.addStartArrow(context, attrs, points[1][0], points[1][1], points[0][0], points[0][1]);
|
7870 | context.moveTo(points[0][0], points[0][1]);
|
7871 | for (i = 1, l = points.length - 1; i < l; i++) {
|
7872 | context.lineTo(points[i][0], points[i][1]);
|
7873 | }
|
7874 | context.lineTo(points[l][0], points[l][1]);
|
7875 | Arrow.addEndArrow(context, attrs, points[l - 1][0], points[l - 1][1], points[l][0], points[l][1]);
|
7876 | },
|
7877 | getPoint: function getPoint(t) {
|
7878 | var attrs = this.__attrs;
|
7879 | var points = attrs.points;
|
7880 | var tCache = this.tCache;
|
7881 | var subt = void 0;
|
7882 | var index = void 0;
|
7883 | if (!tCache) {
|
7884 | this.__setTcache();
|
7885 | tCache = this.tCache;
|
7886 | }
|
7887 | Util.each(tCache, function (v, i) {
|
7888 | if (t >= v[0] && t <= v[1]) {
|
7889 | subt = (t - v[0]) / (v[1] - v[0]);
|
7890 | index = i;
|
7891 | }
|
7892 | });
|
7893 | return {
|
7894 | x: LineMath.at(points[index][0], points[index + 1][0], subt),
|
7895 | y: LineMath.at(points[index][1], points[index + 1][1], subt)
|
7896 | };
|
7897 | }
|
7898 | });
|
7899 |
|
7900 | module.exports = Polyline;
|
7901 |
|
7902 |
|
7903 | },
|
7904 |
|
7905 | function (module, exports, __webpack_require__) {
|
7906 |
|
7907 | var Util = __webpack_require__(0);
|
7908 | var Shape = __webpack_require__(1);
|
7909 | var Inside = __webpack_require__(2);
|
7910 | var ArcMath = __webpack_require__(54);
|
7911 | var Arrow = __webpack_require__(15);
|
7912 |
|
7913 | function _getArcX(x, radius, angle) {
|
7914 | return x + radius * Math.cos(angle);
|
7915 | }
|
7916 | function _getArcY(y, radius, angle) {
|
7917 | return y + radius * Math.sin(angle);
|
7918 | }
|
7919 |
|
7920 | var Arc = function Arc(cfg) {
|
7921 | Arc.superclass.constructor.call(this, cfg);
|
7922 | };
|
7923 |
|
7924 | Arc.ATTRS = {
|
7925 | x: 0,
|
7926 | y: 0,
|
7927 | r: 0,
|
7928 | startAngle: 0,
|
7929 | endAngle: 0,
|
7930 | clockwise: false,
|
7931 | lineWidth: 1,
|
7932 | startArrow: false,
|
7933 | endArrow: false
|
7934 | };
|
7935 |
|
7936 | Util.extend(Arc, Shape);
|
7937 |
|
7938 | Util.augment(Arc, {
|
7939 | canStroke: true,
|
7940 | type: 'arc',
|
7941 | getDefaultAttrs: function getDefaultAttrs() {
|
7942 | return {
|
7943 | x: 0,
|
7944 | y: 0,
|
7945 | r: 0,
|
7946 | startAngle: 0,
|
7947 | endAngle: 0,
|
7948 | clockwise: false,
|
7949 | lineWidth: 1,
|
7950 | startArrow: false,
|
7951 | endArrow: false
|
7952 | };
|
7953 | },
|
7954 | calculateBox: function calculateBox() {
|
7955 | var attrs = this.__attrs;
|
7956 | var x = attrs.x,
|
7957 | y = attrs.y,
|
7958 | r = attrs.r,
|
7959 | startAngle = attrs.startAngle,
|
7960 | endAngle = attrs.endAngle,
|
7961 | clockwise = attrs.clockwise,
|
7962 | lineWidth = attrs.lineWidth;
|
7963 |
|
7964 | var halfWidth = lineWidth / 2;
|
7965 | var box = ArcMath.box(x, y, r, startAngle, endAngle, clockwise);
|
7966 | box.minX -= halfWidth;
|
7967 | box.minY -= halfWidth;
|
7968 | box.maxX += halfWidth;
|
7969 | box.maxY += halfWidth;
|
7970 | return box;
|
7971 | },
|
7972 | isPointInPath: function isPointInPath(x, y) {
|
7973 | var attrs = this.__attrs;
|
7974 | var cx = attrs.x;
|
7975 | var cy = attrs.y;
|
7976 | var r = attrs.r,
|
7977 | startAngle = attrs.startAngle,
|
7978 | endAngle = attrs.endAngle,
|
7979 | clockwise = attrs.clockwise,
|
7980 | lineWidth = attrs.lineWidth;
|
7981 |
|
7982 | if (this.hasStroke()) {
|
7983 | return Inside.arcline(cx, cy, r, startAngle, endAngle, clockwise, lineWidth, x, y);
|
7984 | }
|
7985 | return false;
|
7986 | },
|
7987 | createPath: function createPath(context) {
|
7988 | var attrs = this.__attrs;
|
7989 | var x = attrs.x,
|
7990 | y = attrs.y,
|
7991 | r = attrs.r,
|
7992 | startAngle = attrs.startAngle,
|
7993 | endAngle = attrs.endAngle,
|
7994 | clockwise = attrs.clockwise;
|
7995 |
|
7996 | var diff = void 0;
|
7997 | var x1 = void 0;
|
7998 | var y1 = void 0;
|
7999 | var x2 = void 0;
|
8000 | var y2 = void 0;
|
8001 |
|
8002 | context = context || self.get('context');
|
8003 | context.beginPath();
|
8004 |
|
8005 | if (attrs.startArrow) {
|
8006 | diff = Math.PI / 180;
|
8007 | if (clockwise) {
|
8008 | diff *= -1;
|
8009 | }
|
8010 |
|
8011 |
|
8012 | x1 = _getArcX(x, r, startAngle + diff);
|
8013 | y1 = _getArcY(y, r, startAngle + diff);
|
8014 | x2 = _getArcX(x, r, startAngle);
|
8015 | y2 = _getArcY(y, r, startAngle);
|
8016 | Arrow.addStartArrow(context, attrs, x1, y1, x2, y2);
|
8017 | }
|
8018 | context.arc(x, y, r, startAngle, endAngle, clockwise);
|
8019 |
|
8020 | if (attrs.endArrow) {
|
8021 | diff = Math.PI / 180;
|
8022 | if (clockwise) {
|
8023 | diff *= -1;
|
8024 | }
|
8025 |
|
8026 |
|
8027 | x1 = _getArcX(x, r, endAngle + diff);
|
8028 | y1 = _getArcY(y, r, endAngle + diff);
|
8029 | x2 = _getArcX(x, r, endAngle);
|
8030 | y2 = _getArcY(y, r, endAngle);
|
8031 | Arrow.addEndArrow(context, attrs, x2, y2, x1, y1);
|
8032 | }
|
8033 | }
|
8034 | });
|
8035 |
|
8036 | module.exports = Arc;
|
8037 |
|
8038 |
|
8039 | },
|
8040 |
|
8041 | function (module, exports, __webpack_require__) {
|
8042 |
|
8043 | var Util = __webpack_require__(0);
|
8044 | var Shape = __webpack_require__(1);
|
8045 | var Inside = __webpack_require__(2);
|
8046 | var ArcMath = __webpack_require__(54);
|
8047 | var vec2 = __webpack_require__(3).vec2;
|
8048 |
|
8049 | var Fan = function Fan(cfg) {
|
8050 | Fan.superclass.constructor.call(this, cfg);
|
8051 | };
|
8052 |
|
8053 | Fan.ATTRS = {
|
8054 | x: 0,
|
8055 | y: 0,
|
8056 | rs: 0,
|
8057 | re: 0,
|
8058 | startAngle: 0,
|
8059 | endAngle: 0,
|
8060 | clockwise: false,
|
8061 | lineWidth: 1
|
8062 | };
|
8063 |
|
8064 | Util.extend(Fan, Shape);
|
8065 |
|
8066 | Util.augment(Fan, {
|
8067 | canFill: true,
|
8068 | canStroke: true,
|
8069 | type: 'fan',
|
8070 | getDefaultAttrs: function getDefaultAttrs() {
|
8071 | return {
|
8072 | clockwise: false,
|
8073 | lineWidth: 1,
|
8074 | rs: 0,
|
8075 | re: 0
|
8076 | };
|
8077 | },
|
8078 | calculateBox: function calculateBox() {
|
8079 | var self = this;
|
8080 | var attrs = self.__attrs;
|
8081 | var cx = attrs.x;
|
8082 | var cy = attrs.y;
|
8083 | var rs = attrs.rs;
|
8084 | var re = attrs.re;
|
8085 | var startAngle = attrs.startAngle;
|
8086 | var endAngle = attrs.endAngle;
|
8087 | var clockwise = attrs.clockwise;
|
8088 | var lineWidth = attrs.lineWidth;
|
8089 |
|
8090 | var boxs = ArcMath.box(cx, cy, rs, startAngle, endAngle, clockwise);
|
8091 | var boxe = ArcMath.box(cx, cy, re, startAngle, endAngle, clockwise);
|
8092 | var minX = Math.min(boxs.minX, boxe.minX);
|
8093 | var minY = Math.min(boxs.minY, boxe.minY);
|
8094 | var maxX = Math.max(boxs.maxX, boxe.maxX);
|
8095 | var maxY = Math.max(boxs.maxY, boxe.maxY);
|
8096 |
|
8097 | var halfWidth = lineWidth / 2;
|
8098 | return {
|
8099 | minX: minX - halfWidth,
|
8100 | minY: minY - halfWidth,
|
8101 | maxX: maxX + halfWidth,
|
8102 | maxY: maxY + halfWidth
|
8103 | };
|
8104 | },
|
8105 | isPointInPath: function isPointInPath(x, y) {
|
8106 | var fill = this.hasFill();
|
8107 | var stroke = this.hasStroke();
|
8108 |
|
8109 | if (fill && stroke) {
|
8110 | return this.__isPointInFill(x, y) || this.__isPointInStroke(x, y);
|
8111 | }
|
8112 |
|
8113 | if (fill) {
|
8114 | return this.__isPointInFill(x, y);
|
8115 | }
|
8116 |
|
8117 | if (stroke) {
|
8118 | return this.__isPointInStroke(x, y);
|
8119 | }
|
8120 | return false;
|
8121 | },
|
8122 | __isPointInFill: function __isPointInFill(x, y) {
|
8123 | var attrs = this.__attrs;
|
8124 | var cx = attrs.x;
|
8125 | var cy = attrs.y;
|
8126 | var rs = attrs.rs;
|
8127 | var re = attrs.re;
|
8128 | var startAngle = attrs.startAngle;
|
8129 | var endAngle = attrs.endAngle;
|
8130 | var clockwise = attrs.clockwise;
|
8131 | var v1 = [1, 0];
|
8132 | var subv = [x - cx, y - cy];
|
8133 | var angle = vec2.angleTo(v1, subv);
|
8134 |
|
8135 | var angle1 = ArcMath.nearAngle(angle, startAngle, endAngle, clockwise);
|
8136 |
|
8137 | if (Util.isNumberEqual(angle, angle1)) {
|
8138 | var ls = vec2.squaredLength(subv);
|
8139 | if (rs * rs <= ls && ls <= re * re) {
|
8140 | return true;
|
8141 | }
|
8142 | }
|
8143 | return false;
|
8144 | },
|
8145 | __isPointInStroke: function __isPointInStroke(x, y) {
|
8146 | var attrs = this.__attrs;
|
8147 | var cx = attrs.x;
|
8148 | var cy = attrs.y;
|
8149 | var rs = attrs.rs;
|
8150 | var re = attrs.re;
|
8151 | var startAngle = attrs.startAngle;
|
8152 | var endAngle = attrs.endAngle;
|
8153 | var clockwise = attrs.clockwise;
|
8154 | var lineWidth = attrs.lineWidth;
|
8155 |
|
8156 | var ssp = {
|
8157 | x: Math.cos(startAngle) * rs + cx,
|
8158 | y: Math.sin(startAngle) * rs + cy
|
8159 | };
|
8160 | var sep = {
|
8161 | x: Math.cos(startAngle) * re + cx,
|
8162 | y: Math.sin(startAngle) * re + cy
|
8163 | };
|
8164 | var esp = {
|
8165 | x: Math.cos(endAngle) * rs + cx,
|
8166 | y: Math.sin(endAngle) * rs + cy
|
8167 | };
|
8168 | var eep = {
|
8169 | x: Math.cos(endAngle) * re + cx,
|
8170 | y: Math.sin(endAngle) * re + cy
|
8171 | };
|
8172 |
|
8173 | if (Inside.line(ssp.x, ssp.y, sep.x, sep.y, lineWidth, x, y)) {
|
8174 | return true;
|
8175 | }
|
8176 |
|
8177 | if (Inside.line(esp.x, esp.y, eep.x, eep.y, lineWidth, x, y)) {
|
8178 | return true;
|
8179 | }
|
8180 |
|
8181 | if (Inside.arcline(cx, cy, rs, startAngle, endAngle, clockwise, lineWidth, x, y)) {
|
8182 | return true;
|
8183 | }
|
8184 |
|
8185 | if (Inside.arcline(cx, cy, re, startAngle, endAngle, clockwise, lineWidth, x, y)) {
|
8186 | return true;
|
8187 | }
|
8188 |
|
8189 | return false;
|
8190 | },
|
8191 | createPath: function createPath(context) {
|
8192 | var attrs = this.__attrs;
|
8193 | var cx = attrs.x;
|
8194 | var cy = attrs.y;
|
8195 | var rs = attrs.rs;
|
8196 | var re = attrs.re;
|
8197 | var startAngle = attrs.startAngle;
|
8198 | var endAngle = attrs.endAngle;
|
8199 | var clockwise = attrs.clockwise;
|
8200 |
|
8201 | var ssp = {
|
8202 | x: Math.cos(startAngle) * rs + cx,
|
8203 | y: Math.sin(startAngle) * rs + cy
|
8204 | };
|
8205 | var sep = {
|
8206 | x: Math.cos(startAngle) * re + cx,
|
8207 | y: Math.sin(startAngle) * re + cy
|
8208 | };
|
8209 | var esp = {
|
8210 | x: Math.cos(endAngle) * rs + cx,
|
8211 | y: Math.sin(endAngle) * rs + cy
|
8212 | };
|
8213 |
|
8214 | context = context || self.get('context');
|
8215 | context.beginPath();
|
8216 | context.moveTo(ssp.x, ssp.y);
|
8217 | context.lineTo(sep.x, sep.y);
|
8218 | context.arc(cx, cy, re, startAngle, endAngle, clockwise);
|
8219 | context.lineTo(esp.x, esp.y);
|
8220 | context.arc(cx, cy, rs, endAngle, startAngle, !clockwise);
|
8221 | context.closePath();
|
8222 | }
|
8223 | });
|
8224 |
|
8225 | module.exports = Fan;
|
8226 |
|
8227 |
|
8228 | },
|
8229 |
|
8230 | function (module, exports, __webpack_require__) {
|
8231 |
|
8232 | var Util = __webpack_require__(0);
|
8233 | var Shape = __webpack_require__(1);
|
8234 | var Inside = __webpack_require__(2);
|
8235 | var Arrow = __webpack_require__(15);
|
8236 | var CubicMath = __webpack_require__(30);
|
8237 |
|
8238 | var Cubic = function Cubic(cfg) {
|
8239 | Cubic.superclass.constructor.call(this, cfg);
|
8240 | };
|
8241 |
|
8242 | Cubic.ATTRS = {
|
8243 | p1: null,
|
8244 | p2: null,
|
8245 | p3: null,
|
8246 | p4: null,
|
8247 | lineWidth: 1,
|
8248 | startArrow: false,
|
8249 | endArrow: false
|
8250 | };
|
8251 |
|
8252 | Util.extend(Cubic, Shape);
|
8253 |
|
8254 | Util.augment(Cubic, {
|
8255 | canStroke: true,
|
8256 | type: 'cubic',
|
8257 | getDefaultAttrs: function getDefaultAttrs() {
|
8258 | return {
|
8259 | lineWidth: 1,
|
8260 | startArrow: false,
|
8261 | endArrow: false
|
8262 | };
|
8263 | },
|
8264 | calculateBox: function calculateBox() {
|
8265 | var attrs = this.__attrs;
|
8266 | var p1 = attrs.p1,
|
8267 | p2 = attrs.p2,
|
8268 | p3 = attrs.p3,
|
8269 | p4 = attrs.p4,
|
8270 | lineWidth = attrs.lineWidth;
|
8271 |
|
8272 | var i = void 0;
|
8273 | var l = void 0;
|
8274 |
|
8275 | if (Util.isNil(p1) || Util.isNil(p2) || Util.isNil(p3) || Util.isNil(p4)) {
|
8276 | return null;
|
8277 | }
|
8278 | var halfWidth = lineWidth / 2;
|
8279 |
|
8280 | var xDim = CubicMath.extrema(p1[0], p2[0], p3[0], p4[0]);
|
8281 | for (i = 0, l = xDim.length; i < l; i++) {
|
8282 | xDim[i] = CubicMath.at(p1[0], p2[0], p3[0], p4[0], xDim[i]);
|
8283 | }
|
8284 | var yDim = CubicMath.extrema(p1[1], p2[1], p3[1], p4[1]);
|
8285 | for (i = 0, l = yDim.length; i < l; i++) {
|
8286 | yDim[i] = CubicMath.at(p1[1], p2[1], p3[1], p4[1], yDim[i]);
|
8287 | }
|
8288 | xDim.push(p1[0], p4[0]);
|
8289 | yDim.push(p1[1], p4[1]);
|
8290 |
|
8291 | return {
|
8292 | minX: Math.min.apply(Math, xDim) - halfWidth,
|
8293 | maxX: Math.max.apply(Math, xDim) + halfWidth,
|
8294 | minY: Math.min.apply(Math, yDim) - halfWidth,
|
8295 | maxY: Math.max.apply(Math, yDim) + halfWidth
|
8296 | };
|
8297 | },
|
8298 | isPointInPath: function isPointInPath(x, y) {
|
8299 | var attrs = this.__attrs;
|
8300 | var p1 = attrs.p1,
|
8301 | p2 = attrs.p2,
|
8302 | p3 = attrs.p3,
|
8303 | p4 = attrs.p4,
|
8304 | lineWidth = attrs.lineWidth;
|
8305 |
|
8306 | return Inside.cubicline(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1], p4[0], p4[1], lineWidth, x, y);
|
8307 | },
|
8308 | createPath: function createPath(context) {
|
8309 | var attrs = this.__attrs;
|
8310 | var p1 = attrs.p1,
|
8311 | p2 = attrs.p2,
|
8312 | p3 = attrs.p3,
|
8313 | p4 = attrs.p4;
|
8314 |
|
8315 | context = context || self.get('context');
|
8316 | if (Util.isNil(p1) || Util.isNil(p2) || Util.isNil(p3) || Util.isNil(p4)) {
|
8317 | return;
|
8318 | }
|
8319 |
|
8320 | context.beginPath();
|
8321 |
|
8322 | Arrow.addStartArrow(context, attrs, p2[0], p2[1], p1[0], p1[1]);
|
8323 | context.moveTo(p1[0], p1[1]);
|
8324 | context.bezierCurveTo(p2[0], p2[1], p3[0], p3[1], p4[0], p4[1]);
|
8325 | Arrow.addEndArrow(context, attrs, p3[0], p3[1], p4[0], p4[1]);
|
8326 | },
|
8327 | getPoint: function getPoint(t) {
|
8328 | var attrs = this.__attrs;
|
8329 | return {
|
8330 | x: CubicMath.at(attrs.p4[0], attrs.p3[0], attrs.p2[0], attrs.p1[0], t),
|
8331 | y: CubicMath.at(attrs.p4[1], attrs.p3[1], attrs.p2[1], attrs.p1[1], t)
|
8332 | };
|
8333 | }
|
8334 | });
|
8335 |
|
8336 | module.exports = Cubic;
|
8337 |
|
8338 |
|
8339 | },
|
8340 |
|
8341 | function (module, exports, __webpack_require__) {
|
8342 |
|
8343 | var Util = __webpack_require__(0);
|
8344 | var Shape = __webpack_require__(1);
|
8345 | var Inside = __webpack_require__(2);
|
8346 | var Arrow = __webpack_require__(15);
|
8347 | var QuadraticMath = __webpack_require__(53);
|
8348 |
|
8349 | var Quadratic = function Quadratic(cfg) {
|
8350 | Quadratic.superclass.constructor.call(this, cfg);
|
8351 | };
|
8352 |
|
8353 | Quadratic.ATTRS = {
|
8354 | p1: null,
|
8355 | p2: null,
|
8356 | p3: null,
|
8357 | lineWidth: 1,
|
8358 | startArrow: false,
|
8359 | endArrow: false
|
8360 | };
|
8361 |
|
8362 | Util.extend(Quadratic, Shape);
|
8363 |
|
8364 | Util.augment(Quadratic, {
|
8365 | canStroke: true,
|
8366 | type: 'quadratic',
|
8367 | getDefaultAttrs: function getDefaultAttrs() {
|
8368 | return {
|
8369 | lineWidth: 1,
|
8370 | startArrow: false,
|
8371 | endArrow: false
|
8372 | };
|
8373 | },
|
8374 | calculateBox: function calculateBox() {
|
8375 | var self = this;
|
8376 | var attrs = self.__attrs;
|
8377 | var p1 = attrs.p1,
|
8378 | p2 = attrs.p2,
|
8379 | p3 = attrs.p3,
|
8380 | lineWidth = attrs.lineWidth;
|
8381 |
|
8382 | var i = void 0;
|
8383 | var l = void 0;
|
8384 |
|
8385 | if (Util.isNil(p1) || Util.isNil(p2) || Util.isNil(p3)) {
|
8386 | return null;
|
8387 | }
|
8388 | var halfWidth = lineWidth / 2;
|
8389 | var xDims = QuadraticMath.extrema(p1[0], p2[0], p3[0]);
|
8390 | for (i = 0, l = xDims.length; i < l; i++) {
|
8391 | xDims[i] = QuadraticMath.at(p1[0], p2[0], p3[0], xDims[i]);
|
8392 | }
|
8393 | xDims.push(p1[0], p3[0]);
|
8394 | var yDims = QuadraticMath.extrema(p1[1], p2[1], p3[1]);
|
8395 | for (i = 0, l = yDims.length; i < l; i++) {
|
8396 | yDims[i] = QuadraticMath.at(p1[1], p2[1], p3[1], yDims[i]);
|
8397 | }
|
8398 | yDims.push(p1[1], p3[1]);
|
8399 |
|
8400 | return {
|
8401 | minX: Math.min.apply(Math, xDims) - halfWidth,
|
8402 | maxX: Math.max.apply(Math, xDims) + halfWidth,
|
8403 | minY: Math.min.apply(Math, yDims) - halfWidth,
|
8404 | maxY: Math.max.apply(Math, yDims) + halfWidth
|
8405 | };
|
8406 | },
|
8407 | isPointInPath: function isPointInPath(x, y) {
|
8408 | var self = this;
|
8409 | var attrs = self.__attrs;
|
8410 | var p1 = attrs.p1,
|
8411 | p2 = attrs.p2,
|
8412 | p3 = attrs.p3,
|
8413 | lineWidth = attrs.lineWidth;
|
8414 |
|
8415 | return Inside.quadraticline(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1], lineWidth, x, y);
|
8416 | },
|
8417 | createPath: function createPath(context) {
|
8418 | var self = this;
|
8419 | var attrs = self.__attrs;
|
8420 | var p1 = attrs.p1,
|
8421 | p2 = attrs.p2,
|
8422 | p3 = attrs.p3;
|
8423 |
|
8424 | if (Util.isNil(p1) || Util.isNil(p2) || Util.isNil(p3)) {
|
8425 | return;
|
8426 | }
|
8427 | context = context || self.get('context');
|
8428 | context.beginPath();
|
8429 |
|
8430 | Arrow.addStartArrow(context, attrs, p2[0], p2[1], p1[0], p1[1]);
|
8431 | context.moveTo(p1[0], p1[1]);
|
8432 | context.quadraticCurveTo(p2[0], p2[1], p3[0], p3[1]);
|
8433 | Arrow.addEndArrow(context, attrs, p2[0], p2[1], p3[0], p3[1]);
|
8434 | },
|
8435 | getPoint: function getPoint(t) {
|
8436 | var attrs = this.__attrs;
|
8437 | return {
|
8438 | x: QuadraticMath.at(attrs.p1[0], attrs.p2[0], attrs.p3[0], t),
|
8439 | y: QuadraticMath.at(attrs.p1[1], attrs.p2[1], attrs.p3[1], t)
|
8440 | };
|
8441 | }
|
8442 | });
|
8443 |
|
8444 | module.exports = Quadratic;
|
8445 |
|
8446 |
|
8447 | },
|
8448 |
|
8449 | function (module, exports, __webpack_require__) {
|
8450 |
|
8451 | var Util = __webpack_require__(0);
|
8452 | var Shape = __webpack_require__(1);
|
8453 | var Inside = __webpack_require__(2);
|
8454 |
|
8455 | var Marker = function Marker(cfg) {
|
8456 | Marker.superclass.constructor.call(this, cfg);
|
8457 | };
|
8458 |
|
8459 | Marker.Symbols = {
|
8460 |
|
8461 | circle: function circle(x, y, r, ctx) {
|
8462 | ctx.arc(x, y, r, 0, Math.PI * 2, false);
|
8463 | },
|
8464 |
|
8465 |
|
8466 | square: function square(x, y, r, ctx) {
|
8467 | ctx.moveTo(x - r, y - r);
|
8468 | ctx.lineTo(x + r, y - r);
|
8469 | ctx.lineTo(x + r, y + r);
|
8470 | ctx.lineTo(x - r, y + r);
|
8471 | ctx.closePath();
|
8472 | },
|
8473 |
|
8474 |
|
8475 | diamond: function diamond(x, y, r, ctx) {
|
8476 | ctx.moveTo(x - r, y);
|
8477 | ctx.lineTo(x, y - r);
|
8478 | ctx.lineTo(x + r, y);
|
8479 | ctx.lineTo(x, y + r);
|
8480 | ctx.closePath();
|
8481 | },
|
8482 |
|
8483 |
|
8484 | triangle: function triangle(x, y, r, ctx) {
|
8485 | var diffY = r * Math.sin(1 / 3 * Math.PI);
|
8486 | ctx.moveTo(x - r, y + diffY);
|
8487 | ctx.lineTo(x, y - diffY);
|
8488 | ctx.lineTo(x + r, y + diffY);
|
8489 | ctx.closePath();
|
8490 | },
|
8491 |
|
8492 |
|
8493 | 'triangle-down': function triangleDown(x, y, r, ctx) {
|
8494 | var diffY = r * Math.sin(1 / 3 * Math.PI);
|
8495 | ctx.moveTo(x - r, y - diffY);
|
8496 | ctx.lineTo(x + r, y - diffY);
|
8497 | ctx.lineTo(x, y + diffY);
|
8498 | ctx.closePath();
|
8499 | }
|
8500 | };
|
8501 |
|
8502 | Marker.ATTRS = {
|
8503 | path: null,
|
8504 | lineWidth: 1
|
8505 | };
|
8506 |
|
8507 | Util.extend(Marker, Shape);
|
8508 |
|
8509 | Util.augment(Marker, {
|
8510 | type: 'marker',
|
8511 | canFill: true,
|
8512 | canStroke: true,
|
8513 | getDefaultAttrs: function getDefaultAttrs() {
|
8514 | return {
|
8515 | x: 0,
|
8516 | y: 0,
|
8517 | lineWidth: 1
|
8518 | };
|
8519 | },
|
8520 | calculateBox: function calculateBox() {
|
8521 | var attrs = this.__attrs;
|
8522 | var cx = attrs.x;
|
8523 | var cy = attrs.y;
|
8524 | var r = attrs.radius;
|
8525 | var lineWidth = attrs.lineWidth;
|
8526 | var halfWidth = lineWidth / 2 + r;
|
8527 | return {
|
8528 | minX: cx - halfWidth,
|
8529 | minY: cy - halfWidth,
|
8530 | maxX: cx + halfWidth,
|
8531 | maxY: cy + halfWidth
|
8532 | };
|
8533 | },
|
8534 | isPointInPath: function isPointInPath(x, y) {
|
8535 | var attrs = this.__attrs;
|
8536 | var cx = attrs.x;
|
8537 | var cy = attrs.y;
|
8538 | var r = attrs.radius;
|
8539 | return Inside.circle(cx, cy, r, x, y);
|
8540 | },
|
8541 | createPath: function createPath(context) {
|
8542 | var attrs = this.__attrs;
|
8543 | var x = attrs.x;
|
8544 | var y = attrs.y;
|
8545 | var r = attrs.radius;
|
8546 | var symbol = attrs.symbol || 'circle';
|
8547 | var method = void 0;
|
8548 | if (Util.isFunction(symbol)) {
|
8549 | method = symbol;
|
8550 | } else {
|
8551 | method = Marker.Symbols[symbol];
|
8552 | }
|
8553 | context.beginPath();
|
8554 | method(x, y, r, context, this);
|
8555 | }
|
8556 | });
|
8557 |
|
8558 | module.exports = Marker;
|
8559 |
|
8560 |
|
8561 | },
|
8562 |
|
8563 | function (module, exports, __webpack_require__) {
|
8564 |
|
8565 | module.exports = {
|
8566 | Canvas: __webpack_require__(113),
|
8567 | Group: __webpack_require__(87),
|
8568 | Shape: __webpack_require__(1),
|
8569 | Rect: __webpack_require__(98),
|
8570 | Circle: __webpack_require__(99),
|
8571 | Ellipse: __webpack_require__(100),
|
8572 | Path: __webpack_require__(101),
|
8573 | Text: __webpack_require__(102),
|
8574 | Line: __webpack_require__(103),
|
8575 | Image: __webpack_require__(104),
|
8576 | Polygon: __webpack_require__(105),
|
8577 | Polyline: __webpack_require__(106),
|
8578 | Arc: __webpack_require__(107),
|
8579 | Fan: __webpack_require__(108),
|
8580 | Cubic: __webpack_require__(109),
|
8581 | Quadratic: __webpack_require__(110),
|
8582 | Marker: __webpack_require__(111),
|
8583 | PathUtil: __webpack_require__(46),
|
8584 | MatrixUtil: __webpack_require__(3),
|
8585 | DomUtil: __webpack_require__(85),
|
8586 | Event: __webpack_require__(86)
|
8587 | };
|
8588 |
|
8589 |
|
8590 | },
|
8591 |
|
8592 | function (module, exports, __webpack_require__) {
|
8593 |
|
8594 | var Util = __webpack_require__(0);
|
8595 | var Event = __webpack_require__(86);
|
8596 | var Group = __webpack_require__(87);
|
8597 |
|
8598 | function requestAnimationFrame(fn) {
|
8599 | var method = window.requestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {
|
8600 | return setTimeout(fn, 16);
|
8601 | };
|
8602 | return method(fn);
|
8603 | }
|
8604 | var Canvas = function Canvas(cfg) {
|
8605 | Canvas.superclass.constructor.call(this, cfg);
|
8606 | };
|
8607 |
|
8608 | Canvas.CFG = {
|
8609 | eventEnable: true,
|
8610 | |
8611 |
|
8612 |
|
8613 |
|
8614 | width: null,
|
8615 | |
8616 |
|
8617 |
|
8618 |
|
8619 | height: null,
|
8620 | |
8621 |
|
8622 |
|
8623 |
|
8624 | widthCanvas: null,
|
8625 | |
8626 |
|
8627 |
|
8628 |
|
8629 | heightCanvas: null,
|
8630 | |
8631 |
|
8632 |
|
8633 |
|
8634 | widthStyle: null,
|
8635 | |
8636 |
|
8637 |
|
8638 |
|
8639 | heightStyle: null,
|
8640 | |
8641 |
|
8642 |
|
8643 |
|
8644 | containerDOM: null,
|
8645 | |
8646 |
|
8647 |
|
8648 |
|
8649 | canvasDOM: null,
|
8650 | |
8651 |
|
8652 |
|
8653 |
|
8654 | pixelRatio: null
|
8655 | };
|
8656 |
|
8657 | Util.extend(Canvas, Group);
|
8658 |
|
8659 | Util.augment(Canvas, {
|
8660 | init: function init() {
|
8661 | Canvas.superclass.init.call(this);
|
8662 | this._setGlobalParam();
|
8663 | this._setDOM();
|
8664 | this._setInitSize();
|
8665 | this._setCanvas();
|
8666 | this._scale();
|
8667 | if (this.get('eventEnable')) {
|
8668 | this._registEvents();
|
8669 | }
|
8670 | },
|
8671 | getEmitter: function getEmitter(element, event) {
|
8672 | if (element) {
|
8673 | if (Util.isEmpty(element._getEvents())) {
|
8674 | var parent = element.get('parent');
|
8675 | if (parent && !event.propagationStopped) {
|
8676 | return this.getEmitter(parent, event);
|
8677 | }
|
8678 | } else {
|
8679 | return element;
|
8680 | }
|
8681 | }
|
8682 | },
|
8683 | _getEventObj: function _getEventObj(type, e, point, target) {
|
8684 | var event = new Event(type, e, true, true);
|
8685 | event.x = point.x;
|
8686 | event.y = point.y;
|
8687 | event.clientX = e.clientX;
|
8688 | event.clientY = e.clientY;
|
8689 | event.currentTarget = target;
|
8690 | event.target = target;
|
8691 | return event;
|
8692 | },
|
8693 | _triggerEvent: function _triggerEvent(type, e) {
|
8694 | var point = this.getPointByClient(e.clientX, e.clientY);
|
8695 | var shape = this.getShape(point.x, point.y);
|
8696 | var emitObj = void 0;
|
8697 | if (type === 'mousemove') {
|
8698 | var canvasmousemove = this._getEventObj('mousemove', e, point, this);
|
8699 | this.emit('mousemove', canvasmousemove);
|
8700 |
|
8701 | var preShape = this.get('preShape');
|
8702 | if (preShape && preShape !== shape) {
|
8703 | var mouseleave = this._getEventObj('mouseleave', e, point, preShape);
|
8704 | emitObj = this.getEmitter(preShape, e);
|
8705 | emitObj && emitObj.emit('mouseleave', mouseleave);
|
8706 | }
|
8707 |
|
8708 | if (shape) {
|
8709 | var mousemove = this._getEventObj('mousemove', e, point, shape);
|
8710 | emitObj = this.getEmitter(shape, e);
|
8711 | emitObj && emitObj.emit('mousemove', mousemove);
|
8712 |
|
8713 | if (preShape !== shape) {
|
8714 | var mouseenter = this._getEventObj('mouseenter', e, point, shape);
|
8715 | emitObj && emitObj.emit('mouseenter', mouseenter, e);
|
8716 | }
|
8717 | }
|
8718 |
|
8719 | this.set('preShape', shape);
|
8720 | } else {
|
8721 | var event = this._getEventObj(type, e, point, shape || this);
|
8722 | emitObj = this.getEmitter(shape, e);
|
8723 | if (emitObj && emitObj !== this) {
|
8724 | emitObj.emit(type, event);
|
8725 | }
|
8726 | this.emit(type, event);
|
8727 | }
|
8728 |
|
8729 | var el = this.get('el');
|
8730 | if (shape && !shape.get('destroyed')) {
|
8731 | el.style.cursor = shape.attr('cursor') || 'default';
|
8732 | }
|
8733 | },
|
8734 | _registEvents: function _registEvents() {
|
8735 | var self = this;
|
8736 | var el = self.get('el');
|
8737 |
|
8738 | el.addEventListener('mouseout', function (e) {
|
8739 | self._triggerEvent('mouseleave', e);
|
8740 | }, false);
|
8741 |
|
8742 | el.addEventListener('mouseover', function (e) {
|
8743 | self._triggerEvent('mouseenter', e);
|
8744 | }, false);
|
8745 |
|
8746 | el.addEventListener('mousemove', function (e) {
|
8747 | self._triggerEvent('mousemove', e);
|
8748 | }, false);
|
8749 |
|
8750 | el.addEventListener('mousedown', function (e) {
|
8751 | self._triggerEvent('mousedown', e);
|
8752 | }, false);
|
8753 |
|
8754 | el.addEventListener('mouseup', function (e) {
|
8755 | self._triggerEvent('mouseup', e);
|
8756 | }, false);
|
8757 |
|
8758 | el.addEventListener('click', function (e) {
|
8759 | self._triggerEvent('click', e);
|
8760 | }, false);
|
8761 |
|
8762 | el.addEventListener('dblclick', function (e) {
|
8763 | self._triggerEvent('dblclick', e);
|
8764 | }, false);
|
8765 |
|
8766 | el.addEventListener('touchstart', function (e) {
|
8767 | if (!Util.isEmpty(e.touches)) {
|
8768 | self._triggerEvent('touchstart', e.touches[0]);
|
8769 | }
|
8770 | }, false);
|
8771 |
|
8772 | el.addEventListener('touchmove', function (e) {
|
8773 | if (!Util.isEmpty(e.touches)) {
|
8774 | self._triggerEvent('touchmove', e.touches[0]);
|
8775 | }
|
8776 | }, false);
|
8777 |
|
8778 | el.addEventListener('touchend', function (e) {
|
8779 | if (!Util.isEmpty(e.changedTouches)) {
|
8780 | self._triggerEvent('touchend', e.changedTouches[0]);
|
8781 | }
|
8782 | }, false);
|
8783 | },
|
8784 | _scale: function _scale() {
|
8785 | var pixelRatio = this.get('pixelRatio');
|
8786 | this.scale(pixelRatio, pixelRatio);
|
8787 | },
|
8788 | _setCanvas: function _setCanvas() {
|
8789 | var canvasDOM = this.get('canvasDOM');
|
8790 | this.set('el', canvasDOM);
|
8791 | this.set('context', canvasDOM.getContext('2d'));
|
8792 | this.set('canvas', this);
|
8793 | },
|
8794 | _setGlobalParam: function _setGlobalParam() {
|
8795 | var pixelRatio = this.get('pixelRatio');
|
8796 | if (!pixelRatio) {
|
8797 | this.set('pixelRatio', Util.getRatio());
|
8798 | }
|
8799 | return;
|
8800 | },
|
8801 | _setDOM: function _setDOM() {
|
8802 | this._setContainer();
|
8803 | this._setLayer();
|
8804 | },
|
8805 | _setContainer: function _setContainer() {
|
8806 | var containerId = this.get('containerId');
|
8807 | var containerDOM = this.get('containerDOM');
|
8808 | if (!containerDOM) {
|
8809 | containerDOM = document.getElementById(containerId);
|
8810 | this.set('containerDOM', containerDOM);
|
8811 | }
|
8812 | Util.modifyCSS(containerDOM, {
|
8813 | position: 'relative'
|
8814 | });
|
8815 | },
|
8816 | _setLayer: function _setLayer() {
|
8817 | var containerDOM = this.get('containerDOM');
|
8818 | var canvasId = Util.uniqueId('canvas_');
|
8819 | if (containerDOM) {
|
8820 | var canvasDOM = Util.createDom('<canvas id="' + canvasId + '"></canvas>');
|
8821 | containerDOM.appendChild(canvasDOM);
|
8822 | this.set('canvasDOM', canvasDOM);
|
8823 | }
|
8824 | },
|
8825 | _setInitSize: function _setInitSize() {
|
8826 | this.changeSize(this.get('width'), this.get('height'));
|
8827 | },
|
8828 | _reSize: function _reSize() {
|
8829 | var canvasDOM = this.get('canvasDOM');
|
8830 | var widthCanvas = this.get('widthCanvas');
|
8831 | var heightCanvas = this.get('heightCanvas');
|
8832 | var widthStyle = this.get('widthStyle');
|
8833 | var heightStyle = this.get('heightStyle');
|
8834 |
|
8835 | canvasDOM.style.width = widthStyle;
|
8836 | canvasDOM.style.height = heightStyle;
|
8837 | canvasDOM.setAttribute('width', widthCanvas);
|
8838 | canvasDOM.setAttribute('height', heightCanvas);
|
8839 | },
|
8840 | getWidth: function getWidth() {
|
8841 | var pixelRatio = this.get('pixelRatio');
|
8842 | var width = this.get('width');
|
8843 | return width * pixelRatio;
|
8844 | },
|
8845 | getHeight: function getHeight() {
|
8846 | var pixelRatio = this.get('pixelRatio');
|
8847 | var height = this.get('height');
|
8848 | return height * pixelRatio;
|
8849 | },
|
8850 | changeSize: function changeSize(width, height) {
|
8851 | var pixelRatio = this.get('pixelRatio');
|
8852 | var widthCanvas = width * pixelRatio;
|
8853 | var heightCanvas = height * pixelRatio;
|
8854 |
|
8855 | this.set('widthCanvas', widthCanvas);
|
8856 | this.set('heightCanvas', heightCanvas);
|
8857 | this.set('widthStyle', width + 'px');
|
8858 | this.set('heightStyle', height + 'px');
|
8859 | this.set('width', width);
|
8860 | this.set('height', height);
|
8861 | this._reSize();
|
8862 | },
|
8863 |
|
8864 | |
8865 |
|
8866 |
|
8867 |
|
8868 |
|
8869 |
|
8870 | getPointByClient: function getPointByClient(clientX, clientY) {
|
8871 | var el = this.get('el');
|
8872 | var bbox = el.getBoundingClientRect();
|
8873 | var width = bbox.right - bbox.left;
|
8874 | var height = bbox.bottom - bbox.top;
|
8875 | return {
|
8876 | x: (clientX - bbox.left) * (el.width / width),
|
8877 | y: (clientY - bbox.top) * (el.height / height)
|
8878 | };
|
8879 | },
|
8880 | getClientByPoint: function getClientByPoint(x, y) {
|
8881 | var el = this.get('el');
|
8882 | var bbox = el.getBoundingClientRect();
|
8883 | var width = bbox.right - bbox.left;
|
8884 | var height = bbox.bottom - bbox.top;
|
8885 | return {
|
8886 | clientX: x / (el.width / width) + bbox.left,
|
8887 | clientY: y / (el.height / height) + bbox.top
|
8888 | };
|
8889 | },
|
8890 | beforeDraw: function beforeDraw() {
|
8891 | var context = this.get('context');
|
8892 | var el = this.get('el');
|
8893 | context && context.clearRect(0, 0, el.width, el.height);
|
8894 | },
|
8895 | _beginDraw: function _beginDraw() {
|
8896 | this.setSilent('toDraw', true);
|
8897 | },
|
8898 | _endDraw: function _endDraw() {
|
8899 | this.setSilent('toDraw', false);
|
8900 | },
|
8901 | draw: function draw() {
|
8902 | var self = this;
|
8903 | function drawInner() {
|
8904 | self.setSilent('animateHandler', requestAnimationFrame(function () {
|
8905 | self.setSilent('animateHandler', undefined);
|
8906 | if (self.get('toDraw')) {
|
8907 | drawInner();
|
8908 | }
|
8909 | }));
|
8910 | self.beforeDraw();
|
8911 | try {
|
8912 | var context = self.get('context');
|
8913 | Canvas.superclass.draw.call(self, context);
|
8914 |
|
8915 | } catch (ev) {
|
8916 |
|
8917 | console.warn('error in draw canvas, detail as:');
|
8918 | console.warn(ev);
|
8919 | self._endDraw();
|
8920 | }
|
8921 | self._endDraw();
|
8922 | }
|
8923 |
|
8924 | if (self.get('destroyed')) {
|
8925 | return;
|
8926 | }
|
8927 | if (self.get('animateHandler')) {
|
8928 | this._beginDraw();
|
8929 | } else {
|
8930 | drawInner();
|
8931 | }
|
8932 | },
|
8933 | destroy: function destroy() {
|
8934 | var containerDOM = this.get('containerDOM');
|
8935 | var canvasDOM = this.get('canvasDOM');
|
8936 | if (canvasDOM && containerDOM) {
|
8937 | containerDOM.removeChild(canvasDOM);
|
8938 | }
|
8939 | Canvas.superclass.destroy.call(this);
|
8940 | }
|
8941 | });
|
8942 |
|
8943 | module.exports = Canvas;
|
8944 |
|
8945 |
|
8946 | },
|
8947 |
|
8948 | function (module, exports) {
|
8949 |
|
8950 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
8951 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
8952 | } : function (obj) {
|
8953 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
8954 | };
|
8955 |
|
8956 | var g;
|
8957 |
|
8958 |
|
8959 | g = function () {
|
8960 | return this;
|
8961 | }();
|
8962 |
|
8963 | try {
|
8964 |
|
8965 | g = g || Function("return this")() || (1, eval)("this");
|
8966 | } catch (e) {
|
8967 |
|
8968 | if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
|
8969 | }
|
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 |
|
8975 | module.exports = g;
|
8976 |
|
8977 |
|
8978 | },
|
8979 |
|
8980 | function (module, exports, __webpack_require__) {
|
8981 |
|
8982 | var _Symbol = __webpack_require__(11);
|
8983 |
|
8984 |
|
8985 | var objectProto = Object.prototype;
|
8986 |
|
8987 |
|
8988 | var hasOwnProperty = objectProto.hasOwnProperty;
|
8989 |
|
8990 | |
8991 |
|
8992 |
|
8993 |
|
8994 |
|
8995 | var nativeObjectToString = objectProto.toString;
|
8996 |
|
8997 |
|
8998 | var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
8999 |
|
9000 | |
9001 |
|
9002 |
|
9003 |
|
9004 |
|
9005 |
|
9006 |
|
9007 | function getRawTag(value) {
|
9008 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
9009 | tag = value[symToStringTag];
|
9010 |
|
9011 | try {
|
9012 | value[symToStringTag] = undefined;
|
9013 | var unmasked = true;
|
9014 | } catch (e) {}
|
9015 |
|
9016 | var result = nativeObjectToString.call(value);
|
9017 | if (unmasked) {
|
9018 | if (isOwn) {
|
9019 | value[symToStringTag] = tag;
|
9020 | } else {
|
9021 | delete value[symToStringTag];
|
9022 | }
|
9023 | }
|
9024 | return result;
|
9025 | }
|
9026 |
|
9027 | module.exports = getRawTag;
|
9028 |
|
9029 |
|
9030 | },
|
9031 |
|
9032 | function (module, exports) {
|
9033 |
|
9034 |
|
9035 | var objectProto = Object.prototype;
|
9036 |
|
9037 | |
9038 |
|
9039 |
|
9040 |
|
9041 |
|
9042 | var nativeObjectToString = objectProto.toString;
|
9043 |
|
9044 | |
9045 |
|
9046 |
|
9047 |
|
9048 |
|
9049 |
|
9050 |
|
9051 | function objectToString(value) {
|
9052 | return nativeObjectToString.call(value);
|
9053 | }
|
9054 |
|
9055 | module.exports = objectToString;
|
9056 |
|
9057 |
|
9058 | },
|
9059 |
|
9060 | function (module, exports, __webpack_require__) {
|
9061 |
|
9062 | var baseGetTag = __webpack_require__(7),
|
9063 | isObjectLike = __webpack_require__(5);
|
9064 |
|
9065 |
|
9066 | var boolTag = '[object Boolean]';
|
9067 |
|
9068 | |
9069 |
|
9070 |
|
9071 |
|
9072 |
|
9073 |
|
9074 |
|
9075 |
|
9076 |
|
9077 |
|
9078 |
|
9079 |
|
9080 |
|
9081 |
|
9082 |
|
9083 |
|
9084 |
|
9085 | function isBoolean(value) {
|
9086 | return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
|
9087 | }
|
9088 |
|
9089 | module.exports = isBoolean;
|
9090 |
|
9091 |
|
9092 | },
|
9093 |
|
9094 | function (module, exports) {
|
9095 |
|
9096 | |
9097 |
|
9098 |
|
9099 |
|
9100 |
|
9101 |
|
9102 |
|
9103 |
|
9104 |
|
9105 |
|
9106 |
|
9107 |
|
9108 |
|
9109 |
|
9110 |
|
9111 |
|
9112 |
|
9113 |
|
9114 |
|
9115 |
|
9116 | function isNil(value) {
|
9117 | return value == null;
|
9118 | }
|
9119 |
|
9120 | module.exports = isNil;
|
9121 |
|
9122 |
|
9123 | },
|
9124 |
|
9125 | function (module, exports, __webpack_require__) {
|
9126 |
|
9127 | var baseGetTag = __webpack_require__(7),
|
9128 | isObjectLike = __webpack_require__(5);
|
9129 |
|
9130 |
|
9131 | var numberTag = '[object Number]';
|
9132 |
|
9133 | |
9134 |
|
9135 |
|
9136 |
|
9137 |
|
9138 |
|
9139 |
|
9140 |
|
9141 |
|
9142 |
|
9143 |
|
9144 |
|
9145 |
|
9146 |
|
9147 |
|
9148 |
|
9149 |
|
9150 |
|
9151 |
|
9152 |
|
9153 |
|
9154 |
|
9155 |
|
9156 |
|
9157 |
|
9158 |
|
9159 | function isNumber(value) {
|
9160 | return typeof value == 'number' || isObjectLike(value) && baseGetTag(value) == numberTag;
|
9161 | }
|
9162 |
|
9163 | module.exports = isNumber;
|
9164 |
|
9165 |
|
9166 | },
|
9167 |
|
9168 | function (module, exports, __webpack_require__) {
|
9169 |
|
9170 | var baseKeys = __webpack_require__(57),
|
9171 | getTag = __webpack_require__(21),
|
9172 | isArguments = __webpack_require__(33),
|
9173 | isArray = __webpack_require__(6),
|
9174 | isArrayLike = __webpack_require__(9),
|
9175 | isBuffer = __webpack_require__(17),
|
9176 | isPrototype = __webpack_require__(16),
|
9177 | isTypedArray = __webpack_require__(22);
|
9178 |
|
9179 |
|
9180 | var mapTag = '[object Map]',
|
9181 | setTag = '[object Set]';
|
9182 |
|
9183 |
|
9184 | var objectProto = Object.prototype;
|
9185 |
|
9186 |
|
9187 | var hasOwnProperty = objectProto.hasOwnProperty;
|
9188 |
|
9189 | |
9190 |
|
9191 |
|
9192 |
|
9193 |
|
9194 |
|
9195 |
|
9196 |
|
9197 |
|
9198 |
|
9199 |
|
9200 |
|
9201 |
|
9202 |
|
9203 |
|
9204 |
|
9205 |
|
9206 |
|
9207 |
|
9208 |
|
9209 |
|
9210 |
|
9211 |
|
9212 |
|
9213 |
|
9214 |
|
9215 |
|
9216 |
|
9217 |
|
9218 |
|
9219 |
|
9220 |
|
9221 |
|
9222 | function isEmpty(value) {
|
9223 | if (value == null) {
|
9224 | return true;
|
9225 | }
|
9226 | if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
9227 | return !value.length;
|
9228 | }
|
9229 | var tag = getTag(value);
|
9230 | if (tag == mapTag || tag == setTag) {
|
9231 | return !value.size;
|
9232 | }
|
9233 | if (isPrototype(value)) {
|
9234 | return !baseKeys(value).length;
|
9235 | }
|
9236 | for (var key in value) {
|
9237 | if (hasOwnProperty.call(value, key)) {
|
9238 | return false;
|
9239 | }
|
9240 | }
|
9241 | return true;
|
9242 | }
|
9243 |
|
9244 | module.exports = isEmpty;
|
9245 |
|
9246 |
|
9247 | },
|
9248 |
|
9249 | function (module, exports, __webpack_require__) {
|
9250 |
|
9251 | var overArg = __webpack_require__(58);
|
9252 |
|
9253 |
|
9254 | var nativeKeys = overArg(Object.keys, Object);
|
9255 |
|
9256 | module.exports = nativeKeys;
|
9257 |
|
9258 |
|
9259 | },
|
9260 |
|
9261 | function (module, exports, __webpack_require__) {
|
9262 |
|
9263 | var getNative = __webpack_require__(10),
|
9264 | root = __webpack_require__(4);
|
9265 |
|
9266 |
|
9267 | var DataView = getNative(root, 'DataView');
|
9268 |
|
9269 | module.exports = DataView;
|
9270 |
|
9271 |
|
9272 | },
|
9273 |
|
9274 | function (module, exports, __webpack_require__) {
|
9275 |
|
9276 | var isFunction = __webpack_require__(20),
|
9277 | isMasked = __webpack_require__(124),
|
9278 | isObject = __webpack_require__(8),
|
9279 | toSource = __webpack_require__(59);
|
9280 |
|
9281 | |
9282 |
|
9283 |
|
9284 |
|
9285 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
9286 |
|
9287 |
|
9288 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
9289 |
|
9290 |
|
9291 | var funcProto = Function.prototype,
|
9292 | objectProto = Object.prototype;
|
9293 |
|
9294 |
|
9295 | var funcToString = funcProto.toString;
|
9296 |
|
9297 |
|
9298 | var hasOwnProperty = objectProto.hasOwnProperty;
|
9299 |
|
9300 |
|
9301 | var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
9302 |
|
9303 | |
9304 |
|
9305 |
|
9306 |
|
9307 |
|
9308 |
|
9309 |
|
9310 |
|
9311 | function baseIsNative(value) {
|
9312 | if (!isObject(value) || isMasked(value)) {
|
9313 | return false;
|
9314 | }
|
9315 | var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
9316 | return pattern.test(toSource(value));
|
9317 | }
|
9318 |
|
9319 | module.exports = baseIsNative;
|
9320 |
|
9321 |
|
9322 | },
|
9323 |
|
9324 | function (module, exports, __webpack_require__) {
|
9325 |
|
9326 | var coreJsData = __webpack_require__(125);
|
9327 |
|
9328 |
|
9329 | var maskSrcKey = function () {
|
9330 | var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
9331 | return uid ? 'Symbol(src)_1.' + uid : '';
|
9332 | }();
|
9333 |
|
9334 | |
9335 |
|
9336 |
|
9337 |
|
9338 |
|
9339 |
|
9340 |
|
9341 | function isMasked(func) {
|
9342 | return !!maskSrcKey && maskSrcKey in func;
|
9343 | }
|
9344 |
|
9345 | module.exports = isMasked;
|
9346 |
|
9347 |
|
9348 | },
|
9349 |
|
9350 | function (module, exports, __webpack_require__) {
|
9351 |
|
9352 | var root = __webpack_require__(4);
|
9353 |
|
9354 |
|
9355 | var coreJsData = root['__core-js_shared__'];
|
9356 |
|
9357 | module.exports = coreJsData;
|
9358 |
|
9359 |
|
9360 | },
|
9361 |
|
9362 | function (module, exports) {
|
9363 |
|
9364 | |
9365 |
|
9366 |
|
9367 |
|
9368 |
|
9369 |
|
9370 |
|
9371 |
|
9372 | function getValue(object, key) {
|
9373 | return object == null ? undefined : object[key];
|
9374 | }
|
9375 |
|
9376 | module.exports = getValue;
|
9377 |
|
9378 |
|
9379 | },
|
9380 |
|
9381 | function (module, exports, __webpack_require__) {
|
9382 |
|
9383 | var getNative = __webpack_require__(10),
|
9384 | root = __webpack_require__(4);
|
9385 |
|
9386 |
|
9387 | var Promise = getNative(root, 'Promise');
|
9388 |
|
9389 | module.exports = Promise;
|
9390 |
|
9391 |
|
9392 | },
|
9393 |
|
9394 | function (module, exports, __webpack_require__) {
|
9395 |
|
9396 | var getNative = __webpack_require__(10),
|
9397 | root = __webpack_require__(4);
|
9398 |
|
9399 |
|
9400 | var Set = getNative(root, 'Set');
|
9401 |
|
9402 | module.exports = Set;
|
9403 |
|
9404 |
|
9405 | },
|
9406 |
|
9407 | function (module, exports, __webpack_require__) {
|
9408 |
|
9409 | var getNative = __webpack_require__(10),
|
9410 | root = __webpack_require__(4);
|
9411 |
|
9412 |
|
9413 | var WeakMap = getNative(root, 'WeakMap');
|
9414 |
|
9415 | module.exports = WeakMap;
|
9416 |
|
9417 |
|
9418 | },
|
9419 |
|
9420 | function (module, exports, __webpack_require__) {
|
9421 |
|
9422 | var baseGetTag = __webpack_require__(7),
|
9423 | isObjectLike = __webpack_require__(5);
|
9424 |
|
9425 |
|
9426 | var argsTag = '[object Arguments]';
|
9427 |
|
9428 | |
9429 |
|
9430 |
|
9431 |
|
9432 |
|
9433 |
|
9434 |
|
9435 | function baseIsArguments(value) {
|
9436 | return isObjectLike(value) && baseGetTag(value) == argsTag;
|
9437 | }
|
9438 |
|
9439 | module.exports = baseIsArguments;
|
9440 |
|
9441 |
|
9442 | },
|
9443 |
|
9444 | function (module, exports) {
|
9445 |
|
9446 | |
9447 |
|
9448 |
|
9449 |
|
9450 |
|
9451 |
|
9452 |
|
9453 |
|
9454 |
|
9455 |
|
9456 |
|
9457 |
|
9458 |
|
9459 | function stubFalse() {
|
9460 | return false;
|
9461 | }
|
9462 |
|
9463 | module.exports = stubFalse;
|
9464 |
|
9465 |
|
9466 | },
|
9467 |
|
9468 | function (module, exports, __webpack_require__) {
|
9469 |
|
9470 | var baseGetTag = __webpack_require__(7),
|
9471 | isLength = __webpack_require__(60),
|
9472 | isObjectLike = __webpack_require__(5);
|
9473 |
|
9474 |
|
9475 | var argsTag = '[object Arguments]',
|
9476 | arrayTag = '[object Array]',
|
9477 | boolTag = '[object Boolean]',
|
9478 | dateTag = '[object Date]',
|
9479 | errorTag = '[object Error]',
|
9480 | funcTag = '[object Function]',
|
9481 | mapTag = '[object Map]',
|
9482 | numberTag = '[object Number]',
|
9483 | objectTag = '[object Object]',
|
9484 | regexpTag = '[object RegExp]',
|
9485 | setTag = '[object Set]',
|
9486 | stringTag = '[object String]',
|
9487 | weakMapTag = '[object WeakMap]';
|
9488 |
|
9489 | var arrayBufferTag = '[object ArrayBuffer]',
|
9490 | dataViewTag = '[object DataView]',
|
9491 | float32Tag = '[object Float32Array]',
|
9492 | float64Tag = '[object Float64Array]',
|
9493 | int8Tag = '[object Int8Array]',
|
9494 | int16Tag = '[object Int16Array]',
|
9495 | int32Tag = '[object Int32Array]',
|
9496 | uint8Tag = '[object Uint8Array]',
|
9497 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
9498 | uint16Tag = '[object Uint16Array]',
|
9499 | uint32Tag = '[object Uint32Array]';
|
9500 |
|
9501 |
|
9502 | var typedArrayTags = {};
|
9503 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
9504 | typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
|
9505 |
|
9506 | |
9507 |
|
9508 |
|
9509 |
|
9510 |
|
9511 |
|
9512 |
|
9513 | function baseIsTypedArray(value) {
|
9514 | return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
9515 | }
|
9516 |
|
9517 | module.exports = baseIsTypedArray;
|
9518 |
|
9519 |
|
9520 | },
|
9521 |
|
9522 | function (module, exports, __webpack_require__) {
|
9523 |
|
9524 | (function (module) {
|
9525 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
9526 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
9527 | } : function (obj) {
|
9528 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
9529 | };
|
9530 |
|
9531 | var freeGlobal = __webpack_require__(55);
|
9532 |
|
9533 |
|
9534 | var freeExports = (false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
|
9535 |
|
9536 |
|
9537 | var freeModule = freeExports && (false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
|
9538 |
|
9539 |
|
9540 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
9541 |
|
9542 |
|
9543 | var freeProcess = moduleExports && freeGlobal.process;
|
9544 |
|
9545 |
|
9546 | var nodeUtil = function () {
|
9547 | try {
|
9548 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
9549 | } catch (e) {}
|
9550 | }();
|
9551 |
|
9552 | module.exports = nodeUtil;
|
9553 |
|
9554 | }).call(exports, __webpack_require__(34)(module));
|
9555 |
|
9556 |
|
9557 | },
|
9558 |
|
9559 | function (module, exports, __webpack_require__) {
|
9560 |
|
9561 | var toString = __webpack_require__(62);
|
9562 |
|
9563 |
|
9564 | var idCounter = 0;
|
9565 |
|
9566 | |
9567 |
|
9568 |
|
9569 |
|
9570 |
|
9571 |
|
9572 |
|
9573 |
|
9574 |
|
9575 |
|
9576 |
|
9577 |
|
9578 |
|
9579 |
|
9580 |
|
9581 |
|
9582 |
|
9583 | function uniqueId(prefix) {
|
9584 | var id = ++idCounter;
|
9585 | return toString(prefix) + id;
|
9586 | }
|
9587 |
|
9588 | module.exports = uniqueId;
|
9589 |
|
9590 |
|
9591 | },
|
9592 |
|
9593 | function (module, exports, __webpack_require__) {
|
9594 |
|
9595 | var _Symbol = __webpack_require__(11),
|
9596 | arrayMap = __webpack_require__(35),
|
9597 | isArray = __webpack_require__(6),
|
9598 | isSymbol = __webpack_require__(136);
|
9599 |
|
9600 |
|
9601 | var INFINITY = 1 / 0;
|
9602 |
|
9603 |
|
9604 | var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
9605 | symbolToString = symbolProto ? symbolProto.toString : undefined;
|
9606 |
|
9607 | |
9608 |
|
9609 |
|
9610 |
|
9611 |
|
9612 |
|
9613 |
|
9614 |
|
9615 | function baseToString(value) {
|
9616 |
|
9617 | if (typeof value == 'string') {
|
9618 | return value;
|
9619 | }
|
9620 | if (isArray(value)) {
|
9621 |
|
9622 | return arrayMap(value, baseToString) + '';
|
9623 | }
|
9624 | if (isSymbol(value)) {
|
9625 | return symbolToString ? symbolToString.call(value) : '';
|
9626 | }
|
9627 | var result = value + '';
|
9628 | return result == '0' && 1 / value == -INFINITY ? '-0' : result;
|
9629 | }
|
9630 |
|
9631 | module.exports = baseToString;
|
9632 |
|
9633 |
|
9634 | },
|
9635 |
|
9636 | function (module, exports, __webpack_require__) {
|
9637 |
|
9638 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
9639 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
9640 | } : function (obj) {
|
9641 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
9642 | };
|
9643 |
|
9644 | var baseGetTag = __webpack_require__(7),
|
9645 | isObjectLike = __webpack_require__(5);
|
9646 |
|
9647 |
|
9648 | var symbolTag = '[object Symbol]';
|
9649 |
|
9650 | |
9651 |
|
9652 |
|
9653 |
|
9654 |
|
9655 |
|
9656 |
|
9657 |
|
9658 |
|
9659 |
|
9660 |
|
9661 |
|
9662 |
|
9663 |
|
9664 |
|
9665 |
|
9666 |
|
9667 | function isSymbol(value) {
|
9668 | return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
9669 | }
|
9670 |
|
9671 | module.exports = isSymbol;
|
9672 |
|
9673 |
|
9674 | },
|
9675 |
|
9676 | function (module, exports, __webpack_require__) {
|
9677 |
|
9678 | var baseClone = __webpack_require__(138);
|
9679 |
|
9680 |
|
9681 | var CLONE_SYMBOLS_FLAG = 4;
|
9682 |
|
9683 | |
9684 |
|
9685 |
|
9686 |
|
9687 |
|
9688 |
|
9689 |
|
9690 |
|
9691 |
|
9692 |
|
9693 |
|
9694 |
|
9695 |
|
9696 |
|
9697 |
|
9698 |
|
9699 |
|
9700 |
|
9701 |
|
9702 |
|
9703 |
|
9704 |
|
9705 |
|
9706 |
|
9707 |
|
9708 |
|
9709 | function clone(value) {
|
9710 | return baseClone(value, CLONE_SYMBOLS_FLAG);
|
9711 | }
|
9712 |
|
9713 | module.exports = clone;
|
9714 |
|
9715 |
|
9716 | },
|
9717 |
|
9718 | function (module, exports, __webpack_require__) {
|
9719 |
|
9720 | var Stack = __webpack_require__(36),
|
9721 | arrayEach = __webpack_require__(64),
|
9722 | assignValue = __webpack_require__(37),
|
9723 | baseAssign = __webpack_require__(161),
|
9724 | baseAssignIn = __webpack_require__(163),
|
9725 | cloneBuffer = __webpack_require__(68),
|
9726 | copyArray = __webpack_require__(28),
|
9727 | copySymbols = __webpack_require__(166),
|
9728 | copySymbolsIn = __webpack_require__(168),
|
9729 | getAllKeys = __webpack_require__(72),
|
9730 | getAllKeysIn = __webpack_require__(169),
|
9731 | getTag = __webpack_require__(21),
|
9732 | initCloneArray = __webpack_require__(170),
|
9733 | initCloneByTag = __webpack_require__(171),
|
9734 | initCloneObject = __webpack_require__(77),
|
9735 | isArray = __webpack_require__(6),
|
9736 | isBuffer = __webpack_require__(17),
|
9737 | isObject = __webpack_require__(8),
|
9738 | keys = __webpack_require__(13);
|
9739 |
|
9740 |
|
9741 | var CLONE_DEEP_FLAG = 1,
|
9742 | CLONE_FLAT_FLAG = 2,
|
9743 | CLONE_SYMBOLS_FLAG = 4;
|
9744 |
|
9745 |
|
9746 | var argsTag = '[object Arguments]',
|
9747 | arrayTag = '[object Array]',
|
9748 | boolTag = '[object Boolean]',
|
9749 | dateTag = '[object Date]',
|
9750 | errorTag = '[object Error]',
|
9751 | funcTag = '[object Function]',
|
9752 | genTag = '[object GeneratorFunction]',
|
9753 | mapTag = '[object Map]',
|
9754 | numberTag = '[object Number]',
|
9755 | objectTag = '[object Object]',
|
9756 | regexpTag = '[object RegExp]',
|
9757 | setTag = '[object Set]',
|
9758 | stringTag = '[object String]',
|
9759 | symbolTag = '[object Symbol]',
|
9760 | weakMapTag = '[object WeakMap]';
|
9761 |
|
9762 | var arrayBufferTag = '[object ArrayBuffer]',
|
9763 | dataViewTag = '[object DataView]',
|
9764 | float32Tag = '[object Float32Array]',
|
9765 | float64Tag = '[object Float64Array]',
|
9766 | int8Tag = '[object Int8Array]',
|
9767 | int16Tag = '[object Int16Array]',
|
9768 | int32Tag = '[object Int32Array]',
|
9769 | uint8Tag = '[object Uint8Array]',
|
9770 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
9771 | uint16Tag = '[object Uint16Array]',
|
9772 | uint32Tag = '[object Uint32Array]';
|
9773 |
|
9774 |
|
9775 | var cloneableTags = {};
|
9776 | cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
9777 | cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
|
9778 |
|
9779 | |
9780 |
|
9781 |
|
9782 |
|
9783 |
|
9784 |
|
9785 |
|
9786 |
|
9787 |
|
9788 |
|
9789 |
|
9790 |
|
9791 |
|
9792 |
|
9793 |
|
9794 |
|
9795 | function baseClone(value, bitmask, customizer, key, object, stack) {
|
9796 | var result,
|
9797 | isDeep = bitmask & CLONE_DEEP_FLAG,
|
9798 | isFlat = bitmask & CLONE_FLAT_FLAG,
|
9799 | isFull = bitmask & CLONE_SYMBOLS_FLAG;
|
9800 |
|
9801 | if (customizer) {
|
9802 | result = object ? customizer(value, key, object, stack) : customizer(value);
|
9803 | }
|
9804 | if (result !== undefined) {
|
9805 | return result;
|
9806 | }
|
9807 | if (!isObject(value)) {
|
9808 | return value;
|
9809 | }
|
9810 | var isArr = isArray(value);
|
9811 | if (isArr) {
|
9812 | result = initCloneArray(value);
|
9813 | if (!isDeep) {
|
9814 | return copyArray(value, result);
|
9815 | }
|
9816 | } else {
|
9817 | var tag = getTag(value),
|
9818 | isFunc = tag == funcTag || tag == genTag;
|
9819 |
|
9820 | if (isBuffer(value)) {
|
9821 | return cloneBuffer(value, isDeep);
|
9822 | }
|
9823 | if (tag == objectTag || tag == argsTag || isFunc && !object) {
|
9824 | result = isFlat || isFunc ? {} : initCloneObject(value);
|
9825 | if (!isDeep) {
|
9826 | return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
|
9827 | }
|
9828 | } else {
|
9829 | if (!cloneableTags[tag]) {
|
9830 | return object ? value : {};
|
9831 | }
|
9832 | result = initCloneByTag(value, tag, baseClone, isDeep);
|
9833 | }
|
9834 | }
|
9835 |
|
9836 | stack || (stack = new Stack());
|
9837 | var stacked = stack.get(value);
|
9838 | if (stacked) {
|
9839 | return stacked;
|
9840 | }
|
9841 | stack.set(value, result);
|
9842 |
|
9843 | var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
|
9844 |
|
9845 | var props = isArr ? undefined : keysFunc(value);
|
9846 | arrayEach(props || value, function (subValue, key) {
|
9847 | if (props) {
|
9848 | key = subValue;
|
9849 | subValue = value[key];
|
9850 | }
|
9851 |
|
9852 | assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
9853 | });
|
9854 | return result;
|
9855 | }
|
9856 |
|
9857 | module.exports = baseClone;
|
9858 |
|
9859 |
|
9860 | },
|
9861 |
|
9862 | function (module, exports) {
|
9863 |
|
9864 | |
9865 |
|
9866 |
|
9867 |
|
9868 |
|
9869 |
|
9870 |
|
9871 | function listCacheClear() {
|
9872 | this.__data__ = [];
|
9873 | this.size = 0;
|
9874 | }
|
9875 |
|
9876 | module.exports = listCacheClear;
|
9877 |
|
9878 |
|
9879 | },
|
9880 |
|
9881 | function (module, exports, __webpack_require__) {
|
9882 |
|
9883 | var assocIndexOf = __webpack_require__(24);
|
9884 |
|
9885 |
|
9886 | var arrayProto = Array.prototype;
|
9887 |
|
9888 |
|
9889 | var splice = arrayProto.splice;
|
9890 |
|
9891 | |
9892 |
|
9893 |
|
9894 |
|
9895 |
|
9896 |
|
9897 |
|
9898 |
|
9899 |
|
9900 | function listCacheDelete(key) {
|
9901 | var data = this.__data__,
|
9902 | index = assocIndexOf(data, key);
|
9903 |
|
9904 | if (index < 0) {
|
9905 | return false;
|
9906 | }
|
9907 | var lastIndex = data.length - 1;
|
9908 | if (index == lastIndex) {
|
9909 | data.pop();
|
9910 | } else {
|
9911 | splice.call(data, index, 1);
|
9912 | }
|
9913 | --this.size;
|
9914 | return true;
|
9915 | }
|
9916 |
|
9917 | module.exports = listCacheDelete;
|
9918 |
|
9919 |
|
9920 | },
|
9921 |
|
9922 | function (module, exports, __webpack_require__) {
|
9923 |
|
9924 | var assocIndexOf = __webpack_require__(24);
|
9925 |
|
9926 | |
9927 |
|
9928 |
|
9929 |
|
9930 |
|
9931 |
|
9932 |
|
9933 |
|
9934 |
|
9935 | function listCacheGet(key) {
|
9936 | var data = this.__data__,
|
9937 | index = assocIndexOf(data, key);
|
9938 |
|
9939 | return index < 0 ? undefined : data[index][1];
|
9940 | }
|
9941 |
|
9942 | module.exports = listCacheGet;
|
9943 |
|
9944 |
|
9945 | },
|
9946 |
|
9947 | function (module, exports, __webpack_require__) {
|
9948 |
|
9949 | var assocIndexOf = __webpack_require__(24);
|
9950 |
|
9951 | |
9952 |
|
9953 |
|
9954 |
|
9955 |
|
9956 |
|
9957 |
|
9958 |
|
9959 |
|
9960 | function listCacheHas(key) {
|
9961 | return assocIndexOf(this.__data__, key) > -1;
|
9962 | }
|
9963 |
|
9964 | module.exports = listCacheHas;
|
9965 |
|
9966 |
|
9967 | },
|
9968 |
|
9969 | function (module, exports, __webpack_require__) {
|
9970 |
|
9971 | var assocIndexOf = __webpack_require__(24);
|
9972 |
|
9973 | |
9974 |
|
9975 |
|
9976 |
|
9977 |
|
9978 |
|
9979 |
|
9980 |
|
9981 |
|
9982 |
|
9983 | function listCacheSet(key, value) {
|
9984 | var data = this.__data__,
|
9985 | index = assocIndexOf(data, key);
|
9986 |
|
9987 | if (index < 0) {
|
9988 | ++this.size;
|
9989 | data.push([key, value]);
|
9990 | } else {
|
9991 | data[index][1] = value;
|
9992 | }
|
9993 | return this;
|
9994 | }
|
9995 |
|
9996 | module.exports = listCacheSet;
|
9997 |
|
9998 |
|
9999 | },
|
10000 |
|
10001 | function (module, exports, __webpack_require__) {
|
10002 |
|
10003 | var ListCache = __webpack_require__(23);
|
10004 |
|
10005 | |
10006 |
|
10007 |
|
10008 |
|
10009 |
|
10010 |
|
10011 |
|
10012 | function stackClear() {
|
10013 | this.__data__ = new ListCache();
|
10014 | this.size = 0;
|
10015 | }
|
10016 |
|
10017 | module.exports = stackClear;
|
10018 |
|
10019 |
|
10020 | },
|
10021 |
|
10022 | function (module, exports) {
|
10023 |
|
10024 | |
10025 |
|
10026 |
|
10027 |
|
10028 |
|
10029 |
|
10030 |
|
10031 |
|
10032 |
|
10033 | function stackDelete(key) {
|
10034 | var data = this.__data__,
|
10035 | result = data['delete'](key);
|
10036 |
|
10037 | this.size = data.size;
|
10038 | return result;
|
10039 | }
|
10040 |
|
10041 | module.exports = stackDelete;
|
10042 |
|
10043 |
|
10044 | },
|
10045 |
|
10046 | function (module, exports) {
|
10047 |
|
10048 | |
10049 |
|
10050 |
|
10051 |
|
10052 |
|
10053 |
|
10054 |
|
10055 |
|
10056 |
|
10057 | function stackGet(key) {
|
10058 | return this.__data__.get(key);
|
10059 | }
|
10060 |
|
10061 | module.exports = stackGet;
|
10062 |
|
10063 |
|
10064 | },
|
10065 |
|
10066 | function (module, exports) {
|
10067 |
|
10068 | |
10069 |
|
10070 |
|
10071 |
|
10072 |
|
10073 |
|
10074 |
|
10075 |
|
10076 |
|
10077 | function stackHas(key) {
|
10078 | return this.__data__.has(key);
|
10079 | }
|
10080 |
|
10081 | module.exports = stackHas;
|
10082 |
|
10083 |
|
10084 | },
|
10085 |
|
10086 | function (module, exports, __webpack_require__) {
|
10087 |
|
10088 | var ListCache = __webpack_require__(23),
|
10089 | Map = __webpack_require__(32),
|
10090 | MapCache = __webpack_require__(63);
|
10091 |
|
10092 |
|
10093 | var LARGE_ARRAY_SIZE = 200;
|
10094 |
|
10095 | |
10096 |
|
10097 |
|
10098 |
|
10099 |
|
10100 |
|
10101 |
|
10102 |
|
10103 |
|
10104 |
|
10105 | function stackSet(key, value) {
|
10106 | var data = this.__data__;
|
10107 | if (data instanceof ListCache) {
|
10108 | var pairs = data.__data__;
|
10109 | if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
10110 | pairs.push([key, value]);
|
10111 | this.size = ++data.size;
|
10112 | return this;
|
10113 | }
|
10114 | data = this.__data__ = new MapCache(pairs);
|
10115 | }
|
10116 | data.set(key, value);
|
10117 | this.size = data.size;
|
10118 | return this;
|
10119 | }
|
10120 |
|
10121 | module.exports = stackSet;
|
10122 |
|
10123 |
|
10124 | },
|
10125 |
|
10126 | function (module, exports, __webpack_require__) {
|
10127 |
|
10128 | var Hash = __webpack_require__(150),
|
10129 | ListCache = __webpack_require__(23),
|
10130 | Map = __webpack_require__(32);
|
10131 |
|
10132 | |
10133 |
|
10134 |
|
10135 |
|
10136 |
|
10137 |
|
10138 |
|
10139 | function mapCacheClear() {
|
10140 | this.size = 0;
|
10141 | this.__data__ = {
|
10142 | 'hash': new Hash(),
|
10143 | 'map': new (Map || ListCache)(),
|
10144 | 'string': new Hash()
|
10145 | };
|
10146 | }
|
10147 |
|
10148 | module.exports = mapCacheClear;
|
10149 |
|
10150 |
|
10151 | },
|
10152 |
|
10153 | function (module, exports, __webpack_require__) {
|
10154 |
|
10155 | var hashClear = __webpack_require__(151),
|
10156 | hashDelete = __webpack_require__(152),
|
10157 | hashGet = __webpack_require__(153),
|
10158 | hashHas = __webpack_require__(154),
|
10159 | hashSet = __webpack_require__(155);
|
10160 |
|
10161 | |
10162 |
|
10163 |
|
10164 |
|
10165 |
|
10166 |
|
10167 |
|
10168 | function Hash(entries) {
|
10169 | var index = -1,
|
10170 | length = entries == null ? 0 : entries.length;
|
10171 |
|
10172 | this.clear();
|
10173 | while (++index < length) {
|
10174 | var entry = entries[index];
|
10175 | this.set(entry[0], entry[1]);
|
10176 | }
|
10177 | }
|
10178 |
|
10179 |
|
10180 | Hash.prototype.clear = hashClear;
|
10181 | Hash.prototype['delete'] = hashDelete;
|
10182 | Hash.prototype.get = hashGet;
|
10183 | Hash.prototype.has = hashHas;
|
10184 | Hash.prototype.set = hashSet;
|
10185 |
|
10186 | module.exports = Hash;
|
10187 |
|
10188 |
|
10189 | },
|
10190 |
|
10191 | function (module, exports, __webpack_require__) {
|
10192 |
|
10193 | var nativeCreate = __webpack_require__(25);
|
10194 |
|
10195 | |
10196 |
|
10197 |
|
10198 |
|
10199 |
|
10200 |
|
10201 |
|
10202 | function hashClear() {
|
10203 | this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
10204 | this.size = 0;
|
10205 | }
|
10206 |
|
10207 | module.exports = hashClear;
|
10208 |
|
10209 |
|
10210 | },
|
10211 |
|
10212 | function (module, exports) {
|
10213 |
|
10214 | |
10215 |
|
10216 |
|
10217 |
|
10218 |
|
10219 |
|
10220 |
|
10221 |
|
10222 |
|
10223 |
|
10224 | function hashDelete(key) {
|
10225 | var result = this.has(key) && delete this.__data__[key];
|
10226 | this.size -= result ? 1 : 0;
|
10227 | return result;
|
10228 | }
|
10229 |
|
10230 | module.exports = hashDelete;
|
10231 |
|
10232 |
|
10233 | },
|
10234 |
|
10235 | function (module, exports, __webpack_require__) {
|
10236 |
|
10237 | var nativeCreate = __webpack_require__(25);
|
10238 |
|
10239 |
|
10240 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
10241 |
|
10242 |
|
10243 | var objectProto = Object.prototype;
|
10244 |
|
10245 |
|
10246 | var hasOwnProperty = objectProto.hasOwnProperty;
|
10247 |
|
10248 | |
10249 |
|
10250 |
|
10251 |
|
10252 |
|
10253 |
|
10254 |
|
10255 |
|
10256 |
|
10257 | function hashGet(key) {
|
10258 | var data = this.__data__;
|
10259 | if (nativeCreate) {
|
10260 | var result = data[key];
|
10261 | return result === HASH_UNDEFINED ? undefined : result;
|
10262 | }
|
10263 | return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
10264 | }
|
10265 |
|
10266 | module.exports = hashGet;
|
10267 |
|
10268 |
|
10269 | },
|
10270 |
|
10271 | function (module, exports, __webpack_require__) {
|
10272 |
|
10273 | var nativeCreate = __webpack_require__(25);
|
10274 |
|
10275 |
|
10276 | var objectProto = Object.prototype;
|
10277 |
|
10278 |
|
10279 | var hasOwnProperty = objectProto.hasOwnProperty;
|
10280 |
|
10281 | |
10282 |
|
10283 |
|
10284 |
|
10285 |
|
10286 |
|
10287 |
|
10288 |
|
10289 |
|
10290 | function hashHas(key) {
|
10291 | var data = this.__data__;
|
10292 | return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
10293 | }
|
10294 |
|
10295 | module.exports = hashHas;
|
10296 |
|
10297 |
|
10298 | },
|
10299 |
|
10300 | function (module, exports, __webpack_require__) {
|
10301 |
|
10302 | var nativeCreate = __webpack_require__(25);
|
10303 |
|
10304 |
|
10305 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
10306 |
|
10307 | |
10308 |
|
10309 |
|
10310 |
|
10311 |
|
10312 |
|
10313 |
|
10314 |
|
10315 |
|
10316 |
|
10317 | function hashSet(key, value) {
|
10318 | var data = this.__data__;
|
10319 | this.size += this.has(key) ? 0 : 1;
|
10320 | data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
|
10321 | return this;
|
10322 | }
|
10323 |
|
10324 | module.exports = hashSet;
|
10325 |
|
10326 |
|
10327 | },
|
10328 |
|
10329 | function (module, exports, __webpack_require__) {
|
10330 |
|
10331 | var getMapData = __webpack_require__(26);
|
10332 |
|
10333 | |
10334 |
|
10335 |
|
10336 |
|
10337 |
|
10338 |
|
10339 |
|
10340 |
|
10341 |
|
10342 | function mapCacheDelete(key) {
|
10343 | var result = getMapData(this, key)['delete'](key);
|
10344 | this.size -= result ? 1 : 0;
|
10345 | return result;
|
10346 | }
|
10347 |
|
10348 | module.exports = mapCacheDelete;
|
10349 |
|
10350 |
|
10351 | },
|
10352 |
|
10353 | function (module, exports) {
|
10354 |
|
10355 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
10356 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
10357 | } : function (obj) {
|
10358 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
10359 | };
|
10360 |
|
10361 | |
10362 |
|
10363 |
|
10364 |
|
10365 |
|
10366 |
|
10367 |
|
10368 | function isKeyable(value) {
|
10369 | var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
10370 | return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
|
10371 | }
|
10372 |
|
10373 | module.exports = isKeyable;
|
10374 |
|
10375 |
|
10376 | },
|
10377 |
|
10378 | function (module, exports, __webpack_require__) {
|
10379 |
|
10380 | var getMapData = __webpack_require__(26);
|
10381 |
|
10382 | |
10383 |
|
10384 |
|
10385 |
|
10386 |
|
10387 |
|
10388 |
|
10389 |
|
10390 |
|
10391 | function mapCacheGet(key) {
|
10392 | return getMapData(this, key).get(key);
|
10393 | }
|
10394 |
|
10395 | module.exports = mapCacheGet;
|
10396 |
|
10397 |
|
10398 | },
|
10399 |
|
10400 | function (module, exports, __webpack_require__) {
|
10401 |
|
10402 | var getMapData = __webpack_require__(26);
|
10403 |
|
10404 | |
10405 |
|
10406 |
|
10407 |
|
10408 |
|
10409 |
|
10410 |
|
10411 |
|
10412 |
|
10413 | function mapCacheHas(key) {
|
10414 | return getMapData(this, key).has(key);
|
10415 | }
|
10416 |
|
10417 | module.exports = mapCacheHas;
|
10418 |
|
10419 |
|
10420 | },
|
10421 |
|
10422 | function (module, exports, __webpack_require__) {
|
10423 |
|
10424 | var getMapData = __webpack_require__(26);
|
10425 |
|
10426 | |
10427 |
|
10428 |
|
10429 |
|
10430 |
|
10431 |
|
10432 |
|
10433 |
|
10434 |
|
10435 |
|
10436 | function mapCacheSet(key, value) {
|
10437 | var data = getMapData(this, key),
|
10438 | size = data.size;
|
10439 |
|
10440 | data.set(key, value);
|
10441 | this.size += data.size == size ? 0 : 1;
|
10442 | return this;
|
10443 | }
|
10444 |
|
10445 | module.exports = mapCacheSet;
|
10446 |
|
10447 |
|
10448 | },
|
10449 |
|
10450 | function (module, exports, __webpack_require__) {
|
10451 |
|
10452 | var copyObject = __webpack_require__(12),
|
10453 | keys = __webpack_require__(13);
|
10454 |
|
10455 | |
10456 |
|
10457 |
|
10458 |
|
10459 |
|
10460 |
|
10461 |
|
10462 |
|
10463 |
|
10464 | function baseAssign(object, source) {
|
10465 | return object && copyObject(source, keys(source), object);
|
10466 | }
|
10467 |
|
10468 | module.exports = baseAssign;
|
10469 |
|
10470 |
|
10471 | },
|
10472 |
|
10473 | function (module, exports) {
|
10474 |
|
10475 | |
10476 |
|
10477 |
|
10478 |
|
10479 |
|
10480 |
|
10481 |
|
10482 |
|
10483 |
|
10484 | function baseTimes(n, iteratee) {
|
10485 | var index = -1,
|
10486 | result = Array(n);
|
10487 |
|
10488 | while (++index < n) {
|
10489 | result[index] = iteratee(index);
|
10490 | }
|
10491 | return result;
|
10492 | }
|
10493 |
|
10494 | module.exports = baseTimes;
|
10495 |
|
10496 |
|
10497 | },
|
10498 |
|
10499 | function (module, exports, __webpack_require__) {
|
10500 |
|
10501 | var copyObject = __webpack_require__(12),
|
10502 | keysIn = __webpack_require__(27);
|
10503 |
|
10504 | |
10505 |
|
10506 |
|
10507 |
|
10508 |
|
10509 |
|
10510 |
|
10511 |
|
10512 |
|
10513 | function baseAssignIn(object, source) {
|
10514 | return object && copyObject(source, keysIn(source), object);
|
10515 | }
|
10516 |
|
10517 | module.exports = baseAssignIn;
|
10518 |
|
10519 |
|
10520 | },
|
10521 |
|
10522 | function (module, exports, __webpack_require__) {
|
10523 |
|
10524 | var isObject = __webpack_require__(8),
|
10525 | isPrototype = __webpack_require__(16),
|
10526 | nativeKeysIn = __webpack_require__(165);
|
10527 |
|
10528 |
|
10529 | var objectProto = Object.prototype;
|
10530 |
|
10531 |
|
10532 | var hasOwnProperty = objectProto.hasOwnProperty;
|
10533 |
|
10534 | |
10535 |
|
10536 |
|
10537 |
|
10538 |
|
10539 |
|
10540 |
|
10541 | function baseKeysIn(object) {
|
10542 | if (!isObject(object)) {
|
10543 | return nativeKeysIn(object);
|
10544 | }
|
10545 | var isProto = isPrototype(object),
|
10546 | result = [];
|
10547 |
|
10548 | for (var key in object) {
|
10549 | if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
10550 | result.push(key);
|
10551 | }
|
10552 | }
|
10553 | return result;
|
10554 | }
|
10555 |
|
10556 | module.exports = baseKeysIn;
|
10557 |
|
10558 |
|
10559 | },
|
10560 |
|
10561 | function (module, exports) {
|
10562 |
|
10563 | |
10564 |
|
10565 |
|
10566 |
|
10567 |
|
10568 |
|
10569 |
|
10570 |
|
10571 |
|
10572 | function nativeKeysIn(object) {
|
10573 | var result = [];
|
10574 | if (object != null) {
|
10575 | for (var key in Object(object)) {
|
10576 | result.push(key);
|
10577 | }
|
10578 | }
|
10579 | return result;
|
10580 | }
|
10581 |
|
10582 | module.exports = nativeKeysIn;
|
10583 |
|
10584 |
|
10585 | },
|
10586 |
|
10587 | function (module, exports, __webpack_require__) {
|
10588 |
|
10589 | var copyObject = __webpack_require__(12),
|
10590 | getSymbols = __webpack_require__(39);
|
10591 |
|
10592 | |
10593 |
|
10594 |
|
10595 |
|
10596 |
|
10597 |
|
10598 |
|
10599 |
|
10600 | function copySymbols(source, object) {
|
10601 | return copyObject(source, getSymbols(source), object);
|
10602 | }
|
10603 |
|
10604 | module.exports = copySymbols;
|
10605 |
|
10606 |
|
10607 | },
|
10608 |
|
10609 | function (module, exports) {
|
10610 |
|
10611 | |
10612 |
|
10613 |
|
10614 |
|
10615 |
|
10616 |
|
10617 |
|
10618 |
|
10619 |
|
10620 | function arrayFilter(array, predicate) {
|
10621 | var index = -1,
|
10622 | length = array == null ? 0 : array.length,
|
10623 | resIndex = 0,
|
10624 | result = [];
|
10625 |
|
10626 | while (++index < length) {
|
10627 | var value = array[index];
|
10628 | if (predicate(value, index, array)) {
|
10629 | result[resIndex++] = value;
|
10630 | }
|
10631 | }
|
10632 | return result;
|
10633 | }
|
10634 |
|
10635 | module.exports = arrayFilter;
|
10636 |
|
10637 |
|
10638 | },
|
10639 |
|
10640 | function (module, exports, __webpack_require__) {
|
10641 |
|
10642 | var copyObject = __webpack_require__(12),
|
10643 | getSymbolsIn = __webpack_require__(70);
|
10644 |
|
10645 | |
10646 |
|
10647 |
|
10648 |
|
10649 |
|
10650 |
|
10651 |
|
10652 |
|
10653 | function copySymbolsIn(source, object) {
|
10654 | return copyObject(source, getSymbolsIn(source), object);
|
10655 | }
|
10656 |
|
10657 | module.exports = copySymbolsIn;
|
10658 |
|
10659 |
|
10660 | },
|
10661 |
|
10662 | function (module, exports, __webpack_require__) {
|
10663 |
|
10664 | var baseGetAllKeys = __webpack_require__(73),
|
10665 | getSymbolsIn = __webpack_require__(70),
|
10666 | keysIn = __webpack_require__(27);
|
10667 |
|
10668 | |
10669 |
|
10670 |
|
10671 |
|
10672 |
|
10673 |
|
10674 |
|
10675 |
|
10676 | function getAllKeysIn(object) {
|
10677 | return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
10678 | }
|
10679 |
|
10680 | module.exports = getAllKeysIn;
|
10681 |
|
10682 |
|
10683 | },
|
10684 |
|
10685 | function (module, exports) {
|
10686 |
|
10687 |
|
10688 | var objectProto = Object.prototype;
|
10689 |
|
10690 |
|
10691 | var hasOwnProperty = objectProto.hasOwnProperty;
|
10692 |
|
10693 | |
10694 |
|
10695 |
|
10696 |
|
10697 |
|
10698 |
|
10699 |
|
10700 | function initCloneArray(array) {
|
10701 | var length = array.length,
|
10702 | result = array.constructor(length);
|
10703 |
|
10704 |
|
10705 | if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
|
10706 | result.index = array.index;
|
10707 | result.input = array.input;
|
10708 | }
|
10709 | return result;
|
10710 | }
|
10711 |
|
10712 | module.exports = initCloneArray;
|
10713 |
|
10714 |
|
10715 | },
|
10716 |
|
10717 | function (module, exports, __webpack_require__) {
|
10718 |
|
10719 | var cloneArrayBuffer = __webpack_require__(41),
|
10720 | cloneDataView = __webpack_require__(172),
|
10721 | cloneMap = __webpack_require__(173),
|
10722 | cloneRegExp = __webpack_require__(175),
|
10723 | cloneSet = __webpack_require__(176),
|
10724 | cloneSymbol = __webpack_require__(178),
|
10725 | cloneTypedArray = __webpack_require__(76);
|
10726 |
|
10727 |
|
10728 | var boolTag = '[object Boolean]',
|
10729 | dateTag = '[object Date]',
|
10730 | mapTag = '[object Map]',
|
10731 | numberTag = '[object Number]',
|
10732 | regexpTag = '[object RegExp]',
|
10733 | setTag = '[object Set]',
|
10734 | stringTag = '[object String]',
|
10735 | symbolTag = '[object Symbol]';
|
10736 |
|
10737 | var arrayBufferTag = '[object ArrayBuffer]',
|
10738 | dataViewTag = '[object DataView]',
|
10739 | float32Tag = '[object Float32Array]',
|
10740 | float64Tag = '[object Float64Array]',
|
10741 | int8Tag = '[object Int8Array]',
|
10742 | int16Tag = '[object Int16Array]',
|
10743 | int32Tag = '[object Int32Array]',
|
10744 | uint8Tag = '[object Uint8Array]',
|
10745 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
10746 | uint16Tag = '[object Uint16Array]',
|
10747 | uint32Tag = '[object Uint32Array]';
|
10748 |
|
10749 | |
10750 |
|
10751 |
|
10752 |
|
10753 |
|
10754 |
|
10755 |
|
10756 |
|
10757 |
|
10758 |
|
10759 |
|
10760 |
|
10761 |
|
10762 | function initCloneByTag(object, tag, cloneFunc, isDeep) {
|
10763 | var Ctor = object.constructor;
|
10764 | switch (tag) {
|
10765 | case arrayBufferTag:
|
10766 | return cloneArrayBuffer(object);
|
10767 |
|
10768 | case boolTag:
|
10769 | case dateTag:
|
10770 | return new Ctor(+object);
|
10771 |
|
10772 | case dataViewTag:
|
10773 | return cloneDataView(object, isDeep);
|
10774 |
|
10775 | case float32Tag:case float64Tag:
|
10776 | case int8Tag:case int16Tag:case int32Tag:
|
10777 | case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:
|
10778 | return cloneTypedArray(object, isDeep);
|
10779 |
|
10780 | case mapTag:
|
10781 | return cloneMap(object, isDeep, cloneFunc);
|
10782 |
|
10783 | case numberTag:
|
10784 | case stringTag:
|
10785 | return new Ctor(object);
|
10786 |
|
10787 | case regexpTag:
|
10788 | return cloneRegExp(object);
|
10789 |
|
10790 | case setTag:
|
10791 | return cloneSet(object, isDeep, cloneFunc);
|
10792 |
|
10793 | case symbolTag:
|
10794 | return cloneSymbol(object);
|
10795 | }
|
10796 | }
|
10797 |
|
10798 | module.exports = initCloneByTag;
|
10799 |
|
10800 |
|
10801 | },
|
10802 |
|
10803 | function (module, exports, __webpack_require__) {
|
10804 |
|
10805 | var cloneArrayBuffer = __webpack_require__(41);
|
10806 |
|
10807 | |
10808 |
|
10809 |
|
10810 |
|
10811 |
|
10812 |
|
10813 |
|
10814 |
|
10815 | function cloneDataView(dataView, isDeep) {
|
10816 | var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
10817 | return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
10818 | }
|
10819 |
|
10820 | module.exports = cloneDataView;
|
10821 |
|
10822 |
|
10823 | },
|
10824 |
|
10825 | function (module, exports, __webpack_require__) {
|
10826 |
|
10827 | var addMapEntry = __webpack_require__(174),
|
10828 | arrayReduce = __webpack_require__(75),
|
10829 | mapToArray = __webpack_require__(42);
|
10830 |
|
10831 |
|
10832 | var CLONE_DEEP_FLAG = 1;
|
10833 |
|
10834 | |
10835 |
|
10836 |
|
10837 |
|
10838 |
|
10839 |
|
10840 |
|
10841 |
|
10842 |
|
10843 | function cloneMap(map, isDeep, cloneFunc) {
|
10844 | var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
|
10845 | return arrayReduce(array, addMapEntry, new map.constructor());
|
10846 | }
|
10847 |
|
10848 | module.exports = cloneMap;
|
10849 |
|
10850 |
|
10851 | },
|
10852 |
|
10853 | function (module, exports) {
|
10854 |
|
10855 | |
10856 |
|
10857 |
|
10858 |
|
10859 |
|
10860 |
|
10861 |
|
10862 |
|
10863 | function addMapEntry(map, pair) {
|
10864 |
|
10865 | map.set(pair[0], pair[1]);
|
10866 | return map;
|
10867 | }
|
10868 |
|
10869 | module.exports = addMapEntry;
|
10870 |
|
10871 |
|
10872 | },
|
10873 |
|
10874 | function (module, exports) {
|
10875 |
|
10876 |
|
10877 | var reFlags = /\w*$/;
|
10878 |
|
10879 | |
10880 |
|
10881 |
|
10882 |
|
10883 |
|
10884 |
|
10885 |
|
10886 | function cloneRegExp(regexp) {
|
10887 | var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
10888 | result.lastIndex = regexp.lastIndex;
|
10889 | return result;
|
10890 | }
|
10891 |
|
10892 | module.exports = cloneRegExp;
|
10893 |
|
10894 |
|
10895 | },
|
10896 |
|
10897 | function (module, exports, __webpack_require__) {
|
10898 |
|
10899 | var addSetEntry = __webpack_require__(177),
|
10900 | arrayReduce = __webpack_require__(75),
|
10901 | setToArray = __webpack_require__(43);
|
10902 |
|
10903 |
|
10904 | var CLONE_DEEP_FLAG = 1;
|
10905 |
|
10906 | |
10907 |
|
10908 |
|
10909 |
|
10910 |
|
10911 |
|
10912 |
|
10913 |
|
10914 |
|
10915 | function cloneSet(set, isDeep, cloneFunc) {
|
10916 | var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
|
10917 | return arrayReduce(array, addSetEntry, new set.constructor());
|
10918 | }
|
10919 |
|
10920 | module.exports = cloneSet;
|
10921 |
|
10922 | /***/
|
10923 | },
|
10924 | /* 177 */
|
10925 | /***/function (module, exports) {
|
10926 |
|
10927 | |
10928 |
|
10929 |
|
10930 |
|
10931 |
|
10932 |
|
10933 |
|
10934 |
|
10935 | function addSetEntry(set, value) {
|
10936 |
|
10937 | set.add(value);
|
10938 | return set;
|
10939 | }
|
10940 |
|
10941 | module.exports = addSetEntry;
|
10942 |
|
10943 | /***/
|
10944 | },
|
10945 | /* 178 */
|
10946 | /***/function (module, exports, __webpack_require__) {
|
10947 |
|
10948 | var _Symbol = __webpack_require__(11);
|
10949 |
|
10950 |
|
10951 | var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
10952 | symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
10953 |
|
10954 | |
10955 |
|
10956 |
|
10957 |
|
10958 |
|
10959 |
|
10960 |
|
10961 | function cloneSymbol(symbol) {
|
10962 | return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
10963 | }
|
10964 |
|
10965 | module.exports = cloneSymbol;
|
10966 |
|
10967 |
|
10968 | },
|
10969 |
|
10970 | function (module, exports, __webpack_require__) {
|
10971 |
|
10972 | var isObject = __webpack_require__(8);
|
10973 |
|
10974 |
|
10975 | var objectCreate = Object.create;
|
10976 |
|
10977 | |
10978 |
|
10979 |
|
10980 |
|
10981 |
|
10982 |
|
10983 |
|
10984 |
|
10985 | var baseCreate = function () {
|
10986 | function object() {}
|
10987 | return function (proto) {
|
10988 | if (!isObject(proto)) {
|
10989 | return {};
|
10990 | }
|
10991 | if (objectCreate) {
|
10992 | return objectCreate(proto);
|
10993 | }
|
10994 | object.prototype = proto;
|
10995 | var result = new object();
|
10996 | object.prototype = undefined;
|
10997 | return result;
|
10998 | };
|
10999 | }();
|
11000 |
|
11001 | module.exports = baseCreate;
|
11002 |
|
11003 |
|
11004 | },
|
11005 |
|
11006 | function (module, exports, __webpack_require__) {
|
11007 |
|
11008 | var assignValue = __webpack_require__(37),
|
11009 | copyObject = __webpack_require__(12),
|
11010 | createAssigner = __webpack_require__(78),
|
11011 | isArrayLike = __webpack_require__(9),
|
11012 | isPrototype = __webpack_require__(16),
|
11013 | keys = __webpack_require__(13);
|
11014 |
|
11015 |
|
11016 | var objectProto = Object.prototype;
|
11017 |
|
11018 |
|
11019 | var hasOwnProperty = objectProto.hasOwnProperty;
|
11020 |
|
11021 | |
11022 |
|
11023 |
|
11024 |
|
11025 |
|
11026 |
|
11027 |
|
11028 |
|
11029 |
|
11030 |
|
11031 |
|
11032 |
|
11033 |
|
11034 |
|
11035 |
|
11036 |
|
11037 |
|
11038 |
|
11039 |
|
11040 |
|
11041 |
|
11042 |
|
11043 |
|
11044 |
|
11045 |
|
11046 |
|
11047 |
|
11048 |
|
11049 |
|
11050 |
|
11051 |
|
11052 |
|
11053 | var assign = createAssigner(function (object, source) {
|
11054 | if (isPrototype(source) || isArrayLike(source)) {
|
11055 | copyObject(source, keys(source), object);
|
11056 | return;
|
11057 | }
|
11058 | for (var key in source) {
|
11059 | if (hasOwnProperty.call(source, key)) {
|
11060 | assignValue(object, key, source[key]);
|
11061 | }
|
11062 | }
|
11063 | });
|
11064 |
|
11065 | module.exports = assign;
|
11066 |
|
11067 |
|
11068 | },
|
11069 |
|
11070 | function (module, exports, __webpack_require__) {
|
11071 |
|
11072 | var apply = __webpack_require__(182);
|
11073 |
|
11074 |
|
11075 | var nativeMax = Math.max;
|
11076 |
|
11077 | |
11078 |
|
11079 |
|
11080 |
|
11081 |
|
11082 |
|
11083 |
|
11084 |
|
11085 |
|
11086 | function overRest(func, start, transform) {
|
11087 | start = nativeMax(start === undefined ? func.length - 1 : start, 0);
|
11088 | return function () {
|
11089 | var args = arguments,
|
11090 | index = -1,
|
11091 | length = nativeMax(args.length - start, 0),
|
11092 | array = Array(length);
|
11093 |
|
11094 | while (++index < length) {
|
11095 | array[index] = args[start + index];
|
11096 | }
|
11097 | index = -1;
|
11098 | var otherArgs = Array(start + 1);
|
11099 | while (++index < start) {
|
11100 | otherArgs[index] = args[index];
|
11101 | }
|
11102 | otherArgs[start] = transform(array);
|
11103 | return apply(func, this, otherArgs);
|
11104 | };
|
11105 | }
|
11106 |
|
11107 | module.exports = overRest;
|
11108 |
|
11109 |
|
11110 | },
|
11111 |
|
11112 | function (module, exports) {
|
11113 |
|
11114 | |
11115 |
|
11116 |
|
11117 |
|
11118 |
|
11119 |
|
11120 |
|
11121 |
|
11122 |
|
11123 |
|
11124 | function apply(func, thisArg, args) {
|
11125 | switch (args.length) {
|
11126 | case 0:
|
11127 | return func.call(thisArg);
|
11128 | case 1:
|
11129 | return func.call(thisArg, args[0]);
|
11130 | case 2:
|
11131 | return func.call(thisArg, args[0], args[1]);
|
11132 | case 3:
|
11133 | return func.call(thisArg, args[0], args[1], args[2]);
|
11134 | }
|
11135 | return func.apply(thisArg, args);
|
11136 | }
|
11137 |
|
11138 | module.exports = apply;
|
11139 |
|
11140 |
|
11141 | },
|
11142 |
|
11143 | function (module, exports, __webpack_require__) {
|
11144 |
|
11145 | var baseSetToString = __webpack_require__(184),
|
11146 | shortOut = __webpack_require__(186);
|
11147 |
|
11148 | |
11149 |
|
11150 |
|
11151 |
|
11152 |
|
11153 |
|
11154 |
|
11155 |
|
11156 | var setToString = shortOut(baseSetToString);
|
11157 |
|
11158 | module.exports = setToString;
|
11159 |
|
11160 |
|
11161 | },
|
11162 |
|
11163 | function (module, exports, __webpack_require__) {
|
11164 |
|
11165 | var constant = __webpack_require__(185),
|
11166 | defineProperty = __webpack_require__(65),
|
11167 | identity = __webpack_require__(44);
|
11168 |
|
11169 | |
11170 |
|
11171 |
|
11172 |
|
11173 |
|
11174 |
|
11175 |
|
11176 |
|
11177 | var baseSetToString = !defineProperty ? identity : function (func, string) {
|
11178 | return defineProperty(func, 'toString', {
|
11179 | 'configurable': true,
|
11180 | 'enumerable': false,
|
11181 | 'value': constant(string),
|
11182 | 'writable': true
|
11183 | });
|
11184 | };
|
11185 |
|
11186 | module.exports = baseSetToString;
|
11187 |
|
11188 |
|
11189 | },
|
11190 |
|
11191 | function (module, exports) {
|
11192 |
|
11193 | |
11194 |
|
11195 |
|
11196 |
|
11197 |
|
11198 |
|
11199 |
|
11200 |
|
11201 |
|
11202 |
|
11203 |
|
11204 |
|
11205 |
|
11206 |
|
11207 |
|
11208 |
|
11209 |
|
11210 |
|
11211 |
|
11212 | function constant(value) {
|
11213 | return function () {
|
11214 | return value;
|
11215 | };
|
11216 | }
|
11217 |
|
11218 | module.exports = constant;
|
11219 |
|
11220 |
|
11221 | },
|
11222 |
|
11223 | function (module, exports) {
|
11224 |
|
11225 |
|
11226 | var HOT_COUNT = 800,
|
11227 | HOT_SPAN = 16;
|
11228 |
|
11229 |
|
11230 | var nativeNow = Date.now;
|
11231 |
|
11232 | |
11233 |
|
11234 |
|
11235 |
|
11236 |
|
11237 |
|
11238 |
|
11239 |
|
11240 |
|
11241 | function shortOut(func) {
|
11242 | var count = 0,
|
11243 | lastCalled = 0;
|
11244 |
|
11245 | return function () {
|
11246 | var stamp = nativeNow(),
|
11247 | remaining = HOT_SPAN - (stamp - lastCalled);
|
11248 |
|
11249 | lastCalled = stamp;
|
11250 | if (remaining > 0) {
|
11251 | if (++count >= HOT_COUNT) {
|
11252 | return arguments[0];
|
11253 | }
|
11254 | } else {
|
11255 | count = 0;
|
11256 | }
|
11257 | return func.apply(undefined, arguments);
|
11258 | };
|
11259 | }
|
11260 |
|
11261 | module.exports = shortOut;
|
11262 |
|
11263 |
|
11264 | },
|
11265 |
|
11266 | function (module, exports, __webpack_require__) {
|
11267 |
|
11268 | var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
11269 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
11270 | } : function (obj) {
|
11271 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
11272 | };
|
11273 |
|
11274 | var eq = __webpack_require__(18),
|
11275 | isArrayLike = __webpack_require__(9),
|
11276 | isIndex = __webpack_require__(67),
|
11277 | isObject = __webpack_require__(8);
|
11278 |
|
11279 | |
11280 |
|
11281 |
|
11282 |
|
11283 |
|
11284 |
|
11285 |
|
11286 |
|
11287 |
|
11288 |
|
11289 | function isIterateeCall(value, index, object) {
|
11290 | if (!isObject(object)) {
|
11291 | return false;
|
11292 | }
|
11293 | var type = typeof index === 'undefined' ? 'undefined' : _typeof(index);
|
11294 | if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) {
|
11295 | return eq(object[index], value);
|
11296 | }
|
11297 | return false;
|
11298 | }
|
11299 |
|
11300 | module.exports = isIterateeCall;
|
11301 |
|
11302 |
|
11303 | },
|
11304 |
|
11305 | function (module, exports, __webpack_require__) {
|
11306 |
|
11307 | var baseMerge = __webpack_require__(189),
|
11308 | createAssigner = __webpack_require__(78);
|
11309 |
|
11310 | |
11311 |
|
11312 |
|
11313 |
|
11314 |
|
11315 |
|
11316 |
|
11317 |
|
11318 |
|
11319 |
|
11320 |
|
11321 |
|
11322 |
|
11323 |
|
11324 |
|
11325 |
|
11326 |
|
11327 |
|
11328 |
|
11329 |
|
11330 |
|
11331 |
|
11332 |
|
11333 |
|
11334 |
|
11335 |
|
11336 |
|
11337 |
|
11338 |
|
11339 |
|
11340 |
|
11341 | var merge = createAssigner(function (object, source, srcIndex) {
|
11342 | baseMerge(object, source, srcIndex);
|
11343 | });
|
11344 |
|
11345 | module.exports = merge;
|
11346 |
|
11347 |
|
11348 | },
|
11349 |
|
11350 | function (module, exports, __webpack_require__) {
|
11351 |
|
11352 | var Stack = __webpack_require__(36),
|
11353 | assignMergeValue = __webpack_require__(80),
|
11354 | baseFor = __webpack_require__(81),
|
11355 | baseMergeDeep = __webpack_require__(191),
|
11356 | isObject = __webpack_require__(8),
|
11357 | keysIn = __webpack_require__(27);
|
11358 |
|
11359 | |
11360 |
|
11361 |
|
11362 |
|
11363 |
|
11364 |
|
11365 |
|
11366 |
|
11367 |
|
11368 |
|
11369 |
|
11370 | function baseMerge(object, source, srcIndex, customizer, stack) {
|
11371 | if (object === source) {
|
11372 | return;
|
11373 | }
|
11374 | baseFor(source, function (srcValue, key) {
|
11375 | if (isObject(srcValue)) {
|
11376 | stack || (stack = new Stack());
|
11377 | baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
11378 | } else {
|
11379 | var newValue = customizer ? customizer(object[key], srcValue, key + '', object, source, stack) : undefined;
|
11380 |
|
11381 | if (newValue === undefined) {
|
11382 | newValue = srcValue;
|
11383 | }
|
11384 | assignMergeValue(object, key, newValue);
|
11385 | }
|
11386 | }, keysIn);
|
11387 | }
|
11388 |
|
11389 | module.exports = baseMerge;
|
11390 |
|
11391 |
|
11392 | },
|
11393 |
|
11394 | function (module, exports) {
|
11395 |
|
11396 | |
11397 |
|
11398 |
|
11399 |
|
11400 |
|
11401 |
|
11402 |
|
11403 | function createBaseFor(fromRight) {
|
11404 | return function (object, iteratee, keysFunc) {
|
11405 | var index = -1,
|
11406 | iterable = Object(object),
|
11407 | props = keysFunc(object),
|
11408 | length = props.length;
|
11409 |
|
11410 | while (length--) {
|
11411 | var key = props[fromRight ? length : ++index];
|
11412 | if (iteratee(iterable[key], key, iterable) === false) {
|
11413 | break;
|
11414 | }
|
11415 | }
|
11416 | return object;
|
11417 | };
|
11418 | }
|
11419 |
|
11420 | module.exports = createBaseFor;
|
11421 |
|
11422 |
|
11423 | },
|
11424 |
|
11425 | function (module, exports, __webpack_require__) {
|
11426 |
|
11427 | var assignMergeValue = __webpack_require__(80),
|
11428 | cloneBuffer = __webpack_require__(68),
|
11429 | cloneTypedArray = __webpack_require__(76),
|
11430 | copyArray = __webpack_require__(28),
|
11431 | initCloneObject = __webpack_require__(77),
|
11432 | isArguments = __webpack_require__(33),
|
11433 | isArray = __webpack_require__(6),
|
11434 | isArrayLikeObject = __webpack_require__(192),
|
11435 | isBuffer = __webpack_require__(17),
|
11436 | isFunction = __webpack_require__(20),
|
11437 | isObject = __webpack_require__(8),
|
11438 | isPlainObject = __webpack_require__(193),
|
11439 | isTypedArray = __webpack_require__(22),
|
11440 | toPlainObject = __webpack_require__(194);
|
11441 |
|
11442 | |
11443 |
|
11444 |
|
11445 |
|
11446 |
|
11447 |
|
11448 |
|
11449 |
|
11450 |
|
11451 |
|
11452 |
|
11453 |
|
11454 |
|
11455 |
|
11456 |
|
11457 | function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
11458 | var objValue = object[key],
|
11459 | srcValue = source[key],
|
11460 | stacked = stack.get(srcValue);
|
11461 |
|
11462 | if (stacked) {
|
11463 | assignMergeValue(object, key, stacked);
|
11464 | return;
|
11465 | }
|
11466 | var newValue = customizer ? customizer(objValue, srcValue, key + '', object, source, stack) : undefined;
|
11467 |
|
11468 | var isCommon = newValue === undefined;
|
11469 |
|
11470 | if (isCommon) {
|
11471 | var isArr = isArray(srcValue),
|
11472 | isBuff = !isArr && isBuffer(srcValue),
|
11473 | isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
11474 |
|
11475 | newValue = srcValue;
|
11476 | if (isArr || isBuff || isTyped) {
|
11477 | if (isArray(objValue)) {
|
11478 | newValue = objValue;
|
11479 | } else if (isArrayLikeObject(objValue)) {
|
11480 | newValue = copyArray(objValue);
|
11481 | } else if (isBuff) {
|
11482 | isCommon = false;
|
11483 | newValue = cloneBuffer(srcValue, true);
|
11484 | } else if (isTyped) {
|
11485 | isCommon = false;
|
11486 | newValue = cloneTypedArray(srcValue, true);
|
11487 | } else {
|
11488 | newValue = [];
|
11489 | }
|
11490 | } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
11491 | newValue = objValue;
|
11492 | if (isArguments(objValue)) {
|
11493 | newValue = toPlainObject(objValue);
|
11494 | } else if (!isObject(objValue) || srcIndex && isFunction(objValue)) {
|
11495 | newValue = initCloneObject(srcValue);
|
11496 | }
|
11497 | } else {
|
11498 | isCommon = false;
|
11499 | }
|
11500 | }
|
11501 | if (isCommon) {
|
11502 |
|
11503 | stack.set(srcValue, newValue);
|
11504 | mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
11505 | stack['delete'](srcValue);
|
11506 | }
|
11507 | assignMergeValue(object, key, newValue);
|
11508 | }
|
11509 |
|
11510 | module.exports = baseMergeDeep;
|
11511 |
|
11512 |
|
11513 | },
|
11514 |
|
11515 | function (module, exports, __webpack_require__) {
|
11516 |
|
11517 | var isArrayLike = __webpack_require__(9),
|
11518 | isObjectLike = __webpack_require__(5);
|
11519 |
|
11520 | |
11521 |
|
11522 |
|
11523 |
|
11524 |
|
11525 |
|
11526 |
|
11527 |
|
11528 |
|
11529 |
|
11530 |
|
11531 |
|
11532 |
|
11533 |
|
11534 |
|
11535 |
|
11536 |
|
11537 |
|
11538 |
|
11539 |
|
11540 |
|
11541 |
|
11542 |
|
11543 |
|
11544 |
|
11545 | function isArrayLikeObject(value) {
|
11546 | return isObjectLike(value) && isArrayLike(value);
|
11547 | }
|
11548 |
|
11549 | module.exports = isArrayLikeObject;
|
11550 |
|
11551 |
|
11552 | },
|
11553 |
|
11554 | function (module, exports, __webpack_require__) {
|
11555 |
|
11556 | var baseGetTag = __webpack_require__(7),
|
11557 | getPrototype = __webpack_require__(40),
|
11558 | isObjectLike = __webpack_require__(5);
|
11559 |
|
11560 |
|
11561 | var objectTag = '[object Object]';
|
11562 |
|
11563 |
|
11564 | var funcProto = Function.prototype,
|
11565 | objectProto = Object.prototype;
|
11566 |
|
11567 |
|
11568 | var funcToString = funcProto.toString;
|
11569 |
|
11570 |
|
11571 | var hasOwnProperty = objectProto.hasOwnProperty;
|
11572 |
|
11573 |
|
11574 | var objectCtorString = funcToString.call(Object);
|
11575 |
|
11576 | |
11577 |
|
11578 |
|
11579 |
|
11580 |
|
11581 |
|
11582 |
|
11583 |
|
11584 |
|
11585 |
|
11586 |
|
11587 |
|
11588 |
|
11589 |
|
11590 |
|
11591 |
|
11592 |
|
11593 |
|
11594 |
|
11595 |
|
11596 |
|
11597 |
|
11598 |
|
11599 |
|
11600 |
|
11601 |
|
11602 |
|
11603 |
|
11604 | function isPlainObject(value) {
|
11605 | if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
11606 | return false;
|
11607 | }
|
11608 | var proto = getPrototype(value);
|
11609 | if (proto === null) {
|
11610 | return true;
|
11611 | }
|
11612 | var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
11613 | return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
11614 | }
|
11615 |
|
11616 | module.exports = isPlainObject;
|
11617 |
|
11618 |
|
11619 | },
|
11620 |
|
11621 | function (module, exports, __webpack_require__) {
|
11622 |
|
11623 | var copyObject = __webpack_require__(12),
|
11624 | keysIn = __webpack_require__(27);
|
11625 |
|
11626 | |
11627 |
|
11628 |
|
11629 |
|
11630 |
|
11631 |
|
11632 |
|
11633 |
|
11634 |
|
11635 |
|
11636 |
|
11637 |
|
11638 |
|
11639 |
|
11640 |
|
11641 |
|
11642 |
|
11643 |
|
11644 |
|
11645 |
|
11646 |
|
11647 |
|
11648 |
|
11649 |
|
11650 | function toPlainObject(value) {
|
11651 | return copyObject(value, keysIn(value));
|
11652 | }
|
11653 |
|
11654 | module.exports = toPlainObject;
|
11655 |
|
11656 |
|
11657 | },
|
11658 |
|
11659 | function (module, exports, __webpack_require__) {
|
11660 |
|
11661 | var createCaseFirst = __webpack_require__(196);
|
11662 |
|
11663 | |
11664 |
|
11665 |
|
11666 |
|
11667 |
|
11668 |
|
11669 |
|
11670 |
|
11671 |
|
11672 |
|
11673 |
|
11674 |
|
11675 |
|
11676 |
|
11677 |
|
11678 |
|
11679 |
|
11680 | var upperFirst = createCaseFirst('toUpperCase');
|
11681 |
|
11682 | module.exports = upperFirst;
|
11683 |
|
11684 |
|
11685 | },
|
11686 |
|
11687 | function (module, exports, __webpack_require__) {
|
11688 |
|
11689 | var castSlice = __webpack_require__(197),
|
11690 | hasUnicode = __webpack_require__(82),
|
11691 | stringToArray = __webpack_require__(83),
|
11692 | toString = __webpack_require__(62);
|
11693 |
|
11694 | |
11695 |
|
11696 |
|
11697 |
|
11698 |
|
11699 |
|
11700 |
|
11701 | function createCaseFirst(methodName) {
|
11702 | return function (string) {
|
11703 | string = toString(string);
|
11704 |
|
11705 | var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined;
|
11706 |
|
11707 | var chr = strSymbols ? strSymbols[0] : string.charAt(0);
|
11708 |
|
11709 | var trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1);
|
11710 |
|
11711 | return chr[methodName]() + trailing;
|
11712 | };
|
11713 | }
|
11714 |
|
11715 | module.exports = createCaseFirst;
|
11716 |
|
11717 |
|
11718 | },
|
11719 |
|
11720 | function (module, exports, __webpack_require__) {
|
11721 |
|
11722 | var baseSlice = __webpack_require__(198);
|
11723 |
|
11724 | |
11725 |
|
11726 |
|
11727 |
|
11728 |
|
11729 |
|
11730 |
|
11731 |
|
11732 |
|
11733 | function castSlice(array, start, end) {
|
11734 | var length = array.length;
|
11735 | end = end === undefined ? length : end;
|
11736 | return !start && end >= length ? array : baseSlice(array, start, end);
|
11737 | }
|
11738 |
|
11739 | module.exports = castSlice;
|
11740 |
|
11741 |
|
11742 | },
|
11743 |
|
11744 | function (module, exports) {
|
11745 |
|
11746 | |
11747 |
|
11748 |
|
11749 |
|
11750 |
|
11751 |
|
11752 |
|
11753 |
|
11754 |
|
11755 | function baseSlice(array, start, end) {
|
11756 | var index = -1,
|
11757 | length = array.length;
|
11758 |
|
11759 | if (start < 0) {
|
11760 | start = -start > length ? 0 : length + start;
|
11761 | }
|
11762 | end = end > length ? length : end;
|
11763 | if (end < 0) {
|
11764 | end += length;
|
11765 | }
|
11766 | length = start > end ? 0 : end - start >>> 0;
|
11767 | start >>>= 0;
|
11768 |
|
11769 | var result = Array(length);
|
11770 | while (++index < length) {
|
11771 | result[index] = array[index + start];
|
11772 | }
|
11773 | return result;
|
11774 | }
|
11775 |
|
11776 | module.exports = baseSlice;
|
11777 |
|
11778 |
|
11779 | },
|
11780 |
|
11781 | function (module, exports) {
|
11782 |
|
11783 | |
11784 |
|
11785 |
|
11786 |
|
11787 |
|
11788 |
|
11789 |
|
11790 | function asciiToArray(string) {
|
11791 | return string.split('');
|
11792 | }
|
11793 |
|
11794 | module.exports = asciiToArray;
|
11795 |
|
11796 |
|
11797 | },
|
11798 |
|
11799 | function (module, exports) {
|
11800 |
|
11801 |
|
11802 | var rsAstralRange = '\\ud800-\\udfff',
|
11803 | rsComboMarksRange = '\\u0300-\\u036f',
|
11804 | reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
11805 | rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
11806 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
11807 | rsVarRange = '\\ufe0e\\ufe0f';
|
11808 |
|
11809 |
|
11810 | var rsAstral = '[' + rsAstralRange + ']',
|
11811 | rsCombo = '[' + rsComboRange + ']',
|
11812 | rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
11813 | rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
11814 | rsNonAstral = '[^' + rsAstralRange + ']',
|
11815 | rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
11816 | rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
11817 | rsZWJ = '\\u200d';
|
11818 |
|
11819 |
|
11820 | var reOptMod = rsModifier + '?',
|
11821 | rsOptVar = '[' + rsVarRange + ']?',
|
11822 | rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
11823 | rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
11824 | rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
11825 |
|
11826 |
|
11827 | var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
11828 |
|
11829 | |
11830 |
|
11831 |
|
11832 |
|
11833 |
|
11834 |
|
11835 |
|
11836 | function unicodeToArray(string) {
|
11837 | return string.match(reUnicode) || [];
|
11838 | }
|
11839 |
|
11840 | module.exports = unicodeToArray;
|
11841 |
|
11842 |
|
11843 | },
|
11844 |
|
11845 | function (module, exports, __webpack_require__) {
|
11846 |
|
11847 | var baseRest = __webpack_require__(79),
|
11848 | pullAll = __webpack_require__(202);
|
11849 |
|
11850 | |
11851 |
|
11852 |
|
11853 |
|
11854 |
|
11855 |
|
11856 |
|
11857 |
|
11858 |
|
11859 |
|
11860 |
|
11861 |
|
11862 |
|
11863 |
|
11864 |
|
11865 |
|
11866 |
|
11867 |
|
11868 |
|
11869 |
|
11870 |
|
11871 |
|
11872 |
|
11873 | var pull = baseRest(pullAll);
|
11874 |
|
11875 | module.exports = pull;
|
11876 |
|
11877 |
|
11878 | },
|
11879 |
|
11880 | function (module, exports, __webpack_require__) {
|
11881 |
|
11882 | var basePullAll = __webpack_require__(203);
|
11883 |
|
11884 | |
11885 |
|
11886 |
|
11887 |
|
11888 |
|
11889 |
|
11890 |
|
11891 |
|
11892 |
|
11893 |
|
11894 |
|
11895 |
|
11896 |
|
11897 |
|
11898 |
|
11899 |
|
11900 |
|
11901 |
|
11902 |
|
11903 |
|
11904 | function pullAll(array, values) {
|
11905 | return array && array.length && values && values.length ? basePullAll(array, values) : array;
|
11906 | }
|
11907 |
|
11908 | module.exports = pullAll;
|
11909 |
|
11910 |
|
11911 | },
|
11912 |
|
11913 | function (module, exports, __webpack_require__) {
|
11914 |
|
11915 | var arrayMap = __webpack_require__(35),
|
11916 | baseIndexOf = __webpack_require__(204),
|
11917 | baseIndexOfWith = __webpack_require__(208),
|
11918 | baseUnary = __webpack_require__(61),
|
11919 | copyArray = __webpack_require__(28);
|
11920 |
|
11921 |
|
11922 | var arrayProto = Array.prototype;
|
11923 |
|
11924 |
|
11925 | var splice = arrayProto.splice;
|
11926 |
|
11927 | |
11928 |
|
11929 |
|
11930 |
|
11931 |
|
11932 |
|
11933 |
|
11934 |
|
11935 |
|
11936 |
|
11937 |
|
11938 | function basePullAll(array, values, iteratee, comparator) {
|
11939 | var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
|
11940 | index = -1,
|
11941 | length = values.length,
|
11942 | seen = array;
|
11943 |
|
11944 | if (array === values) {
|
11945 | values = copyArray(values);
|
11946 | }
|
11947 | if (iteratee) {
|
11948 | seen = arrayMap(array, baseUnary(iteratee));
|
11949 | }
|
11950 | while (++index < length) {
|
11951 | var fromIndex = 0,
|
11952 | value = values[index],
|
11953 | computed = iteratee ? iteratee(value) : value;
|
11954 |
|
11955 | while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
|
11956 | if (seen !== array) {
|
11957 | splice.call(seen, fromIndex, 1);
|
11958 | }
|
11959 | splice.call(array, fromIndex, 1);
|
11960 | }
|
11961 | }
|
11962 | return array;
|
11963 | }
|
11964 |
|
11965 | module.exports = basePullAll;
|
11966 |
|
11967 |
|
11968 | },
|
11969 |
|
11970 | function (module, exports, __webpack_require__) {
|
11971 |
|
11972 | var baseFindIndex = __webpack_require__(205),
|
11973 | baseIsNaN = __webpack_require__(206),
|
11974 | strictIndexOf = __webpack_require__(207);
|
11975 |
|
11976 | |
11977 |
|
11978 |
|
11979 |
|
11980 |
|
11981 |
|
11982 |
|
11983 |
|
11984 |
|
11985 | function baseIndexOf(array, value, fromIndex) {
|
11986 | return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
|
11987 | }
|
11988 |
|
11989 | module.exports = baseIndexOf;
|
11990 |
|
11991 |
|
11992 | },
|
11993 |
|
11994 | function (module, exports) {
|
11995 |
|
11996 | |
11997 |
|
11998 |
|
11999 |
|
12000 |
|
12001 |
|
12002 |
|
12003 |
|
12004 |
|
12005 |
|
12006 |
|
12007 | function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
12008 | var length = array.length,
|
12009 | index = fromIndex + (fromRight ? 1 : -1);
|
12010 |
|
12011 | while (fromRight ? index-- : ++index < length) {
|
12012 | if (predicate(array[index], index, array)) {
|
12013 | return index;
|
12014 | }
|
12015 | }
|
12016 | return -1;
|
12017 | }
|
12018 |
|
12019 | module.exports = baseFindIndex;
|
12020 |
|
12021 |
|
12022 | },
|
12023 |
|
12024 | function (module, exports) {
|
12025 |
|
12026 | |
12027 |
|
12028 |
|
12029 |
|
12030 |
|
12031 |
|
12032 |
|
12033 | function baseIsNaN(value) {
|
12034 | return value !== value;
|
12035 | }
|
12036 |
|
12037 | module.exports = baseIsNaN;
|
12038 |
|
12039 |
|
12040 | },
|
12041 |
|
12042 | function (module, exports) {
|
12043 |
|
12044 | |
12045 |
|
12046 |
|
12047 |
|
12048 |
|
12049 |
|
12050 |
|
12051 |
|
12052 |
|
12053 |
|
12054 | function strictIndexOf(array, value, fromIndex) {
|
12055 | var index = fromIndex - 1,
|
12056 | length = array.length;
|
12057 |
|
12058 | while (++index < length) {
|
12059 | if (array[index] === value) {
|
12060 | return index;
|
12061 | }
|
12062 | }
|
12063 | return -1;
|
12064 | }
|
12065 |
|
12066 | module.exports = strictIndexOf;
|
12067 |
|
12068 |
|
12069 | },
|
12070 |
|
12071 | function (module, exports) {
|
12072 |
|
12073 | |
12074 |
|
12075 |
|
12076 |
|
12077 |
|
12078 |
|
12079 |
|
12080 |
|
12081 |
|
12082 |
|
12083 | function baseIndexOfWith(array, value, fromIndex, comparator) {
|
12084 | var index = fromIndex - 1,
|
12085 | length = array.length;
|
12086 |
|
12087 | while (++index < length) {
|
12088 | if (comparator(array[index], value)) {
|
12089 | return index;
|
12090 | }
|
12091 | }
|
12092 | return -1;
|
12093 | }
|
12094 |
|
12095 | module.exports = baseIndexOfWith;
|
12096 |
|
12097 |
|
12098 | },
|
12099 |
|
12100 | function (module, exports, __webpack_require__) {
|
12101 |
|
12102 | var arrayEach = __webpack_require__(64),
|
12103 | baseEach = __webpack_require__(210),
|
12104 | castFunction = __webpack_require__(213),
|
12105 | isArray = __webpack_require__(6);
|
12106 |
|
12107 | |
12108 |
|
12109 |
|
12110 |
|
12111 |
|
12112 |
|
12113 |
|
12114 |
|
12115 |
|
12116 |
|
12117 |
|
12118 |
|
12119 |
|
12120 |
|
12121 |
|
12122 |
|
12123 |
|
12124 |
|
12125 |
|
12126 |
|
12127 |
|
12128 |
|
12129 |
|
12130 |
|
12131 |
|
12132 |
|
12133 |
|
12134 |
|
12135 |
|
12136 |
|
12137 | function forEach(collection, iteratee) {
|
12138 | var func = isArray(collection) ? arrayEach : baseEach;
|
12139 | return func(collection, castFunction(iteratee));
|
12140 | }
|
12141 |
|
12142 | module.exports = forEach;
|
12143 |
|
12144 |
|
12145 | },
|
12146 |
|
12147 | function (module, exports, __webpack_require__) {
|
12148 |
|
12149 | var baseForOwn = __webpack_require__(211),
|
12150 | createBaseEach = __webpack_require__(212);
|
12151 |
|
12152 | |
12153 |
|
12154 |
|
12155 |
|
12156 |
|
12157 |
|
12158 |
|
12159 |
|
12160 | var baseEach = createBaseEach(baseForOwn);
|
12161 |
|
12162 | module.exports = baseEach;
|
12163 |
|
12164 |
|
12165 | },
|
12166 |
|
12167 | function (module, exports, __webpack_require__) {
|
12168 |
|
12169 | var baseFor = __webpack_require__(81),
|
12170 | keys = __webpack_require__(13);
|
12171 |
|
12172 | |
12173 |
|
12174 |
|
12175 |
|
12176 |
|
12177 |
|
12178 |
|
12179 |
|
12180 | function baseForOwn(object, iteratee) {
|
12181 | return object && baseFor(object, iteratee, keys);
|
12182 | }
|
12183 |
|
12184 | module.exports = baseForOwn;
|
12185 |
|
12186 |
|
12187 | },
|
12188 |
|
12189 | function (module, exports, __webpack_require__) {
|
12190 |
|
12191 | var isArrayLike = __webpack_require__(9);
|
12192 |
|
12193 | |
12194 |
|
12195 |
|
12196 |
|
12197 |
|
12198 |
|
12199 |
|
12200 |
|
12201 | function createBaseEach(eachFunc, fromRight) {
|
12202 | return function (collection, iteratee) {
|
12203 | if (collection == null) {
|
12204 | return collection;
|
12205 | }
|
12206 | if (!isArrayLike(collection)) {
|
12207 | return eachFunc(collection, iteratee);
|
12208 | }
|
12209 | var length = collection.length,
|
12210 | index = fromRight ? length : -1,
|
12211 | iterable = Object(collection);
|
12212 |
|
12213 | while (fromRight ? index-- : ++index < length) {
|
12214 | if (iteratee(iterable[index], index, iterable) === false) {
|
12215 | break;
|
12216 | }
|
12217 | }
|
12218 | return collection;
|
12219 | };
|
12220 | }
|
12221 |
|
12222 | module.exports = createBaseEach;
|
12223 |
|
12224 |
|
12225 | },
|
12226 |
|
12227 | function (module, exports, __webpack_require__) {
|
12228 |
|
12229 | var identity = __webpack_require__(44);
|
12230 |
|
12231 | |
12232 |
|
12233 |
|
12234 |
|
12235 |
|
12236 |
|
12237 |
|
12238 | function castFunction(value) {
|
12239 | return typeof value == 'function' ? value : identity;
|
12240 | }
|
12241 |
|
12242 | module.exports = castFunction;
|
12243 |
|
12244 |
|
12245 | },
|
12246 |
|
12247 | function (module, exports, __webpack_require__) {
|
12248 |
|
12249 | var baseIsEqual = __webpack_require__(215);
|
12250 |
|
12251 | |
12252 |
|
12253 |
|
12254 |
|
12255 |
|
12256 |
|
12257 |
|
12258 |
|
12259 |
|
12260 |
|
12261 |
|
12262 |
|
12263 |
|
12264 |
|
12265 |
|
12266 |
|
12267 |
|
12268 |
|
12269 |
|
12270 |
|
12271 |
|
12272 |
|
12273 |
|
12274 |
|
12275 |
|
12276 |
|
12277 |
|
12278 |
|
12279 | function isEqual(value, other) {
|
12280 | return baseIsEqual(value, other);
|
12281 | }
|
12282 |
|
12283 | module.exports = isEqual;
|
12284 |
|
12285 |
|
12286 | },
|
12287 |
|
12288 | function (module, exports, __webpack_require__) {
|
12289 |
|
12290 | var baseIsEqualDeep = __webpack_require__(216),
|
12291 | isObjectLike = __webpack_require__(5);
|
12292 |
|
12293 | |
12294 |
|
12295 |
|
12296 |
|
12297 |
|
12298 |
|
12299 |
|
12300 |
|
12301 |
|
12302 |
|
12303 |
|
12304 |
|
12305 |
|
12306 |
|
12307 | function baseIsEqual(value, other, bitmask, customizer, stack) {
|
12308 | if (value === other) {
|
12309 | return true;
|
12310 | }
|
12311 | if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
12312 | return value !== value && other !== other;
|
12313 | }
|
12314 | return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
12315 | }
|
12316 |
|
12317 | module.exports = baseIsEqual;
|
12318 |
|
12319 |
|
12320 | },
|
12321 |
|
12322 | function (module, exports, __webpack_require__) {
|
12323 |
|
12324 | var Stack = __webpack_require__(36),
|
12325 | equalArrays = __webpack_require__(84),
|
12326 | equalByTag = __webpack_require__(222),
|
12327 | equalObjects = __webpack_require__(223),
|
12328 | getTag = __webpack_require__(21),
|
12329 | isArray = __webpack_require__(6),
|
12330 | isBuffer = __webpack_require__(17),
|
12331 | isTypedArray = __webpack_require__(22);
|
12332 |
|
12333 |
|
12334 | var COMPARE_PARTIAL_FLAG = 1;
|
12335 |
|
12336 |
|
12337 | var argsTag = '[object Arguments]',
|
12338 | arrayTag = '[object Array]',
|
12339 | objectTag = '[object Object]';
|
12340 |
|
12341 |
|
12342 | var objectProto = Object.prototype;
|
12343 |
|
12344 |
|
12345 | var hasOwnProperty = objectProto.hasOwnProperty;
|
12346 |
|
12347 | |
12348 |
|
12349 |
|
12350 |
|
12351 |
|
12352 |
|
12353 |
|
12354 |
|
12355 |
|
12356 |
|
12357 |
|
12358 |
|
12359 |
|
12360 |
|
12361 | function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
12362 | var objIsArr = isArray(object),
|
12363 | othIsArr = isArray(other),
|
12364 | objTag = objIsArr ? arrayTag : getTag(object),
|
12365 | othTag = othIsArr ? arrayTag : getTag(other);
|
12366 |
|
12367 | objTag = objTag == argsTag ? objectTag : objTag;
|
12368 | othTag = othTag == argsTag ? objectTag : othTag;
|
12369 |
|
12370 | var objIsObj = objTag == objectTag,
|
12371 | othIsObj = othTag == objectTag,
|
12372 | isSameTag = objTag == othTag;
|
12373 |
|
12374 | if (isSameTag && isBuffer(object)) {
|
12375 | if (!isBuffer(other)) {
|
12376 | return false;
|
12377 | }
|
12378 | objIsArr = true;
|
12379 | objIsObj = false;
|
12380 | }
|
12381 | if (isSameTag && !objIsObj) {
|
12382 | stack || (stack = new Stack());
|
12383 | return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
12384 | }
|
12385 | if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
12386 | var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
12387 | othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
12388 |
|
12389 | if (objIsWrapped || othIsWrapped) {
|
12390 | var objUnwrapped = objIsWrapped ? object.value() : object,
|
12391 | othUnwrapped = othIsWrapped ? other.value() : other;
|
12392 |
|
12393 | stack || (stack = new Stack());
|
12394 | return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
12395 | }
|
12396 | }
|
12397 | if (!isSameTag) {
|
12398 | return false;
|
12399 | }
|
12400 | stack || (stack = new Stack());
|
12401 | return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
12402 | }
|
12403 |
|
12404 | module.exports = baseIsEqualDeep;
|
12405 |
|
12406 |
|
12407 | },
|
12408 |
|
12409 | function (module, exports, __webpack_require__) {
|
12410 |
|
12411 | var MapCache = __webpack_require__(63),
|
12412 | setCacheAdd = __webpack_require__(218),
|
12413 | setCacheHas = __webpack_require__(219);
|
12414 |
|
12415 | |
12416 |
|
12417 |
|
12418 |
|
12419 |
|
12420 |
|
12421 |
|
12422 |
|
12423 | function SetCache(values) {
|
12424 | var index = -1,
|
12425 | length = values == null ? 0 : values.length;
|
12426 |
|
12427 | this.__data__ = new MapCache();
|
12428 | while (++index < length) {
|
12429 | this.add(values[index]);
|
12430 | }
|
12431 | }
|
12432 |
|
12433 |
|
12434 | SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
12435 | SetCache.prototype.has = setCacheHas;
|
12436 |
|
12437 | module.exports = SetCache;
|
12438 |
|
12439 |
|
12440 | },
|
12441 |
|
12442 | function (module, exports) {
|
12443 |
|
12444 |
|
12445 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
12446 |
|
12447 | |
12448 |
|
12449 |
|
12450 |
|
12451 |
|
12452 |
|
12453 |
|
12454 |
|
12455 |
|
12456 |
|
12457 | function setCacheAdd(value) {
|
12458 | this.__data__.set(value, HASH_UNDEFINED);
|
12459 | return this;
|
12460 | }
|
12461 |
|
12462 | module.exports = setCacheAdd;
|
12463 |
|
12464 |
|
12465 | },
|
12466 |
|
12467 | function (module, exports) {
|
12468 |
|
12469 | |
12470 |
|
12471 |
|
12472 |
|
12473 |
|
12474 |
|
12475 |
|
12476 |
|
12477 |
|
12478 | function setCacheHas(value) {
|
12479 | return this.__data__.has(value);
|
12480 | }
|
12481 |
|
12482 | module.exports = setCacheHas;
|
12483 |
|
12484 |
|
12485 | },
|
12486 |
|
12487 | function (module, exports) {
|
12488 |
|
12489 | |
12490 |
|
12491 |
|
12492 |
|
12493 |
|
12494 |
|
12495 |
|
12496 |
|
12497 |
|
12498 |
|
12499 | function arraySome(array, predicate) {
|
12500 | var index = -1,
|
12501 | length = array == null ? 0 : array.length;
|
12502 |
|
12503 | while (++index < length) {
|
12504 | if (predicate(array[index], index, array)) {
|
12505 | return true;
|
12506 | }
|
12507 | }
|
12508 | return false;
|
12509 | }
|
12510 |
|
12511 | module.exports = arraySome;
|
12512 |
|
12513 |
|
12514 | },
|
12515 |
|
12516 | function (module, exports) {
|
12517 |
|
12518 | |
12519 |
|
12520 |
|
12521 |
|
12522 |
|
12523 |
|
12524 |
|
12525 |
|
12526 | function cacheHas(cache, key) {
|
12527 | return cache.has(key);
|
12528 | }
|
12529 |
|
12530 | module.exports = cacheHas;
|
12531 |
|
12532 |
|
12533 | },
|
12534 |
|
12535 | function (module, exports, __webpack_require__) {
|
12536 |
|
12537 | var _Symbol = __webpack_require__(11),
|
12538 | Uint8Array = __webpack_require__(74),
|
12539 | eq = __webpack_require__(18),
|
12540 | equalArrays = __webpack_require__(84),
|
12541 | mapToArray = __webpack_require__(42),
|
12542 | setToArray = __webpack_require__(43);
|
12543 |
|
12544 |
|
12545 | var COMPARE_PARTIAL_FLAG = 1,
|
12546 | COMPARE_UNORDERED_FLAG = 2;
|
12547 |
|
12548 |
|
12549 | var boolTag = '[object Boolean]',
|
12550 | dateTag = '[object Date]',
|
12551 | errorTag = '[object Error]',
|
12552 | mapTag = '[object Map]',
|
12553 | numberTag = '[object Number]',
|
12554 | regexpTag = '[object RegExp]',
|
12555 | setTag = '[object Set]',
|
12556 | stringTag = '[object String]',
|
12557 | symbolTag = '[object Symbol]';
|
12558 |
|
12559 | var arrayBufferTag = '[object ArrayBuffer]',
|
12560 | dataViewTag = '[object DataView]';
|
12561 |
|
12562 |
|
12563 | var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
12564 | symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
12565 |
|
12566 | |
12567 |
|
12568 |
|
12569 |
|
12570 |
|
12571 |
|
12572 |
|
12573 |
|
12574 |
|
12575 |
|
12576 |
|
12577 |
|
12578 |
|
12579 |
|
12580 |
|
12581 |
|
12582 |
|
12583 | function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
12584 | switch (tag) {
|
12585 | case dataViewTag:
|
12586 | if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
12587 | return false;
|
12588 | }
|
12589 | object = object.buffer;
|
12590 | other = other.buffer;
|
12591 |
|
12592 | case arrayBufferTag:
|
12593 | if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
12594 | return false;
|
12595 | }
|
12596 | return true;
|
12597 |
|
12598 | case boolTag:
|
12599 | case dateTag:
|
12600 | case numberTag:
|
12601 |
|
12602 |
|
12603 | return eq(+object, +other);
|
12604 |
|
12605 | case errorTag:
|
12606 | return object.name == other.name && object.message == other.message;
|
12607 |
|
12608 | case regexpTag:
|
12609 | case stringTag:
|
12610 |
|
12611 |
|
12612 |
|
12613 | return object == other + '';
|
12614 |
|
12615 | case mapTag:
|
12616 | var convert = mapToArray;
|
12617 |
|
12618 | case setTag:
|
12619 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
12620 | convert || (convert = setToArray);
|
12621 |
|
12622 | if (object.size != other.size && !isPartial) {
|
12623 | return false;
|
12624 | }
|
12625 |
|
12626 | var stacked = stack.get(object);
|
12627 | if (stacked) {
|
12628 | return stacked == other;
|
12629 | }
|
12630 | bitmask |= COMPARE_UNORDERED_FLAG;
|
12631 |
|
12632 |
|
12633 | stack.set(object, other);
|
12634 | var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
12635 | stack['delete'](object);
|
12636 | return result;
|
12637 |
|
12638 | case symbolTag:
|
12639 | if (symbolValueOf) {
|
12640 | return symbolValueOf.call(object) == symbolValueOf.call(other);
|
12641 | }
|
12642 | }
|
12643 | return false;
|
12644 | }
|
12645 |
|
12646 | module.exports = equalByTag;
|
12647 |
|
12648 |
|
12649 | },
|
12650 |
|
12651 | function (module, exports, __webpack_require__) {
|
12652 |
|
12653 | var getAllKeys = __webpack_require__(72);
|
12654 |
|
12655 |
|
12656 | var COMPARE_PARTIAL_FLAG = 1;
|
12657 |
|
12658 |
|
12659 | var objectProto = Object.prototype;
|
12660 |
|
12661 |
|
12662 | var hasOwnProperty = objectProto.hasOwnProperty;
|
12663 |
|
12664 | |
12665 |
|
12666 |
|
12667 |
|
12668 |
|
12669 |
|
12670 |
|
12671 |
|
12672 |
|
12673 |
|
12674 |
|
12675 |
|
12676 |
|
12677 | function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
12678 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
12679 | objProps = getAllKeys(object),
|
12680 | objLength = objProps.length,
|
12681 | othProps = getAllKeys(other),
|
12682 | othLength = othProps.length;
|
12683 |
|
12684 | if (objLength != othLength && !isPartial) {
|
12685 | return false;
|
12686 | }
|
12687 | var index = objLength;
|
12688 | while (index--) {
|
12689 | var key = objProps[index];
|
12690 | if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
12691 | return false;
|
12692 | }
|
12693 | }
|
12694 |
|
12695 | var stacked = stack.get(object);
|
12696 | if (stacked && stack.get(other)) {
|
12697 | return stacked == other;
|
12698 | }
|
12699 | var result = true;
|
12700 | stack.set(object, other);
|
12701 | stack.set(other, object);
|
12702 |
|
12703 | var skipCtor = isPartial;
|
12704 | while (++index < objLength) {
|
12705 | key = objProps[index];
|
12706 | var objValue = object[key],
|
12707 | othValue = other[key];
|
12708 |
|
12709 | if (customizer) {
|
12710 | var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
12711 | }
|
12712 |
|
12713 | if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
12714 | result = false;
|
12715 | break;
|
12716 | }
|
12717 | skipCtor || (skipCtor = key == 'constructor');
|
12718 | }
|
12719 | if (result && !skipCtor) {
|
12720 | var objCtor = object.constructor,
|
12721 | othCtor = other.constructor;
|
12722 |
|
12723 |
|
12724 | if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
12725 | result = false;
|
12726 | }
|
12727 | }
|
12728 | stack['delete'](object);
|
12729 | stack['delete'](other);
|
12730 | return result;
|
12731 | }
|
12732 |
|
12733 | module.exports = equalObjects;
|
12734 |
|
12735 |
|
12736 | },
|
12737 |
|
12738 | function (module, exports, __webpack_require__) {
|
12739 |
|
12740 | var _Symbol = __webpack_require__(11),
|
12741 | copyArray = __webpack_require__(28),
|
12742 | getTag = __webpack_require__(21),
|
12743 | isArrayLike = __webpack_require__(9),
|
12744 | isString = __webpack_require__(56),
|
12745 | iteratorToArray = __webpack_require__(225),
|
12746 | mapToArray = __webpack_require__(42),
|
12747 | setToArray = __webpack_require__(43),
|
12748 | stringToArray = __webpack_require__(83),
|
12749 | values = __webpack_require__(226);
|
12750 |
|
12751 |
|
12752 | var mapTag = '[object Map]',
|
12753 | setTag = '[object Set]';
|
12754 |
|
12755 |
|
12756 | var symIterator = _Symbol ? _Symbol.iterator : undefined;
|
12757 |
|
12758 | |
12759 |
|
12760 |
|
12761 |
|
12762 |
|
12763 |
|
12764 |
|
12765 |
|
12766 |
|
12767 |
|
12768 |
|
12769 |
|
12770 |
|
12771 |
|
12772 |
|
12773 |
|
12774 |
|
12775 |
|
12776 |
|
12777 |
|
12778 |
|
12779 |
|
12780 |
|
12781 | function toArray(value) {
|
12782 | if (!value) {
|
12783 | return [];
|
12784 | }
|
12785 | if (isArrayLike(value)) {
|
12786 | return isString(value) ? stringToArray(value) : copyArray(value);
|
12787 | }
|
12788 | if (symIterator && value[symIterator]) {
|
12789 | return iteratorToArray(value[symIterator]());
|
12790 | }
|
12791 | var tag = getTag(value),
|
12792 | func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
|
12793 |
|
12794 | return func(value);
|
12795 | }
|
12796 |
|
12797 | module.exports = toArray;
|
12798 |
|
12799 |
|
12800 | },
|
12801 |
|
12802 | function (module, exports) {
|
12803 |
|
12804 | |
12805 |
|
12806 |
|
12807 |
|
12808 |
|
12809 |
|
12810 |
|
12811 | function iteratorToArray(iterator) {
|
12812 | var data,
|
12813 | result = [];
|
12814 |
|
12815 | while (!(data = iterator.next()).done) {
|
12816 | result.push(data.value);
|
12817 | }
|
12818 | return result;
|
12819 | }
|
12820 |
|
12821 | module.exports = iteratorToArray;
|
12822 |
|
12823 |
|
12824 | },
|
12825 |
|
12826 | function (module, exports, __webpack_require__) {
|
12827 |
|
12828 | var baseValues = __webpack_require__(227),
|
12829 | keys = __webpack_require__(13);
|
12830 |
|
12831 | |
12832 |
|
12833 |
|
12834 |
|
12835 |
|
12836 |
|
12837 |
|
12838 |
|
12839 |
|
12840 |
|
12841 |
|
12842 |
|
12843 |
|
12844 |
|
12845 |
|
12846 |
|
12847 |
|
12848 |
|
12849 |
|
12850 |
|
12851 |
|
12852 |
|
12853 |
|
12854 |
|
12855 |
|
12856 |
|
12857 | function values(object) {
|
12858 | return object == null ? [] : baseValues(object, keys(object));
|
12859 | }
|
12860 |
|
12861 | module.exports = values;
|
12862 |
|
12863 |
|
12864 | },
|
12865 |
|
12866 | function (module, exports, __webpack_require__) {
|
12867 |
|
12868 | var arrayMap = __webpack_require__(35);
|
12869 |
|
12870 | |
12871 |
|
12872 |
|
12873 |
|
12874 |
|
12875 |
|
12876 |
|
12877 |
|
12878 |
|
12879 |
|
12880 | function baseValues(object, props) {
|
12881 | return arrayMap(props, function (key) {
|
12882 | return object[key];
|
12883 | });
|
12884 | }
|
12885 |
|
12886 | module.exports = baseValues;
|
12887 |
|
12888 |
|
12889 | },
|
12890 |
|
12891 | function (module, exports, __webpack_require__) {
|
12892 |
|
12893 | var Util = __webpack_require__(0);
|
12894 |
|
12895 | var ALIAS_ATTRS = ['strokeStyle', 'fillStyle', 'globalAlpha'];
|
12896 | var CLIP_SHAPES = ['circle', 'ellipse', 'fan', 'polygon', 'rect', 'path'];
|
12897 | var CAPITALIZED_ATTRS_MAP = {
|
12898 | r: 'R',
|
12899 | opacity: 'Opacity',
|
12900 | lineWidth: 'LineWidth',
|
12901 | clip: 'Clip',
|
12902 | stroke: 'Stroke',
|
12903 | fill: 'Fill',
|
12904 | strokeOpacity: 'Stroke',
|
12905 | fillOpacity: 'Fill',
|
12906 | x: 'X',
|
12907 | y: 'Y',
|
12908 | rx: 'Rx',
|
12909 | ry: 'Ry',
|
12910 | re: 'Re',
|
12911 | rs: 'Rs',
|
12912 | width: 'Width',
|
12913 | height: 'Height',
|
12914 | img: 'Img',
|
12915 | x1: 'X1',
|
12916 | x2: 'X2',
|
12917 | y1: 'Y1',
|
12918 | y2: 'Y2',
|
12919 | points: 'Points',
|
12920 | p1: 'P1',
|
12921 | p2: 'P2',
|
12922 | p3: 'P3',
|
12923 | p4: 'P4',
|
12924 | text: 'Text',
|
12925 | radius: 'Radius',
|
12926 | textAlign: 'TextAlign',
|
12927 | textBaseline: 'TextBaseline',
|
12928 | font: 'Font',
|
12929 | fontSize: 'FontSize',
|
12930 | fontStyle: 'FontStyle',
|
12931 | fontVariant: 'FontVariant',
|
12932 | fontWeight: 'FontWeight',
|
12933 | fontFamily: 'FontFamily',
|
12934 | clockwise: 'Clockwise',
|
12935 | startAngle: 'StartAngle',
|
12936 | endAngle: 'EndAngle',
|
12937 | path: 'Path'
|
12938 | };
|
12939 | var ALIAS_ATTRS_MAP = {
|
12940 | stroke: 'strokeStyle',
|
12941 | fill: 'fillStyle',
|
12942 | opacity: 'globalAlpha'
|
12943 | };
|
12944 |
|
12945 | module.exports = {
|
12946 | canFill: false,
|
12947 | canStroke: false,
|
12948 | initAttrs: function initAttrs(attrs) {
|
12949 | this.__attrs = {
|
12950 | opacity: 1,
|
12951 | fillOpacity: 1,
|
12952 | strokeOpacity: 1
|
12953 | };
|
12954 | this.attr(Util.assign(this.getDefaultAttrs(), attrs));
|
12955 | return this;
|
12956 | },
|
12957 | getDefaultAttrs: function getDefaultAttrs() {
|
12958 | return {};
|
12959 | },
|
12960 |
|
12961 | |
12962 |
|
12963 |
|
12964 |
|
12965 |
|
12966 |
|
12967 |
|
12968 |
|
12969 |
|
12970 |
|
12971 |
|
12972 | attr: function attr(name, value) {
|
12973 | var self = this;
|
12974 | if (arguments.length === 0) {
|
12975 | return self.__attrs;
|
12976 | }
|
12977 |
|
12978 | if (Util.isObject(name)) {
|
12979 | for (var k in name) {
|
12980 | if (ALIAS_ATTRS.indexOf(k) === -1) {
|
12981 | var v = name[k];
|
12982 | self._setAttr(k, v);
|
12983 | }
|
12984 | }
|
12985 | if (self.__afterSetAttrAll) {
|
12986 | self.__afterSetAttrAll(name);
|
12987 | }
|
12988 |
|
12989 | self.clearBBox();
|
12990 | return self;
|
12991 | }
|
12992 | if (arguments.length === 2) {
|
12993 | if (self._setAttr(name, value) !== false) {
|
12994 | var m = '__afterSetAttr' + CAPITALIZED_ATTRS_MAP[name];
|
12995 | if (self[m]) {
|
12996 | self[m](value);
|
12997 | }
|
12998 | }
|
12999 |
|
13000 | self.clearBBox();
|
13001 | return self;
|
13002 | }
|
13003 | return self._getAttr(name);
|
13004 | },
|
13005 | clearBBox: function clearBBox() {
|
13006 | this.setSilent('box', null);
|
13007 | },
|
13008 | __afterSetAttrAll: function __afterSetAttrAll() {},
|
13009 |
|
13010 |
|
13011 | _getAttr: function _getAttr(name) {
|
13012 | return this.__attrs[name];
|
13013 | },
|
13014 |
|
13015 |
|
13016 | _setAttr: function _setAttr(name, value) {
|
13017 | var self = this;
|
13018 | if (name === 'clip') {
|
13019 | self.__setAttrClip(value);
|
13020 | self.__attrs.clip = value;
|
13021 | } else if (name === 'transform') {
|
13022 | self.__setAttrTrans(value);
|
13023 | } else {
|
13024 | self.__attrs[name] = value;
|
13025 | var alias = ALIAS_ATTRS_MAP[name];
|
13026 | if (alias) {
|
13027 | self.__attrs[alias] = value;
|
13028 | }
|
13029 | }
|
13030 | return self;
|
13031 | },
|
13032 | hasFill: function hasFill() {
|
13033 | return this.canFill && this.__attrs.fillStyle;
|
13034 | },
|
13035 | hasStroke: function hasStroke() {
|
13036 | return this.canStroke && this.__attrs.strokeStyle;
|
13037 | },
|
13038 |
|
13039 |
|
13040 | __setAttrOpacity: function __setAttrOpacity(v) {
|
13041 | this.__attrs.globalAlpha = v;
|
13042 | return v;
|
13043 | },
|
13044 | __setAttrClip: function __setAttrClip(clip) {
|
13045 | var self = this;
|
13046 | if (clip && CLIP_SHAPES.indexOf(clip.type) > -1) {
|
13047 | if (clip.get('canvas') === null) {
|
13048 | clip = Util.clone(clip);
|
13049 | }
|
13050 | clip.set('parent', self.get('parent'));
|
13051 | clip.set('context', self.get('context'));
|
13052 | clip.inside = function (x, y) {
|
13053 | var v = [x, y, 1];
|
13054 | clip.invert(v, self.get('canvas'));
|
13055 | return clip.__isPointInFill(v[0], v[1]);
|
13056 | };
|
13057 | return clip;
|
13058 | }
|
13059 | return null;
|
13060 | },
|
13061 | __setAttrTrans: function __setAttrTrans(value) {
|
13062 | return this.transform(value);
|
13063 | }
|
13064 | };
|
13065 |
|
13066 |
|
13067 | },
|
13068 |
|
13069 | function (module, exports, __webpack_require__) {
|
13070 |
|
13071 | var Util = __webpack_require__(0);
|
13072 | var mat3 = __webpack_require__(3).mat3;
|
13073 | var vec3 = __webpack_require__(3).vec3;
|
13074 |
|
13075 |
|
13076 | function isUnchanged(m) {
|
13077 | return m[0] === 1 && m[1] === 0 && m[3] === 0 && m[4] === 1 && m[6] === 0 && m[7] === 0;
|
13078 | }
|
13079 |
|
13080 |
|
13081 | function isScale(m) {
|
13082 | return m[1] === 0 && m[3] === 0 && m[6] === 0 && m[7] === 0;
|
13083 | }
|
13084 |
|
13085 | function multiple(m1, m2) {
|
13086 | if (!isUnchanged(m2)) {
|
13087 | if (isScale(m2)) {
|
13088 | m1[0] *= m2[0];
|
13089 | m1[4] *= m2[4];
|
13090 | } else {
|
13091 | mat3.multiply(m1, m1, m2);
|
13092 | }
|
13093 | }
|
13094 | }
|
13095 |
|
13096 | module.exports = {
|
13097 | initTransform: function initTransform() {
|
13098 | this.attr('matrix', [1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
13099 | },
|
13100 | translate: function translate(tx, ty) {
|
13101 | var matrix = this.attr('matrix');
|
13102 | mat3.translate(matrix, matrix, [tx, ty]);
|
13103 | this.clearTotalMatrix();
|
13104 | this.attr('matrix', matrix);
|
13105 | return this;
|
13106 | },
|
13107 | rotate: function rotate(radian) {
|
13108 | var matrix = this.attr('matrix');
|
13109 | mat3.rotate(matrix, matrix, radian);
|
13110 | this.clearTotalMatrix();
|
13111 | this.attr('matrix', matrix);
|
13112 | return this;
|
13113 | },
|
13114 | scale: function scale(s1, s2) {
|
13115 | var matrix = this.attr('matrix');
|
13116 | mat3.scale(matrix, matrix, [s1, s2]);
|
13117 | this.clearTotalMatrix();
|
13118 | this.attr('matrix', matrix);
|
13119 | return this;
|
13120 | },
|
13121 |
|
13122 | |
13123 |
|
13124 |
|
13125 |
|
13126 | rotateAtStart: function rotateAtStart(rotate) {
|
13127 | var x = this.attr('x');
|
13128 | var y = this.attr('y');
|
13129 | if (Math.abs(rotate) > Math.PI * 2) {
|
13130 | rotate = rotate / 180 * Math.PI;
|
13131 | }
|
13132 | this.transform([['t', -x, -y], ['r', rotate], ['t', x, y]]);
|
13133 | },
|
13134 |
|
13135 | |
13136 |
|
13137 |
|
13138 |
|
13139 |
|
13140 | move: function move(x, y) {
|
13141 | var cx = this.get('x') || 0;
|
13142 | var cy = this.get('y') || 0;
|
13143 | this.translate(x - cx, y - cy);
|
13144 | this.set('x', x);
|
13145 | this.set('y', y);
|
13146 | },
|
13147 | transform: function transform(ts) {
|
13148 | var self = this;
|
13149 | var matrix = self.attr('matrix');
|
13150 |
|
13151 | Util.each(ts, function (t) {
|
13152 | switch (t[0]) {
|
13153 | case 't':
|
13154 | self.translate(t[1], t[2]);
|
13155 | break;
|
13156 | case 's':
|
13157 | self.scale(t[1], t[2]);
|
13158 | break;
|
13159 | case 'r':
|
13160 | self.rotate(t[1]);
|
13161 | break;
|
13162 | case 'm':
|
13163 | self.attr('matrix', mat3.multiply([], matrix, t[1]));
|
13164 | self.clearTotalMatrix();
|
13165 | break;
|
13166 | default:
|
13167 | break;
|
13168 | }
|
13169 | });
|
13170 | return self;
|
13171 | },
|
13172 | setTransform: function setTransform(ts) {
|
13173 | this.attr('matrix', [1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
13174 | return this.transform(ts);
|
13175 | },
|
13176 | getMatrix: function getMatrix() {
|
13177 | return this.attr('matrix');
|
13178 | },
|
13179 | setMatrix: function setMatrix(m) {
|
13180 | this.attr('matrix', m);
|
13181 | this.clearTotalMatrix();
|
13182 | return this;
|
13183 | },
|
13184 | apply: function apply(v, root) {
|
13185 | var m = void 0;
|
13186 | if (root) {
|
13187 | m = this._getMatrixByRoot(root);
|
13188 | } else {
|
13189 | m = this.attr('matrix');
|
13190 | }
|
13191 | vec3.transformMat3(v, v, m);
|
13192 | return this;
|
13193 | },
|
13194 |
|
13195 |
|
13196 | _getMatrixByRoot: function _getMatrixByRoot(root) {
|
13197 | var self = this;
|
13198 | root = root || self;
|
13199 | var parent = self;
|
13200 | var parents = [];
|
13201 |
|
13202 | while (parent !== root) {
|
13203 | parents.unshift(parent);
|
13204 | parent = parent.get('parent');
|
13205 | }
|
13206 | parents.unshift(parent);
|
13207 |
|
13208 | var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
13209 | Util.each(parents, function (child) {
|
13210 | mat3.multiply(m, child.attr('matrix'), m);
|
13211 | });
|
13212 | return m;
|
13213 | },
|
13214 |
|
13215 | |
13216 |
|
13217 |
|
13218 |
|
13219 | getTotalMatrix: function getTotalMatrix() {
|
13220 | var m = this.__cfg.totalMatrix;
|
13221 | if (!m) {
|
13222 | m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
13223 | var parent = this.__cfg.parent;
|
13224 | if (parent) {
|
13225 | var pm = parent.getTotalMatrix();
|
13226 | multiple(m, pm);
|
13227 | }
|
13228 |
|
13229 | multiple(m, this.attr('matrix'));
|
13230 | this.__cfg.totalMatrix = m;
|
13231 | }
|
13232 | return m;
|
13233 | },
|
13234 |
|
13235 |
|
13236 | clearTotalMatrix: function clearTotalMatrix() {
|
13237 |
|
13238 | },
|
13239 | invert: function invert(v) {
|
13240 | var m = this.getTotalMatrix();
|
13241 |
|
13242 | if (isScale(m)) {
|
13243 | v[0] /= m[0];
|
13244 | v[1] /= m[4];
|
13245 | } else {
|
13246 | var inm = mat3.invert([], m);
|
13247 | vec3.transformMat3(v, v, inm);
|
13248 | }
|
13249 | return this;
|
13250 | },
|
13251 | resetTransform: function resetTransform(context) {
|
13252 | var mo = this.attr('matrix');
|
13253 |
|
13254 | if (!isUnchanged(mo)) {
|
13255 | context.transform(mo[0], mo[1], mo[3], mo[4], mo[6], mo[7]);
|
13256 | }
|
13257 | }
|
13258 | };
|
13259 |
|
13260 |
|
13261 | },
|
13262 |
|
13263 | function (module, __webpack_exports__, __webpack_require__) {
|
13264 |
|
13265 | "use strict";
|
13266 |
|
13267 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
13268 | __webpack_exports__["create"] = create;
|
13269 | __webpack_exports__["fromMat4"] = fromMat4;
|
13270 | __webpack_exports__["clone"] = clone;
|
13271 | __webpack_exports__["copy"] = copy;
|
13272 | __webpack_exports__["fromValues"] = fromValues;
|
13273 | __webpack_exports__["set"] = set;
|
13274 | /* harmony export (immutable) */__webpack_exports__["identity"] = identity;
|
13275 | /* harmony export (immutable) */__webpack_exports__["transpose"] = transpose;
|
13276 | /* harmony export (immutable) */__webpack_exports__["invert"] = invert;
|
13277 | /* harmony export (immutable) */__webpack_exports__["adjoint"] = adjoint;
|
13278 | /* harmony export (immutable) */__webpack_exports__["determinant"] = determinant;
|
13279 | /* harmony export (immutable) */__webpack_exports__["multiply"] = multiply;
|
13280 | /* harmony export (immutable) */__webpack_exports__["translate"] = translate;
|
13281 | /* harmony export (immutable) */__webpack_exports__["rotate"] = rotate;
|
13282 | /* harmony export (immutable) */__webpack_exports__["scale"] = scale;
|
13283 | /* harmony export (immutable) */__webpack_exports__["fromTranslation"] = fromTranslation;
|
13284 | /* harmony export (immutable) */__webpack_exports__["fromRotation"] = fromRotation;
|
13285 | /* harmony export (immutable) */__webpack_exports__["fromScaling"] = fromScaling;
|
13286 | /* harmony export (immutable) */__webpack_exports__["fromMat2d"] = fromMat2d;
|
13287 | /* harmony export (immutable) */__webpack_exports__["fromQuat"] = fromQuat;
|
13288 | /* harmony export (immutable) */__webpack_exports__["normalFromMat4"] = normalFromMat4;
|
13289 | /* harmony export (immutable) */__webpack_exports__["projection"] = projection;
|
13290 | /* harmony export (immutable) */__webpack_exports__["str"] = str;
|
13291 | /* harmony export (immutable) */__webpack_exports__["frob"] = frob;
|
13292 | /* harmony export (immutable) */__webpack_exports__["add"] = add;
|
13293 | /* harmony export (immutable) */__webpack_exports__["subtract"] = subtract;
|
13294 | /* harmony export (immutable) */__webpack_exports__["multiplyScalar"] = multiplyScalar;
|
13295 | /* harmony export (immutable) */__webpack_exports__["multiplyScalarAndAdd"] = multiplyScalarAndAdd;
|
13296 | /* harmony export (immutable) */__webpack_exports__["exactEquals"] = exactEquals;
|
13297 | /* harmony export (immutable) */__webpack_exports__["equals"] = equals;
|
13298 | /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "mul", function () {
|
13299 | return mul;
|
13300 | });
|
13301 | __webpack_require__.d(__webpack_exports__, "sub", function () {
|
13302 | return sub;
|
13303 | });
|
13304 | var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(45);
|
13305 | |
13306 |
|
13307 |
|
13308 |
|
13309 |
|
13310 |
|
13311 |
|
13312 |
|
13313 |
|
13314 |
|
13315 |
|
13316 |
|
13317 |
|
13318 |
|
13319 |
|
13320 |
|
13321 |
|
13322 |
|
13323 |
|
13324 |
|
13325 | |
13326 |
|
13327 |
|
13328 |
|
13329 |
|
13330 | |
13331 |
|
13332 |
|
13333 |
|
13334 |
|
13335 | function create() {
|
13336 | var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" ](9);
|
13337 | out[0] = 1;
|
13338 | out[1] = 0;
|
13339 | out[2] = 0;
|
13340 | out[3] = 0;
|
13341 | out[4] = 1;
|
13342 | out[5] = 0;
|
13343 | out[6] = 0;
|
13344 | out[7] = 0;
|
13345 | out[8] = 1;
|
13346 | return out;
|
13347 | }
|
13348 |
|
13349 | |
13350 |
|
13351 |
|
13352 |
|
13353 |
|
13354 |
|
13355 |
|
13356 | function fromMat4(out, a) {
|
13357 | out[0] = a[0];
|
13358 | out[1] = a[1];
|
13359 | out[2] = a[2];
|
13360 | out[3] = a[4];
|
13361 | out[4] = a[5];
|
13362 | out[5] = a[6];
|
13363 | out[6] = a[8];
|
13364 | out[7] = a[9];
|
13365 | out[8] = a[10];
|
13366 | return out;
|
13367 | }
|
13368 |
|
13369 | |
13370 |
|
13371 |
|
13372 |
|
13373 |
|
13374 |
|
13375 | function clone(a) {
|
13376 | var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" ](9);
|
13377 | out[0] = a[0];
|
13378 | out[1] = a[1];
|
13379 | out[2] = a[2];
|
13380 | out[3] = a[3];
|
13381 | out[4] = a[4];
|
13382 | out[5] = a[5];
|
13383 | out[6] = a[6];
|
13384 | out[7] = a[7];
|
13385 | out[8] = a[8];
|
13386 | return out;
|
13387 | }
|
13388 |
|
13389 | |
13390 |
|
13391 |
|
13392 |
|
13393 |
|
13394 |
|
13395 |
|
13396 | function copy(out, a) {
|
13397 | out[0] = a[0];
|
13398 | out[1] = a[1];
|
13399 | out[2] = a[2];
|
13400 | out[3] = a[3];
|
13401 | out[4] = a[4];
|
13402 | out[5] = a[5];
|
13403 | out[6] = a[6];
|
13404 | out[7] = a[7];
|
13405 | out[8] = a[8];
|
13406 | return out;
|
13407 | }
|
13408 |
|
13409 | |
13410 |
|
13411 |
|
13412 |
|
13413 |
|
13414 |
|
13415 |
|
13416 |
|
13417 |
|
13418 |
|
13419 |
|
13420 |
|
13421 |
|
13422 |
|
13423 | function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
|
13424 | var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" ](9);
|
13425 | out[0] = m00;
|
13426 | out[1] = m01;
|
13427 | out[2] = m02;
|
13428 | out[3] = m10;
|
13429 | out[4] = m11;
|
13430 | out[5] = m12;
|
13431 | out[6] = m20;
|
13432 | out[7] = m21;
|
13433 | out[8] = m22;
|
13434 | return out;
|
13435 | }
|
13436 |
|
13437 | |
13438 |
|
13439 |
|
13440 |
|
13441 |
|
13442 |
|
13443 |
|
13444 |
|
13445 |
|
13446 |
|
13447 |
|
13448 |
|
13449 |
|
13450 |
|
13451 |
|
13452 | function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {
|
13453 | out[0] = m00;
|
13454 | out[1] = m01;
|
13455 | out[2] = m02;
|
13456 | out[3] = m10;
|
13457 | out[4] = m11;
|
13458 | out[5] = m12;
|
13459 | out[6] = m20;
|
13460 | out[7] = m21;
|
13461 | out[8] = m22;
|
13462 | return out;
|
13463 | }
|
13464 |
|
13465 | |
13466 |
|
13467 |
|
13468 |
|
13469 |
|
13470 |
|
13471 | function identity(out) {
|
13472 | out[0] = 1;
|
13473 | out[1] = 0;
|
13474 | out[2] = 0;
|
13475 | out[3] = 0;
|
13476 | out[4] = 1;
|
13477 | out[5] = 0;
|
13478 | out[6] = 0;
|
13479 | out[7] = 0;
|
13480 | out[8] = 1;
|
13481 | return out;
|
13482 | }
|
13483 |
|
13484 | |
13485 |
|
13486 |
|
13487 |
|
13488 |
|
13489 |
|
13490 |
|
13491 | function transpose(out, a) {
|
13492 |
|
13493 | if (out === a) {
|
13494 | var a01 = a[1],
|
13495 | a02 = a[2],
|
13496 | a12 = a[5];
|
13497 | out[1] = a[3];
|
13498 | out[2] = a[6];
|
13499 | out[3] = a01;
|
13500 | out[5] = a[7];
|
13501 | out[6] = a02;
|
13502 | out[7] = a12;
|
13503 | } else {
|
13504 | out[0] = a[0];
|
13505 | out[1] = a[3];
|
13506 | out[2] = a[6];
|
13507 | out[3] = a[1];
|
13508 | out[4] = a[4];
|
13509 | out[5] = a[7];
|
13510 | out[6] = a[2];
|
13511 | out[7] = a[5];
|
13512 | out[8] = a[8];
|
13513 | }
|
13514 |
|
13515 | return out;
|
13516 | }
|
13517 |
|
13518 | |
13519 |
|
13520 |
|
13521 |
|
13522 |
|
13523 |
|
13524 |
|
13525 | function invert(out, a) {
|
13526 | var a00 = a[0],
|
13527 | a01 = a[1],
|
13528 | a02 = a[2];
|
13529 | var a10 = a[3],
|
13530 | a11 = a[4],
|
13531 | a12 = a[5];
|
13532 | var a20 = a[6],
|
13533 | a21 = a[7],
|
13534 | a22 = a[8];
|
13535 |
|
13536 | var b01 = a22 * a11 - a12 * a21;
|
13537 | var b11 = -a22 * a10 + a12 * a20;
|
13538 | var b21 = a21 * a10 - a11 * a20;
|
13539 |
|
13540 |
|
13541 | var det = a00 * b01 + a01 * b11 + a02 * b21;
|
13542 |
|
13543 | if (!det) {
|
13544 | return null;
|
13545 | }
|
13546 | det = 1.0 / det;
|
13547 |
|
13548 | out[0] = b01 * det;
|
13549 | out[1] = (-a22 * a01 + a02 * a21) * det;
|
13550 | out[2] = (a12 * a01 - a02 * a11) * det;
|
13551 | out[3] = b11 * det;
|
13552 | out[4] = (a22 * a00 - a02 * a20) * det;
|
13553 | out[5] = (-a12 * a00 + a02 * a10) * det;
|
13554 | out[6] = b21 * det;
|
13555 | out[7] = (-a21 * a00 + a01 * a20) * det;
|
13556 | out[8] = (a11 * a00 - a01 * a10) * det;
|
13557 | return out;
|
13558 | }
|
13559 |
|
13560 | |
13561 |
|
13562 |
|
13563 |
|
13564 |
|
13565 |
|
13566 |
|
13567 | function adjoint(out, a) {
|
13568 | var a00 = a[0],
|
13569 | a01 = a[1],
|
13570 | a02 = a[2];
|
13571 | var a10 = a[3],
|
13572 | a11 = a[4],
|
13573 | a12 = a[5];
|
13574 | var a20 = a[6],
|
13575 | a21 = a[7],
|
13576 | a22 = a[8];
|
13577 |
|
13578 | out[0] = a11 * a22 - a12 * a21;
|
13579 | out[1] = a02 * a21 - a01 * a22;
|
13580 | out[2] = a01 * a12 - a02 * a11;
|
13581 | out[3] = a12 * a20 - a10 * a22;
|
13582 | out[4] = a00 * a22 - a02 * a20;
|
13583 | out[5] = a02 * a10 - a00 * a12;
|
13584 | out[6] = a10 * a21 - a11 * a20;
|
13585 | out[7] = a01 * a20 - a00 * a21;
|
13586 | out[8] = a00 * a11 - a01 * a10;
|
13587 | return out;
|
13588 | }
|
13589 |
|
13590 | |
13591 |
|
13592 |
|
13593 |
|
13594 |
|
13595 |
|
13596 | function determinant(a) {
|
13597 | var a00 = a[0],
|
13598 | a01 = a[1],
|
13599 | a02 = a[2];
|
13600 | var a10 = a[3],
|
13601 | a11 = a[4],
|
13602 | a12 = a[5];
|
13603 | var a20 = a[6],
|
13604 | a21 = a[7],
|
13605 | a22 = a[8];
|
13606 |
|
13607 | return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
|
13608 | }
|
13609 |
|
13610 | |
13611 |
|
13612 |
|
13613 |
|
13614 |
|
13615 |
|
13616 |
|
13617 |
|
13618 | function multiply(out, a, b) {
|
13619 | var a00 = a[0],
|
13620 | a01 = a[1],
|
13621 | a02 = a[2];
|
13622 | var a10 = a[3],
|
13623 | a11 = a[4],
|
13624 | a12 = a[5];
|
13625 | var a20 = a[6],
|
13626 | a21 = a[7],
|
13627 | a22 = a[8];
|
13628 |
|
13629 | var b00 = b[0],
|
13630 | b01 = b[1],
|
13631 | b02 = b[2];
|
13632 | var b10 = b[3],
|
13633 | b11 = b[4],
|
13634 | b12 = b[5];
|
13635 | var b20 = b[6],
|
13636 | b21 = b[7],
|
13637 | b22 = b[8];
|
13638 |
|
13639 | out[0] = b00 * a00 + b01 * a10 + b02 * a20;
|
13640 | out[1] = b00 * a01 + b01 * a11 + b02 * a21;
|
13641 | out[2] = b00 * a02 + b01 * a12 + b02 * a22;
|
13642 |
|
13643 | out[3] = b10 * a00 + b11 * a10 + b12 * a20;
|
13644 | out[4] = b10 * a01 + b11 * a11 + b12 * a21;
|
13645 | out[5] = b10 * a02 + b11 * a12 + b12 * a22;
|
13646 |
|
13647 | out[6] = b20 * a00 + b21 * a10 + b22 * a20;
|
13648 | out[7] = b20 * a01 + b21 * a11 + b22 * a21;
|
13649 | out[8] = b20 * a02 + b21 * a12 + b22 * a22;
|
13650 | return out;
|
13651 | }
|
13652 |
|
13653 | |
13654 |
|
13655 |
|
13656 |
|
13657 |
|
13658 |
|
13659 |
|
13660 |
|
13661 | function translate(out, a, v) {
|
13662 | var a00 = a[0],
|
13663 | a01 = a[1],
|
13664 | a02 = a[2],
|
13665 | a10 = a[3],
|
13666 | a11 = a[4],
|
13667 | a12 = a[5],
|
13668 | a20 = a[6],
|
13669 | a21 = a[7],
|
13670 | a22 = a[8],
|
13671 | x = v[0],
|
13672 | y = v[1];
|
13673 |
|
13674 | out[0] = a00;
|
13675 | out[1] = a01;
|
13676 | out[2] = a02;
|
13677 |
|
13678 | out[3] = a10;
|
13679 | out[4] = a11;
|
13680 | out[5] = a12;
|
13681 |
|
13682 | out[6] = x * a00 + y * a10 + a20;
|
13683 | out[7] = x * a01 + y * a11 + a21;
|
13684 | out[8] = x * a02 + y * a12 + a22;
|
13685 | return out;
|
13686 | }
|
13687 |
|
13688 | |
13689 |
|
13690 |
|
13691 |
|
13692 |
|
13693 |
|
13694 |
|
13695 |
|
13696 | function rotate(out, a, rad) {
|
13697 | var a00 = a[0],
|
13698 | a01 = a[1],
|
13699 | a02 = a[2],
|
13700 | a10 = a[3],
|
13701 | a11 = a[4],
|
13702 | a12 = a[5],
|
13703 | a20 = a[6],
|
13704 | a21 = a[7],
|
13705 | a22 = a[8],
|
13706 | s = Math.sin(rad),
|
13707 | c = Math.cos(rad);
|
13708 |
|
13709 | out[0] = c * a00 + s * a10;
|
13710 | out[1] = c * a01 + s * a11;
|
13711 | out[2] = c * a02 + s * a12;
|
13712 |
|
13713 | out[3] = c * a10 - s * a00;
|
13714 | out[4] = c * a11 - s * a01;
|
13715 | out[5] = c * a12 - s * a02;
|
13716 |
|
13717 | out[6] = a20;
|
13718 | out[7] = a21;
|
13719 | out[8] = a22;
|
13720 | return out;
|
13721 | };
|
13722 |
|
13723 | |
13724 |
|
13725 |
|
13726 |
|
13727 |
|
13728 |
|
13729 |
|
13730 |
|
13731 | function scale(out, a, v) {
|
13732 | var x = v[0],
|
13733 | y = v[1];
|
13734 |
|
13735 | out[0] = x * a[0];
|
13736 | out[1] = x * a[1];
|
13737 | out[2] = x * a[2];
|
13738 |
|
13739 | out[3] = y * a[3];
|
13740 | out[4] = y * a[4];
|
13741 | out[5] = y * a[5];
|
13742 |
|
13743 | out[6] = a[6];
|
13744 | out[7] = a[7];
|
13745 | out[8] = a[8];
|
13746 | return out;
|
13747 | }
|
13748 |
|
13749 | |
13750 |
|
13751 |
|
13752 |
|
13753 |
|
13754 |
|
13755 |
|
13756 |
|
13757 |
|
13758 |
|
13759 |
|
13760 | function fromTranslation(out, v) {
|
13761 | out[0] = 1;
|
13762 | out[1] = 0;
|
13763 | out[2] = 0;
|
13764 | out[3] = 0;
|
13765 | out[4] = 1;
|
13766 | out[5] = 0;
|
13767 | out[6] = v[0];
|
13768 | out[7] = v[1];
|
13769 | out[8] = 1;
|
13770 | return out;
|
13771 | }
|
13772 |
|
13773 | |
13774 |
|
13775 |
|
13776 |
|
13777 |
|
13778 |
|
13779 |
|
13780 |
|
13781 |
|
13782 |
|
13783 |
|
13784 | function fromRotation(out, rad) {
|
13785 | var s = Math.sin(rad),
|
13786 | c = Math.cos(rad);
|
13787 |
|
13788 | out[0] = c;
|
13789 | out[1] = s;
|
13790 | out[2] = 0;
|
13791 |
|
13792 | out[3] = -s;
|
13793 | out[4] = c;
|
13794 | out[5] = 0;
|
13795 |
|
13796 | out[6] = 0;
|
13797 | out[7] = 0;
|
13798 | out[8] = 1;
|
13799 | return out;
|
13800 | }
|
13801 |
|
13802 | |
13803 |
|
13804 |
|
13805 |
|
13806 |
|
13807 |
|
13808 |
|
13809 |
|
13810 |
|
13811 |
|
13812 |
|
13813 | function fromScaling(out, v) {
|
13814 | out[0] = v[0];
|
13815 | out[1] = 0;
|
13816 | out[2] = 0;
|
13817 |
|
13818 | out[3] = 0;
|
13819 | out[4] = v[1];
|
13820 | out[5] = 0;
|
13821 |
|
13822 | out[6] = 0;
|
13823 | out[7] = 0;
|
13824 | out[8] = 1;
|
13825 | return out;
|
13826 | }
|
13827 |
|
13828 | |
13829 |
|
13830 |
|
13831 |
|
13832 |
|
13833 |
|
13834 |
|
13835 | function fromMat2d(out, a) {
|
13836 | out[0] = a[0];
|
13837 | out[1] = a[1];
|
13838 | out[2] = 0;
|
13839 |
|
13840 | out[3] = a[2];
|
13841 | out[4] = a[3];
|
13842 | out[5] = 0;
|
13843 |
|
13844 | out[6] = a[4];
|
13845 | out[7] = a[5];
|
13846 | out[8] = 1;
|
13847 | return out;
|
13848 | }
|
13849 |
|
13850 | |
13851 |
|
13852 |
|
13853 |
|
13854 |
|
13855 |
|
13856 |
|
13857 |
|
13858 | function fromQuat(out, q) {
|
13859 | var x = q[0],
|
13860 | y = q[1],
|
13861 | z = q[2],
|
13862 | w = q[3];
|
13863 | var x2 = x + x;
|
13864 | var y2 = y + y;
|
13865 | var z2 = z + z;
|
13866 |
|
13867 | var xx = x * x2;
|
13868 | var yx = y * x2;
|
13869 | var yy = y * y2;
|
13870 | var zx = z * x2;
|
13871 | var zy = z * y2;
|
13872 | var zz = z * z2;
|
13873 | var wx = w * x2;
|
13874 | var wy = w * y2;
|
13875 | var wz = w * z2;
|
13876 |
|
13877 | out[0] = 1 - yy - zz;
|
13878 | out[3] = yx - wz;
|
13879 | out[6] = zx + wy;
|
13880 |
|
13881 | out[1] = yx + wz;
|
13882 | out[4] = 1 - xx - zz;
|
13883 | out[7] = zy - wx;
|
13884 |
|
13885 | out[2] = zx - wy;
|
13886 | out[5] = zy + wx;
|
13887 | out[8] = 1 - xx - yy;
|
13888 |
|
13889 | return out;
|
13890 | }
|
13891 |
|
13892 | |
13893 |
|
13894 |
|
13895 |
|
13896 |
|
13897 |
|
13898 |
|
13899 |
|
13900 | function normalFromMat4(out, a) {
|
13901 | var a00 = a[0],
|
13902 | a01 = a[1],
|
13903 | a02 = a[2],
|
13904 | a03 = a[3];
|
13905 | var a10 = a[4],
|
13906 | a11 = a[5],
|
13907 | a12 = a[6],
|
13908 | a13 = a[7];
|
13909 | var a20 = a[8],
|
13910 | a21 = a[9],
|
13911 | a22 = a[10],
|
13912 | a23 = a[11];
|
13913 | var a30 = a[12],
|
13914 | a31 = a[13],
|
13915 | a32 = a[14],
|
13916 | a33 = a[15];
|
13917 |
|
13918 | var b00 = a00 * a11 - a01 * a10;
|
13919 | var b01 = a00 * a12 - a02 * a10;
|
13920 | var b02 = a00 * a13 - a03 * a10;
|
13921 | var b03 = a01 * a12 - a02 * a11;
|
13922 | var b04 = a01 * a13 - a03 * a11;
|
13923 | var b05 = a02 * a13 - a03 * a12;
|
13924 | var b06 = a20 * a31 - a21 * a30;
|
13925 | var b07 = a20 * a32 - a22 * a30;
|
13926 | var b08 = a20 * a33 - a23 * a30;
|
13927 | var b09 = a21 * a32 - a22 * a31;
|
13928 | var b10 = a21 * a33 - a23 * a31;
|
13929 | var b11 = a22 * a33 - a23 * a32;
|
13930 |
|
13931 |
|
13932 | var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
|
13933 |
|
13934 | if (!det) {
|
13935 | return null;
|
13936 | }
|
13937 | det = 1.0 / det;
|
13938 |
|
13939 | out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
|
13940 | out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
|
13941 | out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
|
13942 |
|
13943 | out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
|
13944 | out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
|
13945 | out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
|
13946 |
|
13947 | out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
|
13948 | out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
|
13949 | out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
|
13950 |
|
13951 | return out;
|
13952 | }
|
13953 |
|
13954 | |
13955 |
|
13956 |
|
13957 |
|
13958 |
|
13959 |
|
13960 |
|
13961 |
|
13962 | function projection(out, width, height) {
|
13963 | out[0] = 2 / width;
|
13964 | out[1] = 0;
|
13965 | out[2] = 0;
|
13966 | out[3] = 0;
|
13967 | out[4] = -2 / height;
|
13968 | out[5] = 0;
|
13969 | out[6] = -1;
|
13970 | out[7] = 1;
|
13971 | out[8] = 1;
|
13972 | return out;
|
13973 | }
|
13974 |
|
13975 | |
13976 |
|
13977 |
|
13978 |
|
13979 |
|
13980 |
|
13981 | function str(a) {
|
13982 | return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ')';
|
13983 | }
|
13984 |
|
13985 | |
13986 |
|
13987 |
|
13988 |
|
13989 |
|
13990 |
|
13991 | function frob(a) {
|
13992 | return Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2));
|
13993 | }
|
13994 |
|
13995 | |
13996 |
|
13997 |
|
13998 |
|
13999 |
|
14000 |
|
14001 |
|
14002 |
|
14003 | function add(out, a, b) {
|
14004 | out[0] = a[0] + b[0];
|
14005 | out[1] = a[1] + b[1];
|
14006 | out[2] = a[2] + b[2];
|
14007 | out[3] = a[3] + b[3];
|
14008 | out[4] = a[4] + b[4];
|
14009 | out[5] = a[5] + b[5];
|
14010 | out[6] = a[6] + b[6];
|
14011 | out[7] = a[7] + b[7];
|
14012 | out[8] = a[8] + b[8];
|
14013 | return out;
|
14014 | }
|
14015 |
|
14016 | |
14017 |
|
14018 |
|
14019 |
|
14020 |
|
14021 |
|
14022 |
|
14023 |
|
14024 | function subtract(out, a, b) {
|
14025 | out[0] = a[0] - b[0];
|
14026 | out[1] = a[1] - b[1];
|
14027 | out[2] = a[2] - b[2];
|
14028 | out[3] = a[3] - b[3];
|
14029 | out[4] = a[4] - b[4];
|
14030 | out[5] = a[5] - b[5];
|
14031 | out[6] = a[6] - b[6];
|
14032 | out[7] = a[7] - b[7];
|
14033 | out[8] = a[8] - b[8];
|
14034 | return out;
|
14035 | }
|
14036 |
|
14037 | |
14038 |
|
14039 |
|
14040 |
|
14041 |
|
14042 |
|
14043 |
|
14044 |
|
14045 | function multiplyScalar(out, a, b) {
|
14046 | out[0] = a[0] * b;
|
14047 | out[1] = a[1] * b;
|
14048 | out[2] = a[2] * b;
|
14049 | out[3] = a[3] * b;
|
14050 | out[4] = a[4] * b;
|
14051 | out[5] = a[5] * b;
|
14052 | out[6] = a[6] * b;
|
14053 | out[7] = a[7] * b;
|
14054 | out[8] = a[8] * b;
|
14055 | return out;
|
14056 | }
|
14057 |
|
14058 | |
14059 |
|
14060 |
|
14061 |
|
14062 |
|
14063 |
|
14064 |
|
14065 |
|
14066 |
|
14067 | function multiplyScalarAndAdd(out, a, b, scale) {
|
14068 | out[0] = a[0] + b[0] * scale;
|
14069 | out[1] = a[1] + b[1] * scale;
|
14070 | out[2] = a[2] + b[2] * scale;
|
14071 | out[3] = a[3] + b[3] * scale;
|
14072 | out[4] = a[4] + b[4] * scale;
|
14073 | out[5] = a[5] + b[5] * scale;
|
14074 | out[6] = a[6] + b[6] * scale;
|
14075 | out[7] = a[7] + b[7] * scale;
|
14076 | out[8] = a[8] + b[8] * scale;
|
14077 | return out;
|
14078 | }
|
14079 |
|
14080 | |
14081 |
|
14082 |
|
14083 |
|
14084 |
|
14085 |
|
14086 |
|
14087 | function exactEquals(a, b) {
|
14088 | return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];
|
14089 | }
|
14090 |
|
14091 | |
14092 |
|
14093 |
|
14094 |
|
14095 |
|
14096 |
|
14097 |
|
14098 | function equals(a, b) {
|
14099 | var a0 = a[0],
|
14100 | a1 = a[1],
|
14101 | a2 = a[2],
|
14102 | a3 = a[3],
|
14103 | a4 = a[4],
|
14104 | a5 = a[5],
|
14105 | a6 = a[6],
|
14106 | a7 = a[7],
|
14107 | a8 = a[8];
|
14108 | var b0 = b[0],
|
14109 | b1 = b[1],
|
14110 | b2 = b[2],
|
14111 | b3 = b[3],
|
14112 | b4 = b[4],
|
14113 | b5 = b[5],
|
14114 | b6 = b[6],
|
14115 | b7 = b[7],
|
14116 | b8 = b[8];
|
14117 | return Math.abs(a0 - b0) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a8), Math.abs(b8));
|
14118 | }
|
14119 |
|
14120 | |
14121 |
|
14122 |
|
14123 |
|
14124 | var mul = multiply;
|
14125 |
|
14126 | |
14127 |
|
14128 |
|
14129 |
|
14130 | var sub = subtract;
|
14131 |
|
14132 |
|
14133 | },
|
14134 |
|
14135 | function (module, __webpack_exports__, __webpack_require__) {
|
14136 |
|
14137 | "use strict";
|
14138 |
|
14139 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
14140 | __webpack_exports__["create"] = create;
|
14141 | __webpack_exports__["clone"] = clone;
|
14142 | __webpack_exports__["length"] = length;
|
14143 | __webpack_exports__["fromValues"] = fromValues;
|
14144 | __webpack_exports__["copy"] = copy;
|
14145 | __webpack_exports__["set"] = set;
|
14146 | /* harmony export (immutable) */__webpack_exports__["add"] = add;
|
14147 | /* harmony export (immutable) */__webpack_exports__["subtract"] = subtract;
|
14148 | /* harmony export (immutable) */__webpack_exports__["multiply"] = multiply;
|
14149 | /* harmony export (immutable) */__webpack_exports__["divide"] = divide;
|
14150 | /* harmony export (immutable) */__webpack_exports__["ceil"] = ceil;
|
14151 | /* harmony export (immutable) */__webpack_exports__["floor"] = floor;
|
14152 | /* harmony export (immutable) */__webpack_exports__["min"] = min;
|
14153 | /* harmony export (immutable) */__webpack_exports__["max"] = max;
|
14154 | /* harmony export (immutable) */__webpack_exports__["round"] = round;
|
14155 | /* harmony export (immutable) */__webpack_exports__["scale"] = scale;
|
14156 | /* harmony export (immutable) */__webpack_exports__["scaleAndAdd"] = scaleAndAdd;
|
14157 | /* harmony export (immutable) */__webpack_exports__["distance"] = distance;
|
14158 | /* harmony export (immutable) */__webpack_exports__["squaredDistance"] = squaredDistance;
|
14159 | /* harmony export (immutable) */__webpack_exports__["squaredLength"] = squaredLength;
|
14160 | /* harmony export (immutable) */__webpack_exports__["negate"] = negate;
|
14161 | /* harmony export (immutable) */__webpack_exports__["inverse"] = inverse;
|
14162 | /* harmony export (immutable) */__webpack_exports__["normalize"] = normalize;
|
14163 | /* harmony export (immutable) */__webpack_exports__["dot"] = dot;
|
14164 | /* harmony export (immutable) */__webpack_exports__["cross"] = cross;
|
14165 | /* harmony export (immutable) */__webpack_exports__["lerp"] = lerp;
|
14166 | /* harmony export (immutable) */__webpack_exports__["hermite"] = hermite;
|
14167 | /* harmony export (immutable) */__webpack_exports__["bezier"] = bezier;
|
14168 | /* harmony export (immutable) */__webpack_exports__["random"] = random;
|
14169 | /* harmony export (immutable) */__webpack_exports__["transformMat4"] = transformMat4;
|
14170 | /* harmony export (immutable) */__webpack_exports__["transformMat3"] = transformMat3;
|
14171 | /* harmony export (immutable) */__webpack_exports__["transformQuat"] = transformQuat;
|
14172 | /* harmony export (immutable) */__webpack_exports__["rotateX"] = rotateX;
|
14173 | /* harmony export (immutable) */__webpack_exports__["rotateY"] = rotateY;
|
14174 | /* harmony export (immutable) */__webpack_exports__["rotateZ"] = rotateZ;
|
14175 | /* harmony export (immutable) */__webpack_exports__["angle"] = angle;
|
14176 | /* harmony export (immutable) */__webpack_exports__["str"] = str;
|
14177 | /* harmony export (immutable) */__webpack_exports__["exactEquals"] = exactEquals;
|
14178 | /* harmony export (immutable) */__webpack_exports__["equals"] = equals;
|
14179 | /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "sub", function () {
|
14180 | return sub;
|
14181 | });
|
14182 | __webpack_require__.d(__webpack_exports__, "mul", function () {
|
14183 | return mul;
|
14184 | });
|
14185 | __webpack_require__.d(__webpack_exports__, "div", function () {
|
14186 | return div;
|
14187 | });
|
14188 | __webpack_require__.d(__webpack_exports__, "dist", function () {
|
14189 | return dist;
|
14190 | });
|
14191 | __webpack_require__.d(__webpack_exports__, "sqrDist", function () {
|
14192 | return sqrDist;
|
14193 | });
|
14194 | __webpack_require__.d(__webpack_exports__, "len", function () {
|
14195 | return len;
|
14196 | });
|
14197 | __webpack_require__.d(__webpack_exports__, "sqrLen", function () {
|
14198 | return sqrLen;
|
14199 | });
|
14200 | __webpack_require__.d(__webpack_exports__, "forEach", function () {
|
14201 | return forEach;
|
14202 | });
|
14203 | var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(45);
|
14204 | |
14205 |
|
14206 |
|
14207 |
|
14208 |
|
14209 |
|
14210 |
|
14211 |
|
14212 |
|
14213 |
|
14214 |
|
14215 |
|
14216 |
|
14217 |
|
14218 |
|
14219 |
|
14220 |
|
14221 |
|
14222 |
|
14223 |
|
14224 | |
14225 |
|
14226 |
|
14227 |
|
14228 |
|
14229 | |
14230 |
|
14231 |
|
14232 |
|
14233 |
|
14234 | function create() {
|
14235 | var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" ](3);
|
14236 | out[0] = 0;
|
14237 | out[1] = 0;
|
14238 | out[2] = 0;
|
14239 | return out;
|
14240 | }
|
14241 |
|
14242 | |
14243 |
|
14244 |
|
14245 |
|
14246 |
|
14247 |
|
14248 | function clone(a) {
|
14249 | var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" ](3);
|
14250 | out[0] = a[0];
|
14251 | out[1] = a[1];
|
14252 | out[2] = a[2];
|
14253 | return out;
|
14254 | }
|
14255 |
|
14256 | |
14257 |
|
14258 |
|
14259 |
|
14260 |
|
14261 |
|
14262 | function length(a) {
|
14263 | var x = a[0];
|
14264 | var y = a[1];
|
14265 | var z = a[2];
|
14266 | return Math.sqrt(x * x + y * y + z * z);
|
14267 | }
|
14268 |
|
14269 | |
14270 |
|
14271 |
|
14272 |
|
14273 |
|
14274 |
|
14275 |
|
14276 |
|
14277 | function fromValues(x, y, z) {
|
14278 | var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" ](3);
|
14279 | out[0] = x;
|
14280 | out[1] = y;
|
14281 | out[2] = z;
|
14282 | return out;
|
14283 | }
|
14284 |
|
14285 | |
14286 |
|
14287 |
|
14288 |
|
14289 |
|
14290 |
|
14291 |
|
14292 | function copy(out, a) {
|
14293 | out[0] = a[0];
|
14294 | out[1] = a[1];
|
14295 | out[2] = a[2];
|
14296 | return out;
|
14297 | }
|
14298 |
|
14299 | |
14300 |
|
14301 |
|
14302 |
|
14303 |
|
14304 |
|
14305 |
|
14306 |
|
14307 |
|
14308 | function set(out, x, y, z) {
|
14309 | out[0] = x;
|
14310 | out[1] = y;
|
14311 | out[2] = z;
|
14312 | return out;
|
14313 | }
|
14314 |
|
14315 | |
14316 |
|
14317 |
|
14318 |
|
14319 |
|
14320 |
|
14321 |
|
14322 |
|
14323 | function add(out, a, b) {
|
14324 | out[0] = a[0] + b[0];
|
14325 | out[1] = a[1] + b[1];
|
14326 | out[2] = a[2] + b[2];
|
14327 | return out;
|
14328 | }
|
14329 |
|
14330 | |
14331 |
|
14332 |
|
14333 |
|
14334 |
|
14335 |
|
14336 |
|
14337 |
|
14338 | function subtract(out, a, b) {
|
14339 | out[0] = a[0] - b[0];
|
14340 | out[1] = a[1] - b[1];
|
14341 | out[2] = a[2] - b[2];
|
14342 | return out;
|
14343 | }
|
14344 |
|
14345 | |
14346 |
|
14347 |
|
14348 |
|
14349 |
|
14350 |
|
14351 |
|
14352 |
|
14353 | function multiply(out, a, b) {
|
14354 | out[0] = a[0] * b[0];
|
14355 | out[1] = a[1] * b[1];
|
14356 | out[2] = a[2] * b[2];
|
14357 | return out;
|
14358 | }
|
14359 |
|
14360 | |
14361 |
|
14362 |
|
14363 |
|
14364 |
|
14365 |
|
14366 |
|
14367 |
|
14368 | function divide(out, a, b) {
|
14369 | out[0] = a[0] / b[0];
|
14370 | out[1] = a[1] / b[1];
|
14371 | out[2] = a[2] / b[2];
|
14372 | return out;
|
14373 | }
|
14374 |
|
14375 | |
14376 |
|
14377 |
|
14378 |
|
14379 |
|
14380 |
|
14381 |
|
14382 | function ceil(out, a) {
|
14383 | out[0] = Math.ceil(a[0]);
|
14384 | out[1] = Math.ceil(a[1]);
|
14385 | out[2] = Math.ceil(a[2]);
|
14386 | return out;
|
14387 | }
|
14388 |
|
14389 | |
14390 |
|
14391 |
|
14392 |
|
14393 |
|
14394 |
|
14395 |
|
14396 | function floor(out, a) {
|
14397 | out[0] = Math.floor(a[0]);
|
14398 | out[1] = Math.floor(a[1]);
|
14399 | out[2] = Math.floor(a[2]);
|
14400 | return out;
|
14401 | }
|
14402 |
|
14403 | |
14404 |
|
14405 |
|
14406 |
|
14407 |
|
14408 |
|
14409 |
|
14410 |
|
14411 | function min(out, a, b) {
|
14412 | out[0] = Math.min(a[0], b[0]);
|
14413 | out[1] = Math.min(a[1], b[1]);
|
14414 | out[2] = Math.min(a[2], b[2]);
|
14415 | return out;
|
14416 | }
|
14417 |
|
14418 | |
14419 |
|
14420 |
|
14421 |
|
14422 |
|
14423 |
|
14424 |
|
14425 |
|
14426 | function max(out, a, b) {
|
14427 | out[0] = Math.max(a[0], b[0]);
|
14428 | out[1] = Math.max(a[1], b[1]);
|
14429 | out[2] = Math.max(a[2], b[2]);
|
14430 | return out;
|
14431 | }
|
14432 |
|
14433 | |
14434 |
|
14435 |
|
14436 |
|
14437 |
|
14438 |
|
14439 |
|
14440 | function round(out, a) {
|
14441 | out[0] = Math.round(a[0]);
|
14442 | out[1] = Math.round(a[1]);
|
14443 | out[2] = Math.round(a[2]);
|
14444 | return out;
|
14445 | }
|
14446 |
|
14447 | |
14448 |
|
14449 |
|
14450 |
|
14451 |
|
14452 |
|
14453 |
|
14454 |
|
14455 | function scale(out, a, b) {
|
14456 | out[0] = a[0] * b;
|
14457 | out[1] = a[1] * b;
|
14458 | out[2] = a[2] * b;
|
14459 | return out;
|
14460 | }
|
14461 |
|
14462 | |
14463 |
|
14464 |
|
14465 |
|
14466 |
|
14467 |
|
14468 |
|
14469 |
|
14470 |
|
14471 | function scaleAndAdd(out, a, b, scale) {
|
14472 | out[0] = a[0] + b[0] * scale;
|
14473 | out[1] = a[1] + b[1] * scale;
|
14474 | out[2] = a[2] + b[2] * scale;
|
14475 | return out;
|
14476 | }
|
14477 |
|
14478 | |
14479 |
|
14480 |
|
14481 |
|
14482 |
|
14483 |
|
14484 |
|
14485 | function distance(a, b) {
|
14486 | var x = b[0] - a[0];
|
14487 | var y = b[1] - a[1];
|
14488 | var z = b[2] - a[2];
|
14489 | return Math.sqrt(x * x + y * y + z * z);
|
14490 | }
|
14491 |
|
14492 | |
14493 |
|
14494 |
|
14495 |
|
14496 |
|
14497 |
|
14498 |
|
14499 | function squaredDistance(a, b) {
|
14500 | var x = b[0] - a[0];
|
14501 | var y = b[1] - a[1];
|
14502 | var z = b[2] - a[2];
|
14503 | return x * x + y * y + z * z;
|
14504 | }
|
14505 |
|
14506 | |
14507 |
|
14508 |
|
14509 |
|
14510 |
|
14511 |
|
14512 | function squaredLength(a) {
|
14513 | var x = a[0];
|
14514 | var y = a[1];
|
14515 | var z = a[2];
|
14516 | return x * x + y * y + z * z;
|
14517 | }
|
14518 |
|
14519 | |
14520 |
|
14521 |
|
14522 |
|
14523 |
|
14524 |
|
14525 |
|
14526 | function negate(out, a) {
|
14527 | out[0] = -a[0];
|
14528 | out[1] = -a[1];
|
14529 | out[2] = -a[2];
|
14530 | return out;
|
14531 | }
|
14532 |
|
14533 | |
14534 |
|
14535 |
|
14536 |
|
14537 |
|
14538 |
|
14539 |
|
14540 | function inverse(out, a) {
|
14541 | out[0] = 1.0 / a[0];
|
14542 | out[1] = 1.0 / a[1];
|
14543 | out[2] = 1.0 / a[2];
|
14544 | return out;
|
14545 | }
|
14546 |
|
14547 | |
14548 |
|
14549 |
|
14550 |
|
14551 |
|
14552 |
|
14553 |
|
14554 | function normalize(out, a) {
|
14555 | var x = a[0];
|
14556 | var y = a[1];
|
14557 | var z = a[2];
|
14558 | var len = x * x + y * y + z * z;
|
14559 | if (len > 0) {
|
14560 |
|
14561 | len = 1 / Math.sqrt(len);
|
14562 | out[0] = a[0] * len;
|
14563 | out[1] = a[1] * len;
|
14564 | out[2] = a[2] * len;
|
14565 | }
|
14566 | return out;
|
14567 | }
|
14568 |
|
14569 | |
14570 |
|
14571 |
|
14572 |
|
14573 |
|
14574 |
|
14575 |
|
14576 | function dot(a, b) {
|
14577 | return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
14578 | }
|
14579 |
|
14580 | |
14581 |
|
14582 |
|
14583 |
|
14584 |
|
14585 |
|
14586 |
|
14587 |
|
14588 | function cross(out, a, b) {
|
14589 | var ax = a[0],
|
14590 | ay = a[1],
|
14591 | az = a[2];
|
14592 | var bx = b[0],
|
14593 | by = b[1],
|
14594 | bz = b[2];
|
14595 |
|
14596 | out[0] = ay * bz - az * by;
|
14597 | out[1] = az * bx - ax * bz;
|
14598 | out[2] = ax * by - ay * bx;
|
14599 | return out;
|
14600 | }
|
14601 |
|
14602 | |
14603 |
|
14604 |
|
14605 |
|
14606 |
|
14607 |
|
14608 |
|
14609 |
|
14610 |
|
14611 | function lerp(out, a, b, t) {
|
14612 | var ax = a[0];
|
14613 | var ay = a[1];
|
14614 | var az = a[2];
|
14615 | out[0] = ax + t * (b[0] - ax);
|
14616 | out[1] = ay + t * (b[1] - ay);
|
14617 | out[2] = az + t * (b[2] - az);
|
14618 | return out;
|
14619 | }
|
14620 |
|
14621 | |
14622 |
|
14623 |
|
14624 |
|
14625 |
|
14626 |
|
14627 |
|
14628 |
|
14629 |
|
14630 |
|
14631 |
|
14632 | function hermite(out, a, b, c, d, t) {
|
14633 | var factorTimes2 = t * t;
|
14634 | var factor1 = factorTimes2 * (2 * t - 3) + 1;
|
14635 | var factor2 = factorTimes2 * (t - 2) + t;
|
14636 | var factor3 = factorTimes2 * (t - 1);
|
14637 | var factor4 = factorTimes2 * (3 - 2 * t);
|
14638 |
|
14639 | out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
|
14640 | out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
|
14641 | out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
|
14642 |
|
14643 | return out;
|
14644 | }
|
14645 |
|
14646 | |
14647 |
|
14648 |
|
14649 |
|
14650 |
|
14651 |
|
14652 |
|
14653 |
|
14654 |
|
14655 |
|
14656 |
|
14657 | function bezier(out, a, b, c, d, t) {
|
14658 | var inverseFactor = 1 - t;
|
14659 | var inverseFactorTimesTwo = inverseFactor * inverseFactor;
|
14660 | var factorTimes2 = t * t;
|
14661 | var factor1 = inverseFactorTimesTwo * inverseFactor;
|
14662 | var factor2 = 3 * t * inverseFactorTimesTwo;
|
14663 | var factor3 = 3 * factorTimes2 * inverseFactor;
|
14664 | var factor4 = factorTimes2 * t;
|
14665 |
|
14666 | out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
|
14667 | out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
|
14668 | out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
|
14669 |
|
14670 | return out;
|
14671 | }
|
14672 |
|
14673 | |
14674 |
|
14675 |
|
14676 |
|
14677 |
|
14678 |
|
14679 |
|
14680 | function random(out, scale) {
|
14681 | scale = scale || 1.0;
|
14682 |
|
14683 | var r = __WEBPACK_IMPORTED_MODULE_0__common__["c" ]() * 2.0 * Math.PI;
|
14684 | var z = __WEBPACK_IMPORTED_MODULE_0__common__["c" ]() * 2.0 - 1.0;
|
14685 | var zScale = Math.sqrt(1.0 - z * z) * scale;
|
14686 |
|
14687 | out[0] = Math.cos(r) * zScale;
|
14688 | out[1] = Math.sin(r) * zScale;
|
14689 | out[2] = z * scale;
|
14690 | return out;
|
14691 | }
|
14692 |
|
14693 | |
14694 |
|
14695 |
|
14696 |
|
14697 |
|
14698 |
|
14699 |
|
14700 |
|
14701 |
|
14702 | function transformMat4(out, a, m) {
|
14703 | var x = a[0],
|
14704 | y = a[1],
|
14705 | z = a[2];
|
14706 | var w = m[3] * x + m[7] * y + m[11] * z + m[15];
|
14707 | w = w || 1.0;
|
14708 | out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
|
14709 | out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
|
14710 | out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
|
14711 | return out;
|
14712 | }
|
14713 |
|
14714 | |
14715 |
|
14716 |
|
14717 |
|
14718 |
|
14719 |
|
14720 |
|
14721 |
|
14722 | function transformMat3(out, a, m) {
|
14723 | var x = a[0],
|
14724 | y = a[1],
|
14725 | z = a[2];
|
14726 | out[0] = x * m[0] + y * m[3] + z * m[6];
|
14727 | out[1] = x * m[1] + y * m[4] + z * m[7];
|
14728 | out[2] = x * m[2] + y * m[5] + z * m[8];
|
14729 | return out;
|
14730 | }
|
14731 |
|
14732 | |
14733 |
|
14734 |
|
14735 |
|
14736 |
|
14737 |
|
14738 |
|
14739 |
|
14740 | function transformQuat(out, a, q) {
|
14741 |
|
14742 |
|
14743 | var x = a[0],
|
14744 | y = a[1],
|
14745 | z = a[2];
|
14746 | var qx = q[0],
|
14747 | qy = q[1],
|
14748 | qz = q[2],
|
14749 | qw = q[3];
|
14750 |
|
14751 |
|
14752 | var ix = qw * x + qy * z - qz * y;
|
14753 | var iy = qw * y + qz * x - qx * z;
|
14754 | var iz = qw * z + qx * y - qy * x;
|
14755 | var iw = -qx * x - qy * y - qz * z;
|
14756 |
|
14757 |
|
14758 | out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
|
14759 | out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
|
14760 | out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
|
14761 | return out;
|
14762 | }
|
14763 |
|
14764 | |
14765 |
|
14766 |
|
14767 |
|
14768 |
|
14769 |
|
14770 |
|
14771 |
|
14772 | function rotateX(out, a, b, c) {
|
14773 | var p = [],
|
14774 | r = [];
|
14775 |
|
14776 | p[0] = a[0] - b[0];
|
14777 | p[1] = a[1] - b[1];
|
14778 | p[2] = a[2] - b[2];
|
14779 |
|
14780 |
|
14781 | r[0] = p[0];
|
14782 | r[1] = p[1] * Math.cos(c) - p[2] * Math.sin(c);
|
14783 | r[2] = p[1] * Math.sin(c) + p[2] * Math.cos(c);
|
14784 |
|
14785 |
|
14786 | out[0] = r[0] + b[0];
|
14787 | out[1] = r[1] + b[1];
|
14788 | out[2] = r[2] + b[2];
|
14789 |
|
14790 | return out;
|
14791 | }
|
14792 |
|
14793 | |
14794 |
|
14795 |
|
14796 |
|
14797 |
|
14798 |
|
14799 |
|
14800 |
|
14801 | function rotateY(out, a, b, c) {
|
14802 | var p = [],
|
14803 | r = [];
|
14804 |
|
14805 | p[0] = a[0] - b[0];
|
14806 | p[1] = a[1] - b[1];
|
14807 | p[2] = a[2] - b[2];
|
14808 |
|
14809 |
|
14810 | r[0] = p[2] * Math.sin(c) + p[0] * Math.cos(c);
|
14811 | r[1] = p[1];
|
14812 | r[2] = p[2] * Math.cos(c) - p[0] * Math.sin(c);
|
14813 |
|
14814 |
|
14815 | out[0] = r[0] + b[0];
|
14816 | out[1] = r[1] + b[1];
|
14817 | out[2] = r[2] + b[2];
|
14818 |
|
14819 | return out;
|
14820 | }
|
14821 |
|
14822 | |
14823 |
|
14824 |
|
14825 |
|
14826 |
|
14827 |
|
14828 |
|
14829 |
|
14830 | function rotateZ(out, a, b, c) {
|
14831 | var p = [],
|
14832 | r = [];
|
14833 |
|
14834 | p[0] = a[0] - b[0];
|
14835 | p[1] = a[1] - b[1];
|
14836 | p[2] = a[2] - b[2];
|
14837 |
|
14838 |
|
14839 | r[0] = p[0] * Math.cos(c) - p[1] * Math.sin(c);
|
14840 | r[1] = p[0] * Math.sin(c) + p[1] * Math.cos(c);
|
14841 | r[2] = p[2];
|
14842 |
|
14843 |
|
14844 | out[0] = r[0] + b[0];
|
14845 | out[1] = r[1] + b[1];
|
14846 | out[2] = r[2] + b[2];
|
14847 |
|
14848 | return out;
|
14849 | }
|
14850 |
|
14851 | |
14852 |
|
14853 |
|
14854 |
|
14855 |
|
14856 |
|
14857 | function angle(a, b) {
|
14858 | var tempA = fromValues(a[0], a[1], a[2]);
|
14859 | var tempB = fromValues(b[0], b[1], b[2]);
|
14860 |
|
14861 | normalize(tempA, tempA);
|
14862 | normalize(tempB, tempB);
|
14863 |
|
14864 | var cosine = dot(tempA, tempB);
|
14865 |
|
14866 | if (cosine > 1.0) {
|
14867 | return 0;
|
14868 | } else if (cosine < -1.0) {
|
14869 | return Math.PI;
|
14870 | } else {
|
14871 | return Math.acos(cosine);
|
14872 | }
|
14873 | }
|
14874 |
|
14875 | |
14876 |
|
14877 |
|
14878 |
|
14879 |
|
14880 |
|
14881 | function str(a) {
|
14882 | return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';
|
14883 | }
|
14884 |
|
14885 | |
14886 |
|
14887 |
|
14888 |
|
14889 |
|
14890 |
|
14891 |
|
14892 | function exactEquals(a, b) {
|
14893 | return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
14894 | }
|
14895 |
|
14896 | |
14897 |
|
14898 |
|
14899 |
|
14900 |
|
14901 |
|
14902 |
|
14903 | function equals(a, b) {
|
14904 | var a0 = a[0],
|
14905 | a1 = a[1],
|
14906 | a2 = a[2];
|
14907 | var b0 = b[0],
|
14908 | b1 = b[1],
|
14909 | b2 = b[2];
|
14910 | return Math.abs(a0 - b0) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a2), Math.abs(b2));
|
14911 | }
|
14912 |
|
14913 | |
14914 |
|
14915 |
|
14916 |
|
14917 | var sub = subtract;
|
14918 |
|
14919 | |
14920 |
|
14921 |
|
14922 |
|
14923 | var mul = multiply;
|
14924 |
|
14925 | |
14926 |
|
14927 |
|
14928 |
|
14929 | var div = divide;
|
14930 |
|
14931 | |
14932 |
|
14933 |
|
14934 |
|
14935 | var dist = distance;
|
14936 |
|
14937 | |
14938 |
|
14939 |
|
14940 |
|
14941 | var sqrDist = squaredDistance;
|
14942 |
|
14943 | |
14944 |
|
14945 |
|
14946 |
|
14947 | var len = length;
|
14948 |
|
14949 | |
14950 |
|
14951 |
|
14952 |
|
14953 | var sqrLen = squaredLength;
|
14954 |
|
14955 | |
14956 |
|
14957 |
|
14958 |
|
14959 |
|
14960 |
|
14961 |
|
14962 |
|
14963 |
|
14964 |
|
14965 |
|
14966 |
|
14967 | var forEach = function () {
|
14968 | var vec = create();
|
14969 |
|
14970 | return function (a, stride, offset, count, fn, arg) {
|
14971 | var i = void 0,
|
14972 | l = void 0;
|
14973 | if (!stride) {
|
14974 | stride = 3;
|
14975 | }
|
14976 |
|
14977 | if (!offset) {
|
14978 | offset = 0;
|
14979 | }
|
14980 |
|
14981 | if (count) {
|
14982 | l = Math.min(count * stride + offset, a.length);
|
14983 | } else {
|
14984 | l = a.length;
|
14985 | }
|
14986 |
|
14987 | for (i = offset; i < l; i += stride) {
|
14988 | vec[0] = a[i];vec[1] = a[i + 1];vec[2] = a[i + 2];
|
14989 | fn(vec, vec, arg);
|
14990 | a[i] = vec[0];a[i + 1] = vec[1];a[i + 2] = vec[2];
|
14991 | }
|
14992 |
|
14993 | return a;
|
14994 | };
|
14995 | }();
|
14996 |
|
14997 |
|
14998 | },
|
14999 |
|
15000 | function (module, __webpack_exports__, __webpack_require__) {
|
15001 |
|
15002 | "use strict";
|
15003 |
|
15004 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
15005 | __webpack_exports__["create"] = create;
|
15006 | __webpack_exports__["clone"] = clone;
|
15007 | __webpack_exports__["fromValues"] = fromValues;
|
15008 | __webpack_exports__["copy"] = copy;
|
15009 | __webpack_exports__["set"] = set;
|
15010 | /* harmony export (immutable) */__webpack_exports__["add"] = add;
|
15011 | /* harmony export (immutable) */__webpack_exports__["subtract"] = subtract;
|
15012 | /* harmony export (immutable) */__webpack_exports__["multiply"] = multiply;
|
15013 | /* harmony export (immutable) */__webpack_exports__["divide"] = divide;
|
15014 | /* harmony export (immutable) */__webpack_exports__["ceil"] = ceil;
|
15015 | /* harmony export (immutable) */__webpack_exports__["floor"] = floor;
|
15016 | /* harmony export (immutable) */__webpack_exports__["min"] = min;
|
15017 | /* harmony export (immutable) */__webpack_exports__["max"] = max;
|
15018 | /* harmony export (immutable) */__webpack_exports__["round"] = round;
|
15019 | /* harmony export (immutable) */__webpack_exports__["scale"] = scale;
|
15020 | /* harmony export (immutable) */__webpack_exports__["scaleAndAdd"] = scaleAndAdd;
|
15021 | /* harmony export (immutable) */__webpack_exports__["distance"] = distance;
|
15022 | /* harmony export (immutable) */__webpack_exports__["squaredDistance"] = squaredDistance;
|
15023 | /* harmony export (immutable) */__webpack_exports__["length"] = length;
|
15024 | /* harmony export (immutable) */__webpack_exports__["squaredLength"] = squaredLength;
|
15025 | /* harmony export (immutable) */__webpack_exports__["negate"] = negate;
|
15026 | /* harmony export (immutable) */__webpack_exports__["inverse"] = inverse;
|
15027 | /* harmony export (immutable) */__webpack_exports__["normalize"] = normalize;
|
15028 | /* harmony export (immutable) */__webpack_exports__["dot"] = dot;
|
15029 | /* harmony export (immutable) */__webpack_exports__["cross"] = cross;
|
15030 | /* harmony export (immutable) */__webpack_exports__["lerp"] = lerp;
|
15031 | /* harmony export (immutable) */__webpack_exports__["random"] = random;
|
15032 | /* harmony export (immutable) */__webpack_exports__["transformMat2"] = transformMat2;
|
15033 | /* harmony export (immutable) */__webpack_exports__["transformMat2d"] = transformMat2d;
|
15034 | /* harmony export (immutable) */__webpack_exports__["transformMat3"] = transformMat3;
|
15035 | /* harmony export (immutable) */__webpack_exports__["transformMat4"] = transformMat4;
|
15036 | /* harmony export (immutable) */__webpack_exports__["str"] = str;
|
15037 | /* harmony export (immutable) */__webpack_exports__["exactEquals"] = exactEquals;
|
15038 | /* harmony export (immutable) */__webpack_exports__["equals"] = equals;
|
15039 | /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "len", function () {
|
15040 | return len;
|
15041 | });
|
15042 | __webpack_require__.d(__webpack_exports__, "sub", function () {
|
15043 | return sub;
|
15044 | });
|
15045 | __webpack_require__.d(__webpack_exports__, "mul", function () {
|
15046 | return mul;
|
15047 | });
|
15048 | __webpack_require__.d(__webpack_exports__, "div", function () {
|
15049 | return div;
|
15050 | });
|
15051 | __webpack_require__.d(__webpack_exports__, "dist", function () {
|
15052 | return dist;
|
15053 | });
|
15054 | __webpack_require__.d(__webpack_exports__, "sqrDist", function () {
|
15055 | return sqrDist;
|
15056 | });
|
15057 | __webpack_require__.d(__webpack_exports__, "sqrLen", function () {
|
15058 | return sqrLen;
|
15059 | });
|
15060 | __webpack_require__.d(__webpack_exports__, "forEach", function () {
|
15061 | return forEach;
|
15062 | });
|
15063 | var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(45);
|
15064 | |
15065 |
|
15066 |
|
15067 |
|
15068 |
|
15069 |
|
15070 |
|
15071 |
|
15072 |
|
15073 |
|
15074 |
|
15075 |
|
15076 |
|
15077 |
|
15078 |
|
15079 |
|
15080 |
|
15081 |
|
15082 |
|
15083 |
|
15084 | |
15085 |
|
15086 |
|
15087 |
|
15088 |
|
15089 | |
15090 |
|
15091 |
|
15092 |
|
15093 |
|
15094 | function create() {
|
15095 | var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" ](2);
|
15096 | out[0] = 0;
|
15097 | out[1] = 0;
|
15098 | return out;
|
15099 | }
|
15100 |
|
15101 | |
15102 |
|
15103 |
|
15104 |
|
15105 |
|
15106 |
|
15107 | function clone(a) {
|
15108 | var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" ](2);
|
15109 | out[0] = a[0];
|
15110 | out[1] = a[1];
|
15111 | return out;
|
15112 | }
|
15113 |
|
15114 | |
15115 |
|
15116 |
|
15117 |
|
15118 |
|
15119 |
|
15120 |
|
15121 | function fromValues(x, y) {
|
15122 | var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" ](2);
|
15123 | out[0] = x;
|
15124 | out[1] = y;
|
15125 | return out;
|
15126 | }
|
15127 |
|
15128 | |
15129 |
|
15130 |
|
15131 |
|
15132 |
|
15133 |
|
15134 |
|
15135 | function copy(out, a) {
|
15136 | out[0] = a[0];
|
15137 | out[1] = a[1];
|
15138 | return out;
|
15139 | }
|
15140 |
|
15141 | |
15142 |
|
15143 |
|
15144 |
|
15145 |
|
15146 |
|
15147 |
|
15148 |
|
15149 | function set(out, x, y) {
|
15150 | out[0] = x;
|
15151 | out[1] = y;
|
15152 | return out;
|
15153 | }
|
15154 |
|
15155 | |
15156 |
|
15157 |
|
15158 |
|
15159 |
|
15160 |
|
15161 |
|
15162 |
|
15163 | function add(out, a, b) {
|
15164 | out[0] = a[0] + b[0];
|
15165 | out[1] = a[1] + b[1];
|
15166 | return out;
|
15167 | }
|
15168 |
|
15169 | |
15170 |
|
15171 |
|
15172 |
|
15173 |
|
15174 |
|
15175 |
|
15176 |
|
15177 | function subtract(out, a, b) {
|
15178 | out[0] = a[0] - b[0];
|
15179 | out[1] = a[1] - b[1];
|
15180 | return out;
|
15181 | }
|
15182 |
|
15183 | |
15184 |
|
15185 |
|
15186 |
|
15187 |
|
15188 |
|
15189 |
|
15190 |
|
15191 | function multiply(out, a, b) {
|
15192 | out[0] = a[0] * b[0];
|
15193 | out[1] = a[1] * b[1];
|
15194 | return out;
|
15195 | };
|
15196 |
|
15197 | |
15198 |
|
15199 |
|
15200 |
|
15201 |
|
15202 |
|
15203 |
|
15204 |
|
15205 | function divide(out, a, b) {
|
15206 | out[0] = a[0] / b[0];
|
15207 | out[1] = a[1] / b[1];
|
15208 | return out;
|
15209 | };
|
15210 |
|
15211 | |
15212 |
|
15213 |
|
15214 |
|
15215 |
|
15216 |
|
15217 |
|
15218 | function ceil(out, a) {
|
15219 | out[0] = Math.ceil(a[0]);
|
15220 | out[1] = Math.ceil(a[1]);
|
15221 | return out;
|
15222 | };
|
15223 |
|
15224 | |
15225 |
|
15226 |
|
15227 |
|
15228 |
|
15229 |
|
15230 |
|
15231 | function floor(out, a) {
|
15232 | out[0] = Math.floor(a[0]);
|
15233 | out[1] = Math.floor(a[1]);
|
15234 | return out;
|
15235 | };
|
15236 |
|
15237 | |
15238 |
|
15239 |
|
15240 |
|
15241 |
|
15242 |
|
15243 |
|
15244 |
|
15245 | function min(out, a, b) {
|
15246 | out[0] = Math.min(a[0], b[0]);
|
15247 | out[1] = Math.min(a[1], b[1]);
|
15248 | return out;
|
15249 | };
|
15250 |
|
15251 | |
15252 |
|
15253 |
|
15254 |
|
15255 |
|
15256 |
|
15257 |
|
15258 |
|
15259 | function max(out, a, b) {
|
15260 | out[0] = Math.max(a[0], b[0]);
|
15261 | out[1] = Math.max(a[1], b[1]);
|
15262 | return out;
|
15263 | };
|
15264 |
|
15265 | |
15266 |
|
15267 |
|
15268 |
|
15269 |
|
15270 |
|
15271 |
|
15272 | function round(out, a) {
|
15273 | out[0] = Math.round(a[0]);
|
15274 | out[1] = Math.round(a[1]);
|
15275 | return out;
|
15276 | };
|
15277 |
|
15278 | |
15279 |
|
15280 |
|
15281 |
|
15282 |
|
15283 |
|
15284 |
|
15285 |
|
15286 | function scale(out, a, b) {
|
15287 | out[0] = a[0] * b;
|
15288 | out[1] = a[1] * b;
|
15289 | return out;
|
15290 | };
|
15291 |
|
15292 | |
15293 |
|
15294 |
|
15295 |
|
15296 |
|
15297 |
|
15298 |
|
15299 |
|
15300 |
|
15301 | function scaleAndAdd(out, a, b, scale) {
|
15302 | out[0] = a[0] + b[0] * scale;
|
15303 | out[1] = a[1] + b[1] * scale;
|
15304 | return out;
|
15305 | };
|
15306 |
|
15307 | |
15308 |
|
15309 |
|
15310 |
|
15311 |
|
15312 |
|
15313 |
|
15314 | function distance(a, b) {
|
15315 | var x = b[0] - a[0],
|
15316 | y = b[1] - a[1];
|
15317 | return Math.sqrt(x * x + y * y);
|
15318 | };
|
15319 |
|
15320 | |
15321 |
|
15322 |
|
15323 |
|
15324 |
|
15325 |
|
15326 |
|
15327 | function squaredDistance(a, b) {
|
15328 | var x = b[0] - a[0],
|
15329 | y = b[1] - a[1];
|
15330 | return x * x + y * y;
|
15331 | };
|
15332 |
|
15333 | |
15334 |
|
15335 |
|
15336 |
|
15337 |
|
15338 |
|
15339 | function length(a) {
|
15340 | var x = a[0],
|
15341 | y = a[1];
|
15342 | return Math.sqrt(x * x + y * y);
|
15343 | };
|
15344 |
|
15345 | |
15346 |
|
15347 |
|
15348 |
|
15349 |
|
15350 |
|
15351 | function squaredLength(a) {
|
15352 | var x = a[0],
|
15353 | y = a[1];
|
15354 | return x * x + y * y;
|
15355 | };
|
15356 |
|
15357 | |
15358 |
|
15359 |
|
15360 |
|
15361 |
|
15362 |
|
15363 |
|
15364 | function negate(out, a) {
|
15365 | out[0] = -a[0];
|
15366 | out[1] = -a[1];
|
15367 | return out;
|
15368 | };
|
15369 |
|
15370 | |
15371 |
|
15372 |
|
15373 |
|
15374 |
|
15375 |
|
15376 |
|
15377 | function inverse(out, a) {
|
15378 | out[0] = 1.0 / a[0];
|
15379 | out[1] = 1.0 / a[1];
|
15380 | return out;
|
15381 | };
|
15382 |
|
15383 | |
15384 |
|
15385 |
|
15386 |
|
15387 |
|
15388 |
|
15389 |
|
15390 | function normalize(out, a) {
|
15391 | var x = a[0],
|
15392 | y = a[1];
|
15393 | var len = x * x + y * y;
|
15394 | if (len > 0) {
|
15395 |
|
15396 | len = 1 / Math.sqrt(len);
|
15397 | out[0] = a[0] * len;
|
15398 | out[1] = a[1] * len;
|
15399 | }
|
15400 | return out;
|
15401 | };
|
15402 |
|
15403 | |
15404 |
|
15405 |
|
15406 |
|
15407 |
|
15408 |
|
15409 |
|
15410 | function dot(a, b) {
|
15411 | return a[0] * b[0] + a[1] * b[1];
|
15412 | };
|
15413 |
|
15414 | |
15415 |
|
15416 |
|
15417 |
|
15418 |
|
15419 |
|
15420 |
|
15421 |
|
15422 |
|
15423 | function cross(out, a, b) {
|
15424 | var z = a[0] * b[1] - a[1] * b[0];
|
15425 | out[0] = out[1] = 0;
|
15426 | out[2] = z;
|
15427 | return out;
|
15428 | };
|
15429 |
|
15430 | |
15431 |
|
15432 |
|
15433 |
|
15434 |
|
15435 |
|
15436 |
|
15437 |
|
15438 |
|
15439 | function lerp(out, a, b, t) {
|
15440 | var ax = a[0],
|
15441 | ay = a[1];
|
15442 | out[0] = ax + t * (b[0] - ax);
|
15443 | out[1] = ay + t * (b[1] - ay);
|
15444 | return out;
|
15445 | };
|
15446 |
|
15447 | |
15448 |
|
15449 |
|
15450 |
|
15451 |
|
15452 |
|
15453 |
|
15454 | function random(out, scale) {
|
15455 | scale = scale || 1.0;
|
15456 | var r = __WEBPACK_IMPORTED_MODULE_0__common__["c" ]() * 2.0 * Math.PI;
|
15457 | out[0] = Math.cos(r) * scale;
|
15458 | out[1] = Math.sin(r) * scale;
|
15459 | return out;
|
15460 | };
|
15461 |
|
15462 | |
15463 |
|
15464 |
|
15465 |
|
15466 |
|
15467 |
|
15468 |
|
15469 |
|
15470 | function transformMat2(out, a, m) {
|
15471 | var x = a[0],
|
15472 | y = a[1];
|
15473 | out[0] = m[0] * x + m[2] * y;
|
15474 | out[1] = m[1] * x + m[3] * y;
|
15475 | return out;
|
15476 | };
|
15477 |
|
15478 | |
15479 |
|
15480 |
|
15481 |
|
15482 |
|
15483 |
|
15484 |
|
15485 |
|
15486 | function transformMat2d(out, a, m) {
|
15487 | var x = a[0],
|
15488 | y = a[1];
|
15489 | out[0] = m[0] * x + m[2] * y + m[4];
|
15490 | out[1] = m[1] * x + m[3] * y + m[5];
|
15491 | return out;
|
15492 | };
|
15493 |
|
15494 | |
15495 |
|
15496 |
|
15497 |
|
15498 |
|
15499 |
|
15500 |
|
15501 |
|
15502 |
|
15503 | function transformMat3(out, a, m) {
|
15504 | var x = a[0],
|
15505 | y = a[1];
|
15506 | out[0] = m[0] * x + m[3] * y + m[6];
|
15507 | out[1] = m[1] * x + m[4] * y + m[7];
|
15508 | return out;
|
15509 | };
|
15510 |
|
15511 | |
15512 |
|
15513 |
|
15514 |
|
15515 |
|
15516 |
|
15517 |
|
15518 |
|
15519 |
|
15520 |
|
15521 | function transformMat4(out, a, m) {
|
15522 | var x = a[0];
|
15523 | var y = a[1];
|
15524 | out[0] = m[0] * x + m[4] * y + m[12];
|
15525 | out[1] = m[1] * x + m[5] * y + m[13];
|
15526 | return out;
|
15527 | }
|
15528 |
|
15529 | |
15530 |
|
15531 |
|
15532 |
|
15533 |
|
15534 |
|
15535 | function str(a) {
|
15536 | return 'vec2(' + a[0] + ', ' + a[1] + ')';
|
15537 | }
|
15538 |
|
15539 | |
15540 |
|
15541 |
|
15542 |
|
15543 |
|
15544 |
|
15545 |
|
15546 | function exactEquals(a, b) {
|
15547 | return a[0] === b[0] && a[1] === b[1];
|
15548 | }
|
15549 |
|
15550 | |
15551 |
|
15552 |
|
15553 |
|
15554 |
|
15555 |
|
15556 |
|
15557 | function equals(a, b) {
|
15558 | var a0 = a[0],
|
15559 | a1 = a[1];
|
15560 | var b0 = b[0],
|
15561 | b1 = b[1];
|
15562 | return Math.abs(a0 - b0) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" ] * Math.max(1.0, Math.abs(a1), Math.abs(b1));
|
15563 | }
|
15564 |
|
15565 | |
15566 |
|
15567 |
|
15568 |
|
15569 | var len = length;
|
15570 |
|
15571 | |
15572 |
|
15573 |
|
15574 |
|
15575 | var sub = subtract;
|
15576 |
|
15577 | |
15578 |
|
15579 |
|
15580 |
|
15581 | var mul = multiply;
|
15582 |
|
15583 | |
15584 |
|
15585 |
|
15586 |
|
15587 | var div = divide;
|
15588 |
|
15589 | |
15590 |
|
15591 |
|
15592 |
|
15593 | var dist = distance;
|
15594 |
|
15595 | |
15596 |
|
15597 |
|
15598 |
|
15599 | var sqrDist = squaredDistance;
|
15600 |
|
15601 | |
15602 |
|
15603 |
|
15604 |
|
15605 | var sqrLen = squaredLength;
|
15606 |
|
15607 | |
15608 |
|
15609 |
|
15610 |
|
15611 |
|
15612 |
|
15613 |
|
15614 |
|
15615 |
|
15616 |
|
15617 |
|
15618 |
|
15619 | var forEach = function () {
|
15620 | var vec = create();
|
15621 |
|
15622 | return function (a, stride, offset, count, fn, arg) {
|
15623 | var i = void 0,
|
15624 | l = void 0;
|
15625 | if (!stride) {
|
15626 | stride = 2;
|
15627 | }
|
15628 |
|
15629 | if (!offset) {
|
15630 | offset = 0;
|
15631 | }
|
15632 |
|
15633 | if (count) {
|
15634 | l = Math.min(count * stride + offset, a.length);
|
15635 | } else {
|
15636 | l = a.length;
|
15637 | }
|
15638 |
|
15639 | for (i = offset; i < l; i += stride) {
|
15640 | vec[0] = a[i];vec[1] = a[i + 1];
|
15641 | fn(vec, vec, arg);
|
15642 | a[i] = vec[0];a[i + 1] = vec[1];
|
15643 | }
|
15644 |
|
15645 | return a;
|
15646 | };
|
15647 | }();
|
15648 |
|
15649 |
|
15650 | },
|
15651 |
|
15652 | function (module, exports, __webpack_require__) {
|
15653 |
|
15654 | var MatrixUtil = __webpack_require__(3);
|
15655 | var PathUtil = __webpack_require__(46);
|
15656 | var Util = __webpack_require__(0);
|
15657 | var d3Ease = __webpack_require__(234);
|
15658 | var d3Timer = __webpack_require__(245);
|
15659 |
|
15660 | var _require = __webpack_require__(248),
|
15661 | interpolate = _require.interpolate,
|
15662 | interpolateArray = _require.interpolateArray;
|
15663 |
|
15664 | module.exports = {
|
15665 | |
15666 |
|
15667 |
|
15668 |
|
15669 |
|
15670 |
|
15671 |
|
15672 |
|
15673 | animate: function animate(toProps, duration, easing, callback) {
|
15674 | var delay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
15675 |
|
15676 | var self = this;
|
15677 | var canvas = self.get('canvas');
|
15678 | var formatProps = getFormatProps(toProps);
|
15679 | var toAttrs = formatProps.attrs;
|
15680 | var toM = formatProps.M;
|
15681 | var fromAttrs = getfromAttrs(toAttrs);
|
15682 | var fromM = Util.clone(self.getMatrix());
|
15683 | easing = easing ? easing : 'easeLinear';
|
15684 |
|
15685 | self.setSilent('animating', true);
|
15686 |
|
15687 | var timer = d3Timer.timer(function (elapsed) {
|
15688 | var ratio = elapsed / duration;
|
15689 | if (ratio < 1) {
|
15690 | ratio = d3Ease[easing](ratio);
|
15691 | update(ratio);
|
15692 | } else {
|
15693 | update(1);
|
15694 | callback && callback();
|
15695 | self.setSilent('animating', false);
|
15696 | timer.stop();
|
15697 | }
|
15698 | }, delay);
|
15699 |
|
15700 | function update(ratio) {
|
15701 | var cProps = {};
|
15702 | if (self.get('destroyed')) {
|
15703 | return;
|
15704 | }
|
15705 | var interf = void 0;
|
15706 |
|
15707 | for (var k in toAttrs) {
|
15708 | if (!Util.isEqual(fromAttrs[k], toAttrs[k])) {
|
15709 | if (k === 'path') {
|
15710 | var toPath = PathUtil.parsePathString(toAttrs[k]);
|
15711 | var fromPath = PathUtil.parsePathString(fromAttrs[k]);
|
15712 | cProps[k] = [];
|
15713 | for (var i = 0; i < toPath.length; i++) {
|
15714 | var toPathPoint = toPath[i];
|
15715 | var fromPathPoint = fromPath[i];
|
15716 | var cPathPoint = [];
|
15717 | for (var j = 0; j < toPathPoint.length; j++) {
|
15718 | if (Util.isNumber(toPathPoint[j]) && fromPathPoint) {
|
15719 | interf = interpolate(fromPathPoint[j], toPathPoint[j]);
|
15720 | cPathPoint.push(interf(ratio));
|
15721 | } else {
|
15722 | cPathPoint.push(toPathPoint[j]);
|
15723 | }
|
15724 | }
|
15725 | cProps[k].push(cPathPoint);
|
15726 | }
|
15727 | } else {
|
15728 | interf = interpolate(fromAttrs[k], toAttrs[k]);
|
15729 | cProps[k] = interf(ratio);
|
15730 | }
|
15731 | }
|
15732 | }
|
15733 | if (toM) {
|
15734 | var mf = interpolateArray(fromM, toM);
|
15735 | var cM = mf(ratio);
|
15736 | self.setMatrix(cM);
|
15737 | }
|
15738 | self.attr(cProps);
|
15739 | canvas.draw();
|
15740 | }
|
15741 |
|
15742 | function getFormatProps(props) {
|
15743 | var rst = {
|
15744 | M: null,
|
15745 | attrs: {}
|
15746 | };
|
15747 | for (var k in props) {
|
15748 | if (k === 'transform') {
|
15749 | rst.M = MatrixUtil.transform(self.getMatrix(), props[k]);
|
15750 | } else if (k === 'matrix') {
|
15751 | rst.M = props[k];
|
15752 | } else {
|
15753 | rst.attrs[k] = props[k];
|
15754 | }
|
15755 | }
|
15756 | return rst;
|
15757 | }
|
15758 |
|
15759 | function getfromAttrs(toAttrs) {
|
15760 | var rst = {};
|
15761 | for (var k in toAttrs) {
|
15762 | rst[k] = self.attr(k);
|
15763 | }
|
15764 | return rst;
|
15765 | }
|
15766 | }
|
15767 | };
|
15768 |
|
15769 |
|
15770 | },
|
15771 |
|
15772 | function (module, __webpack_exports__, __webpack_require__) {
|
15773 |
|
15774 | "use strict";
|
15775 |
|
15776 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
15777 | var __WEBPACK_IMPORTED_MODULE_0__src_linear__ = __webpack_require__(235);
|
15778 | __webpack_require__.d(__webpack_exports__, "easeLinear", function () {
|
15779 | return __WEBPACK_IMPORTED_MODULE_0__src_linear__["a"];
|
15780 | });
|
15781 | var __WEBPACK_IMPORTED_MODULE_1__src_quad__ = __webpack_require__(236);
|
15782 | __webpack_require__.d(__webpack_exports__, "easeQuad", function () {
|
15783 | return __WEBPACK_IMPORTED_MODULE_1__src_quad__["b"];
|
15784 | });
|
15785 | __webpack_require__.d(__webpack_exports__, "easeQuadIn", function () {
|
15786 | return __WEBPACK_IMPORTED_MODULE_1__src_quad__["a"];
|
15787 | });
|
15788 | __webpack_require__.d(__webpack_exports__, "easeQuadOut", function () {
|
15789 | return __WEBPACK_IMPORTED_MODULE_1__src_quad__["c"];
|
15790 | });
|
15791 | __webpack_require__.d(__webpack_exports__, "easeQuadInOut", function () {
|
15792 | return __WEBPACK_IMPORTED_MODULE_1__src_quad__["b"];
|
15793 | });
|
15794 | var __WEBPACK_IMPORTED_MODULE_2__src_cubic__ = __webpack_require__(237);
|
15795 | __webpack_require__.d(__webpack_exports__, "easeCubic", function () {
|
15796 | return __WEBPACK_IMPORTED_MODULE_2__src_cubic__["b"];
|
15797 | });
|
15798 | __webpack_require__.d(__webpack_exports__, "easeCubicIn", function () {
|
15799 | return __WEBPACK_IMPORTED_MODULE_2__src_cubic__["a"];
|
15800 | });
|
15801 | __webpack_require__.d(__webpack_exports__, "easeCubicOut", function () {
|
15802 | return __WEBPACK_IMPORTED_MODULE_2__src_cubic__["c"];
|
15803 | });
|
15804 | __webpack_require__.d(__webpack_exports__, "easeCubicInOut", function () {
|
15805 | return __WEBPACK_IMPORTED_MODULE_2__src_cubic__["b"];
|
15806 | });
|
15807 | var __WEBPACK_IMPORTED_MODULE_3__src_poly__ = __webpack_require__(238);
|
15808 | __webpack_require__.d(__webpack_exports__, "easePoly", function () {
|
15809 | return __WEBPACK_IMPORTED_MODULE_3__src_poly__["b"];
|
15810 | });
|
15811 | __webpack_require__.d(__webpack_exports__, "easePolyIn", function () {
|
15812 | return __WEBPACK_IMPORTED_MODULE_3__src_poly__["a"];
|
15813 | });
|
15814 | __webpack_require__.d(__webpack_exports__, "easePolyOut", function () {
|
15815 | return __WEBPACK_IMPORTED_MODULE_3__src_poly__["c"];
|
15816 | });
|
15817 | __webpack_require__.d(__webpack_exports__, "easePolyInOut", function () {
|
15818 | return __WEBPACK_IMPORTED_MODULE_3__src_poly__["b"];
|
15819 | });
|
15820 | var __WEBPACK_IMPORTED_MODULE_4__src_sin__ = __webpack_require__(239);
|
15821 | __webpack_require__.d(__webpack_exports__, "easeSin", function () {
|
15822 | return __WEBPACK_IMPORTED_MODULE_4__src_sin__["b"];
|
15823 | });
|
15824 | __webpack_require__.d(__webpack_exports__, "easeSinIn", function () {
|
15825 | return __WEBPACK_IMPORTED_MODULE_4__src_sin__["a"];
|
15826 | });
|
15827 | __webpack_require__.d(__webpack_exports__, "easeSinOut", function () {
|
15828 | return __WEBPACK_IMPORTED_MODULE_4__src_sin__["c"];
|
15829 | });
|
15830 | __webpack_require__.d(__webpack_exports__, "easeSinInOut", function () {
|
15831 | return __WEBPACK_IMPORTED_MODULE_4__src_sin__["b"];
|
15832 | });
|
15833 | var __WEBPACK_IMPORTED_MODULE_5__src_exp__ = __webpack_require__(240);
|
15834 | __webpack_require__.d(__webpack_exports__, "easeExp", function () {
|
15835 | return __WEBPACK_IMPORTED_MODULE_5__src_exp__["b"];
|
15836 | });
|
15837 | __webpack_require__.d(__webpack_exports__, "easeExpIn", function () {
|
15838 | return __WEBPACK_IMPORTED_MODULE_5__src_exp__["a"];
|
15839 | });
|
15840 | __webpack_require__.d(__webpack_exports__, "easeExpOut", function () {
|
15841 | return __WEBPACK_IMPORTED_MODULE_5__src_exp__["c"];
|
15842 | });
|
15843 | __webpack_require__.d(__webpack_exports__, "easeExpInOut", function () {
|
15844 | return __WEBPACK_IMPORTED_MODULE_5__src_exp__["b"];
|
15845 | });
|
15846 | var __WEBPACK_IMPORTED_MODULE_6__src_circle__ = __webpack_require__(241);
|
15847 | __webpack_require__.d(__webpack_exports__, "easeCircle", function () {
|
15848 | return __WEBPACK_IMPORTED_MODULE_6__src_circle__["b"];
|
15849 | });
|
15850 | __webpack_require__.d(__webpack_exports__, "easeCircleIn", function () {
|
15851 | return __WEBPACK_IMPORTED_MODULE_6__src_circle__["a"];
|
15852 | });
|
15853 | __webpack_require__.d(__webpack_exports__, "easeCircleOut", function () {
|
15854 | return __WEBPACK_IMPORTED_MODULE_6__src_circle__["c"];
|
15855 | });
|
15856 | __webpack_require__.d(__webpack_exports__, "easeCircleInOut", function () {
|
15857 | return __WEBPACK_IMPORTED_MODULE_6__src_circle__["b"];
|
15858 | });
|
15859 | var __WEBPACK_IMPORTED_MODULE_7__src_bounce__ = __webpack_require__(242);
|
15860 | __webpack_require__.d(__webpack_exports__, "easeBounce", function () {
|
15861 | return __WEBPACK_IMPORTED_MODULE_7__src_bounce__["c"];
|
15862 | });
|
15863 | __webpack_require__.d(__webpack_exports__, "easeBounceIn", function () {
|
15864 | return __WEBPACK_IMPORTED_MODULE_7__src_bounce__["a"];
|
15865 | });
|
15866 | __webpack_require__.d(__webpack_exports__, "easeBounceOut", function () {
|
15867 | return __WEBPACK_IMPORTED_MODULE_7__src_bounce__["c"];
|
15868 | });
|
15869 | __webpack_require__.d(__webpack_exports__, "easeBounceInOut", function () {
|
15870 | return __WEBPACK_IMPORTED_MODULE_7__src_bounce__["b"];
|
15871 | });
|
15872 | var __WEBPACK_IMPORTED_MODULE_8__src_back__ = __webpack_require__(243);
|
15873 | __webpack_require__.d(__webpack_exports__, "easeBack", function () {
|
15874 | return __WEBPACK_IMPORTED_MODULE_8__src_back__["b"];
|
15875 | });
|
15876 | __webpack_require__.d(__webpack_exports__, "easeBackIn", function () {
|
15877 | return __WEBPACK_IMPORTED_MODULE_8__src_back__["a"];
|
15878 | });
|
15879 | __webpack_require__.d(__webpack_exports__, "easeBackOut", function () {
|
15880 | return __WEBPACK_IMPORTED_MODULE_8__src_back__["c"];
|
15881 | });
|
15882 | __webpack_require__.d(__webpack_exports__, "easeBackInOut", function () {
|
15883 | return __WEBPACK_IMPORTED_MODULE_8__src_back__["b"];
|
15884 | });
|
15885 | var __WEBPACK_IMPORTED_MODULE_9__src_elastic__ = __webpack_require__(244);
|
15886 | __webpack_require__.d(__webpack_exports__, "easeElastic", function () {
|
15887 | return __WEBPACK_IMPORTED_MODULE_9__src_elastic__["c"];
|
15888 | });
|
15889 | __webpack_require__.d(__webpack_exports__, "easeElasticIn", function () {
|
15890 | return __WEBPACK_IMPORTED_MODULE_9__src_elastic__["a"];
|
15891 | });
|
15892 | __webpack_require__.d(__webpack_exports__, "easeElasticOut", function () {
|
15893 | return __WEBPACK_IMPORTED_MODULE_9__src_elastic__["c"];
|
15894 | });
|
15895 | __webpack_require__.d(__webpack_exports__, "easeElasticInOut", function () {
|
15896 | return __WEBPACK_IMPORTED_MODULE_9__src_elastic__["b"];
|
15897 | });
|
15898 |
|
15899 |
|
15900 | },
|
15901 |
|
15902 | function (module, __webpack_exports__, __webpack_require__) {
|
15903 |
|
15904 | "use strict";
|
15905 |
|
15906 | __webpack_exports__["a"] = linear;
|
15907 | function linear(t) {
|
15908 | return +t;
|
15909 | }
|
15910 |
|
15911 |
|
15912 | },
|
15913 |
|
15914 | function (module, __webpack_exports__, __webpack_require__) {
|
15915 |
|
15916 | "use strict";
|
15917 |
|
15918 | __webpack_exports__["a"] = quadIn;
|
15919 | __webpack_exports__["c"] = quadOut;
|
15920 | __webpack_exports__["b"] = quadInOut;
|
15921 | function quadIn(t) {
|
15922 | return t * t;
|
15923 | }
|
15924 |
|
15925 | function quadOut(t) {
|
15926 | return t * (2 - t);
|
15927 | }
|
15928 |
|
15929 | function quadInOut(t) {
|
15930 | return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;
|
15931 | }
|
15932 |
|
15933 |
|
15934 | },
|
15935 |
|
15936 | function (module, __webpack_exports__, __webpack_require__) {
|
15937 |
|
15938 | "use strict";
|
15939 |
|
15940 | __webpack_exports__["a"] = cubicIn;
|
15941 | __webpack_exports__["c"] = cubicOut;
|
15942 | __webpack_exports__["b"] = cubicInOut;
|
15943 | function cubicIn(t) {
|
15944 | return t * t * t;
|
15945 | }
|
15946 |
|
15947 | function cubicOut(t) {
|
15948 | return --t * t * t + 1;
|
15949 | }
|
15950 |
|
15951 | function cubicInOut(t) {
|
15952 | return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
|
15953 | }
|
15954 |
|
15955 |
|
15956 | },
|
15957 |
|
15958 | function (module, __webpack_exports__, __webpack_require__) {
|
15959 |
|
15960 | "use strict";
|
15961 |
|
15962 | __webpack_require__.d(__webpack_exports__, "a", function () {
|
15963 | return polyIn;
|
15964 | });
|
15965 | __webpack_require__.d(__webpack_exports__, "c", function () {
|
15966 | return polyOut;
|
15967 | });
|
15968 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
15969 | return polyInOut;
|
15970 | });
|
15971 | var exponent = 3;
|
15972 |
|
15973 | var polyIn = function custom(e) {
|
15974 | e = +e;
|
15975 |
|
15976 | function polyIn(t) {
|
15977 | return Math.pow(t, e);
|
15978 | }
|
15979 |
|
15980 | polyIn.exponent = custom;
|
15981 |
|
15982 | return polyIn;
|
15983 | }(exponent);
|
15984 |
|
15985 | var polyOut = function custom(e) {
|
15986 | e = +e;
|
15987 |
|
15988 | function polyOut(t) {
|
15989 | return 1 - Math.pow(1 - t, e);
|
15990 | }
|
15991 |
|
15992 | polyOut.exponent = custom;
|
15993 |
|
15994 | return polyOut;
|
15995 | }(exponent);
|
15996 |
|
15997 | var polyInOut = function custom(e) {
|
15998 | e = +e;
|
15999 |
|
16000 | function polyInOut(t) {
|
16001 | return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
|
16002 | }
|
16003 |
|
16004 | polyInOut.exponent = custom;
|
16005 |
|
16006 | return polyInOut;
|
16007 | }(exponent);
|
16008 |
|
16009 |
|
16010 | },
|
16011 |
|
16012 | function (module, __webpack_exports__, __webpack_require__) {
|
16013 |
|
16014 | "use strict";
|
16015 |
|
16016 | __webpack_exports__["a"] = sinIn;
|
16017 | __webpack_exports__["c"] = sinOut;
|
16018 | __webpack_exports__["b"] = sinInOut;
|
16019 | var pi = Math.PI,
|
16020 | halfPi = pi / 2;
|
16021 |
|
16022 | function sinIn(t) {
|
16023 | return 1 - Math.cos(t * halfPi);
|
16024 | }
|
16025 |
|
16026 | function sinOut(t) {
|
16027 | return Math.sin(t * halfPi);
|
16028 | }
|
16029 |
|
16030 | function sinInOut(t) {
|
16031 | return (1 - Math.cos(pi * t)) / 2;
|
16032 | }
|
16033 |
|
16034 |
|
16035 | },
|
16036 |
|
16037 | function (module, __webpack_exports__, __webpack_require__) {
|
16038 |
|
16039 | "use strict";
|
16040 |
|
16041 | __webpack_exports__["a"] = expIn;
|
16042 | __webpack_exports__["c"] = expOut;
|
16043 | __webpack_exports__["b"] = expInOut;
|
16044 | function expIn(t) {
|
16045 | return Math.pow(2, 10 * t - 10);
|
16046 | }
|
16047 |
|
16048 | function expOut(t) {
|
16049 | return 1 - Math.pow(2, -10 * t);
|
16050 | }
|
16051 |
|
16052 | function expInOut(t) {
|
16053 | return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2;
|
16054 | }
|
16055 |
|
16056 |
|
16057 | },
|
16058 |
|
16059 | function (module, __webpack_exports__, __webpack_require__) {
|
16060 |
|
16061 | "use strict";
|
16062 |
|
16063 | __webpack_exports__["a"] = circleIn;
|
16064 | __webpack_exports__["c"] = circleOut;
|
16065 | __webpack_exports__["b"] = circleInOut;
|
16066 | function circleIn(t) {
|
16067 | return 1 - Math.sqrt(1 - t * t);
|
16068 | }
|
16069 |
|
16070 | function circleOut(t) {
|
16071 | return Math.sqrt(1 - --t * t);
|
16072 | }
|
16073 |
|
16074 | function circleInOut(t) {
|
16075 | return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;
|
16076 | }
|
16077 |
|
16078 |
|
16079 | },
|
16080 |
|
16081 | function (module, __webpack_exports__, __webpack_require__) {
|
16082 |
|
16083 | "use strict";
|
16084 |
|
16085 | __webpack_exports__["a"] = bounceIn;
|
16086 | __webpack_exports__["c"] = bounceOut;
|
16087 | __webpack_exports__["b"] = bounceInOut;
|
16088 | var b1 = 4 / 11,
|
16089 | b2 = 6 / 11,
|
16090 | b3 = 8 / 11,
|
16091 | b4 = 3 / 4,
|
16092 | b5 = 9 / 11,
|
16093 | b6 = 10 / 11,
|
16094 | b7 = 15 / 16,
|
16095 | b8 = 21 / 22,
|
16096 | b9 = 63 / 64,
|
16097 | b0 = 1 / b1 / b1;
|
16098 |
|
16099 | function bounceIn(t) {
|
16100 | return 1 - bounceOut(1 - t);
|
16101 | }
|
16102 |
|
16103 | function bounceOut(t) {
|
16104 | return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;
|
16105 | }
|
16106 |
|
16107 | function bounceInOut(t) {
|
16108 | return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;
|
16109 | }
|
16110 |
|
16111 |
|
16112 | },
|
16113 |
|
16114 | function (module, __webpack_exports__, __webpack_require__) {
|
16115 |
|
16116 | "use strict";
|
16117 |
|
16118 | __webpack_require__.d(__webpack_exports__, "a", function () {
|
16119 | return backIn;
|
16120 | });
|
16121 | __webpack_require__.d(__webpack_exports__, "c", function () {
|
16122 | return backOut;
|
16123 | });
|
16124 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
16125 | return backInOut;
|
16126 | });
|
16127 | var overshoot = 1.70158;
|
16128 |
|
16129 | var backIn = function custom(s) {
|
16130 | s = +s;
|
16131 |
|
16132 | function backIn(t) {
|
16133 | return t * t * ((s + 1) * t - s);
|
16134 | }
|
16135 |
|
16136 | backIn.overshoot = custom;
|
16137 |
|
16138 | return backIn;
|
16139 | }(overshoot);
|
16140 |
|
16141 | var backOut = function custom(s) {
|
16142 | s = +s;
|
16143 |
|
16144 | function backOut(t) {
|
16145 | return --t * t * ((s + 1) * t + s) + 1;
|
16146 | }
|
16147 |
|
16148 | backOut.overshoot = custom;
|
16149 |
|
16150 | return backOut;
|
16151 | }(overshoot);
|
16152 |
|
16153 | var backInOut = function custom(s) {
|
16154 | s = +s;
|
16155 |
|
16156 | function backInOut(t) {
|
16157 | return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;
|
16158 | }
|
16159 |
|
16160 | backInOut.overshoot = custom;
|
16161 |
|
16162 | return backInOut;
|
16163 | }(overshoot);
|
16164 |
|
16165 |
|
16166 | },
|
16167 |
|
16168 | function (module, __webpack_exports__, __webpack_require__) {
|
16169 |
|
16170 | "use strict";
|
16171 |
|
16172 | __webpack_require__.d(__webpack_exports__, "a", function () {
|
16173 | return elasticIn;
|
16174 | });
|
16175 | __webpack_require__.d(__webpack_exports__, "c", function () {
|
16176 | return elasticOut;
|
16177 | });
|
16178 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
16179 | return elasticInOut;
|
16180 | });
|
16181 | var tau = 2 * Math.PI,
|
16182 | amplitude = 1,
|
16183 | period = 0.3;
|
16184 |
|
16185 | var elasticIn = function custom(a, p) {
|
16186 | var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
|
16187 |
|
16188 | function elasticIn(t) {
|
16189 | return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p);
|
16190 | }
|
16191 |
|
16192 | elasticIn.amplitude = function (a) {
|
16193 | return custom(a, p * tau);
|
16194 | };
|
16195 | elasticIn.period = function (p) {
|
16196 | return custom(a, p);
|
16197 | };
|
16198 |
|
16199 | return elasticIn;
|
16200 | }(amplitude, period);
|
16201 |
|
16202 | var elasticOut = function custom(a, p) {
|
16203 | var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
|
16204 |
|
16205 | function elasticOut(t) {
|
16206 | return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p);
|
16207 | }
|
16208 |
|
16209 | elasticOut.amplitude = function (a) {
|
16210 | return custom(a, p * tau);
|
16211 | };
|
16212 | elasticOut.period = function (p) {
|
16213 | return custom(a, p);
|
16214 | };
|
16215 |
|
16216 | return elasticOut;
|
16217 | }(amplitude, period);
|
16218 |
|
16219 | var elasticInOut = function custom(a, p) {
|
16220 | var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
|
16221 |
|
16222 | function elasticInOut(t) {
|
16223 | return ((t = t * 2 - 1) < 0 ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p) : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;
|
16224 | }
|
16225 |
|
16226 | elasticInOut.amplitude = function (a) {
|
16227 | return custom(a, p * tau);
|
16228 | };
|
16229 | elasticInOut.period = function (p) {
|
16230 | return custom(a, p);
|
16231 | };
|
16232 |
|
16233 | return elasticInOut;
|
16234 | }(amplitude, period);
|
16235 |
|
16236 |
|
16237 | },
|
16238 |
|
16239 | function (module, __webpack_exports__, __webpack_require__) {
|
16240 |
|
16241 | "use strict";
|
16242 |
|
16243 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
16244 | var __WEBPACK_IMPORTED_MODULE_0__src_timer__ = __webpack_require__(47);
|
16245 | __webpack_require__.d(__webpack_exports__, "now", function () {
|
16246 | return __WEBPACK_IMPORTED_MODULE_0__src_timer__["b"];
|
16247 | });
|
16248 | __webpack_require__.d(__webpack_exports__, "timer", function () {
|
16249 | return __WEBPACK_IMPORTED_MODULE_0__src_timer__["c"];
|
16250 | });
|
16251 | __webpack_require__.d(__webpack_exports__, "timerFlush", function () {
|
16252 | return __WEBPACK_IMPORTED_MODULE_0__src_timer__["d"];
|
16253 | });
|
16254 | var __WEBPACK_IMPORTED_MODULE_1__src_timeout__ = __webpack_require__(246);
|
16255 | __webpack_require__.d(__webpack_exports__, "timeout", function () {
|
16256 | return __WEBPACK_IMPORTED_MODULE_1__src_timeout__["a"];
|
16257 | });
|
16258 | var __WEBPACK_IMPORTED_MODULE_2__src_interval__ = __webpack_require__(247);
|
16259 | __webpack_require__.d(__webpack_exports__, "interval", function () {
|
16260 | return __WEBPACK_IMPORTED_MODULE_2__src_interval__["a"];
|
16261 | });
|
16262 |
|
16263 |
|
16264 | },
|
16265 |
|
16266 | function (module, __webpack_exports__, __webpack_require__) {
|
16267 |
|
16268 | "use strict";
|
16269 |
|
16270 | var __WEBPACK_IMPORTED_MODULE_0__timer__ = __webpack_require__(47);
|
16271 |
|
16272 | __webpack_exports__["a"] = function (callback, delay, time) {
|
16273 | var t = new __WEBPACK_IMPORTED_MODULE_0__timer__["a" ]();
|
16274 | delay = delay == null ? 0 : +delay;
|
16275 | t.restart(function (elapsed) {
|
16276 | t.stop();
|
16277 | callback(elapsed + delay);
|
16278 | }, delay, time);
|
16279 | return t;
|
16280 | };
|
16281 |
|
16282 |
|
16283 | },
|
16284 |
|
16285 | function (module, __webpack_exports__, __webpack_require__) {
|
16286 |
|
16287 | "use strict";
|
16288 |
|
16289 | var __WEBPACK_IMPORTED_MODULE_0__timer__ = __webpack_require__(47);
|
16290 |
|
16291 | __webpack_exports__["a"] = function (callback, delay, time) {
|
16292 | var t = new __WEBPACK_IMPORTED_MODULE_0__timer__["a" ](),
|
16293 | total = delay;
|
16294 | if (delay == null) return t.restart(callback, delay, time), t;
|
16295 | delay = +delay, time = time == null ? Object(__WEBPACK_IMPORTED_MODULE_0__timer__["b" ])() : +time;
|
16296 | t.restart(function tick(elapsed) {
|
16297 | elapsed += total;
|
16298 | t.restart(tick, total += delay, time);
|
16299 | callback(elapsed);
|
16300 | }, delay, time);
|
16301 | return t;
|
16302 | };
|
16303 |
|
16304 |
|
16305 | },
|
16306 |
|
16307 | function (module, __webpack_exports__, __webpack_require__) {
|
16308 |
|
16309 | "use strict";
|
16310 |
|
16311 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
16312 | var __WEBPACK_IMPORTED_MODULE_0__src_value__ = __webpack_require__(48);
|
16313 | __webpack_require__.d(__webpack_exports__, "interpolate", function () {
|
16314 | return __WEBPACK_IMPORTED_MODULE_0__src_value__["a"];
|
16315 | });
|
16316 | var __WEBPACK_IMPORTED_MODULE_1__src_array__ = __webpack_require__(93);
|
16317 | __webpack_require__.d(__webpack_exports__, "interpolateArray", function () {
|
16318 | return __WEBPACK_IMPORTED_MODULE_1__src_array__["a"];
|
16319 | });
|
16320 | var __WEBPACK_IMPORTED_MODULE_2__src_basis__ = __webpack_require__(51);
|
16321 | __webpack_require__.d(__webpack_exports__, "interpolateBasis", function () {
|
16322 | return __WEBPACK_IMPORTED_MODULE_2__src_basis__["b"];
|
16323 | });
|
16324 | var __WEBPACK_IMPORTED_MODULE_3__src_basisClosed__ = __webpack_require__(91);
|
16325 | __webpack_require__.d(__webpack_exports__, "interpolateBasisClosed", function () {
|
16326 | return __WEBPACK_IMPORTED_MODULE_3__src_basisClosed__["a"];
|
16327 | });
|
16328 | var __WEBPACK_IMPORTED_MODULE_4__src_date__ = __webpack_require__(94);
|
16329 | __webpack_require__.d(__webpack_exports__, "interpolateDate", function () {
|
16330 | return __WEBPACK_IMPORTED_MODULE_4__src_date__["a"];
|
16331 | });
|
16332 | var __WEBPACK_IMPORTED_MODULE_5__src_number__ = __webpack_require__(29);
|
16333 | __webpack_require__.d(__webpack_exports__, "interpolateNumber", function () {
|
16334 | return __WEBPACK_IMPORTED_MODULE_5__src_number__["a"];
|
16335 | });
|
16336 | var __WEBPACK_IMPORTED_MODULE_6__src_object__ = __webpack_require__(95);
|
16337 | __webpack_require__.d(__webpack_exports__, "interpolateObject", function () {
|
16338 | return __WEBPACK_IMPORTED_MODULE_6__src_object__["a"];
|
16339 | });
|
16340 | var __WEBPACK_IMPORTED_MODULE_7__src_round__ = __webpack_require__(251);
|
16341 | __webpack_require__.d(__webpack_exports__, "interpolateRound", function () {
|
16342 | return __WEBPACK_IMPORTED_MODULE_7__src_round__["a"];
|
16343 | });
|
16344 | var __WEBPACK_IMPORTED_MODULE_8__src_string__ = __webpack_require__(96);
|
16345 | __webpack_require__.d(__webpack_exports__, "interpolateString", function () {
|
16346 | return __WEBPACK_IMPORTED_MODULE_8__src_string__["a"];
|
16347 | });
|
16348 | var __WEBPACK_IMPORTED_MODULE_9__src_transform_index__ = __webpack_require__(252);
|
16349 | __webpack_require__.d(__webpack_exports__, "interpolateTransformCss", function () {
|
16350 | return __WEBPACK_IMPORTED_MODULE_9__src_transform_index__["a"];
|
16351 | });
|
16352 | __webpack_require__.d(__webpack_exports__, "interpolateTransformSvg", function () {
|
16353 | return __WEBPACK_IMPORTED_MODULE_9__src_transform_index__["b"];
|
16354 | });
|
16355 | var __WEBPACK_IMPORTED_MODULE_10__src_zoom__ = __webpack_require__(255);
|
16356 | __webpack_require__.d(__webpack_exports__, "interpolateZoom", function () {
|
16357 | return __WEBPACK_IMPORTED_MODULE_10__src_zoom__["a"];
|
16358 | });
|
16359 | var __WEBPACK_IMPORTED_MODULE_11__src_rgb__ = __webpack_require__(90);
|
16360 | __webpack_require__.d(__webpack_exports__, "interpolateRgb", function () {
|
16361 | return __WEBPACK_IMPORTED_MODULE_11__src_rgb__["a"];
|
16362 | });
|
16363 | __webpack_require__.d(__webpack_exports__, "interpolateRgbBasis", function () {
|
16364 | return __WEBPACK_IMPORTED_MODULE_11__src_rgb__["b"];
|
16365 | });
|
16366 | __webpack_require__.d(__webpack_exports__, "interpolateRgbBasisClosed", function () {
|
16367 | return __WEBPACK_IMPORTED_MODULE_11__src_rgb__["c"];
|
16368 | });
|
16369 | var __WEBPACK_IMPORTED_MODULE_12__src_hsl__ = __webpack_require__(256);
|
16370 | __webpack_require__.d(__webpack_exports__, "interpolateHsl", function () {
|
16371 | return __WEBPACK_IMPORTED_MODULE_12__src_hsl__["a"];
|
16372 | });
|
16373 | __webpack_require__.d(__webpack_exports__, "interpolateHslLong", function () {
|
16374 | return __WEBPACK_IMPORTED_MODULE_12__src_hsl__["b"];
|
16375 | });
|
16376 | var __WEBPACK_IMPORTED_MODULE_13__src_lab__ = __webpack_require__(257);
|
16377 | __webpack_require__.d(__webpack_exports__, "interpolateLab", function () {
|
16378 | return __WEBPACK_IMPORTED_MODULE_13__src_lab__["a"];
|
16379 | });
|
16380 | var __WEBPACK_IMPORTED_MODULE_14__src_hcl__ = __webpack_require__(258);
|
16381 | __webpack_require__.d(__webpack_exports__, "interpolateHcl", function () {
|
16382 | return __WEBPACK_IMPORTED_MODULE_14__src_hcl__["a"];
|
16383 | });
|
16384 | __webpack_require__.d(__webpack_exports__, "interpolateHclLong", function () {
|
16385 | return __WEBPACK_IMPORTED_MODULE_14__src_hcl__["b"];
|
16386 | });
|
16387 | var __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__ = __webpack_require__(259);
|
16388 | __webpack_require__.d(__webpack_exports__, "interpolateCubehelix", function () {
|
16389 | return __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__["b"];
|
16390 | });
|
16391 | __webpack_require__.d(__webpack_exports__, "interpolateCubehelixLong", function () {
|
16392 | return __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__["a"];
|
16393 | });
|
16394 | var __WEBPACK_IMPORTED_MODULE_16__src_quantize__ = __webpack_require__(260);
|
16395 | __webpack_require__.d(__webpack_exports__, "quantize", function () {
|
16396 | return __WEBPACK_IMPORTED_MODULE_16__src_quantize__["a"];
|
16397 | });
|
16398 |
|
16399 |
|
16400 | },
|
16401 |
|
16402 | function (module, __webpack_exports__, __webpack_require__) {
|
16403 |
|
16404 | "use strict";
|
16405 |
|
16406 | __webpack_exports__["a"] = lab;
|
16407 |
|
16408 | __webpack_exports__["b"] = hcl;
|
16409 |
|
16410 | var __WEBPACK_IMPORTED_MODULE_0__define__ = __webpack_require__(50);
|
16411 | var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(49);
|
16412 | var __WEBPACK_IMPORTED_MODULE_2__math__ = __webpack_require__(89);
|
16413 |
|
16414 | var Kn = 18,
|
16415 | Xn = 0.950470,
|
16416 |
|
16417 |
|
16418 | Yn = 1,
|
16419 | Zn = 1.088830,
|
16420 | t0 = 4 / 29,
|
16421 | t1 = 6 / 29,
|
16422 | t2 = 3 * t1 * t1,
|
16423 | t3 = t1 * t1 * t1;
|
16424 |
|
16425 | function labConvert(o) {
|
16426 | if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
|
16427 | if (o instanceof Hcl) {
|
16428 | var h = o.h * __WEBPACK_IMPORTED_MODULE_2__math__["a" ];
|
16429 | return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
|
16430 | }
|
16431 | if (!(o instanceof __WEBPACK_IMPORTED_MODULE_1__color__["b" ])) o = Object(__WEBPACK_IMPORTED_MODULE_1__color__["h" ])(o);
|
16432 | var b = rgb2xyz(o.r),
|
16433 | a = rgb2xyz(o.g),
|
16434 | l = rgb2xyz(o.b),
|
16435 | x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),
|
16436 | y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),
|
16437 | z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);
|
16438 | return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
|
16439 | }
|
16440 |
|
16441 | function lab(l, a, b, opacity) {
|
16442 | return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
|
16443 | }
|
16444 |
|
16445 | function Lab(l, a, b, opacity) {
|
16446 | this.l = +l;
|
16447 | this.a = +a;
|
16448 | this.b = +b;
|
16449 | this.opacity = +opacity;
|
16450 | }
|
16451 |
|
16452 | Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" ])(Lab, lab, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" ])(__WEBPACK_IMPORTED_MODULE_1__color__["a" ], {
|
16453 | brighter: function brighter(k) {
|
16454 | return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
|
16455 | },
|
16456 | darker: function darker(k) {
|
16457 | return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
|
16458 | },
|
16459 | rgb: function rgb() {
|
16460 | var y = (this.l + 16) / 116,
|
16461 | x = isNaN(this.a) ? y : y + this.a / 500,
|
16462 | z = isNaN(this.b) ? y : y - this.b / 200;
|
16463 | y = Yn * lab2xyz(y);
|
16464 | x = Xn * lab2xyz(x);
|
16465 | z = Zn * lab2xyz(z);
|
16466 | return new __WEBPACK_IMPORTED_MODULE_1__color__["b" ](xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z),
|
16467 | xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z), xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), this.opacity);
|
16468 | }
|
16469 | }));
|
16470 |
|
16471 | function xyz2lab(t) {
|
16472 | return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
|
16473 | }
|
16474 |
|
16475 | function lab2xyz(t) {
|
16476 | return t > t1 ? t * t * t : t2 * (t - t0);
|
16477 | }
|
16478 |
|
16479 | function xyz2rgb(x) {
|
16480 | return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
|
16481 | }
|
16482 |
|
16483 | function rgb2xyz(x) {
|
16484 | return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
|
16485 | }
|
16486 |
|
16487 | function hclConvert(o) {
|
16488 | if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
|
16489 | if (!(o instanceof Lab)) o = labConvert(o);
|
16490 | var h = Math.atan2(o.b, o.a) * __WEBPACK_IMPORTED_MODULE_2__math__["b" ];
|
16491 | return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
|
16492 | }
|
16493 |
|
16494 | function hcl(h, c, l, opacity) {
|
16495 | return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
|
16496 | }
|
16497 |
|
16498 | function Hcl(h, c, l, opacity) {
|
16499 | this.h = +h;
|
16500 | this.c = +c;
|
16501 | this.l = +l;
|
16502 | this.opacity = +opacity;
|
16503 | }
|
16504 |
|
16505 | Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" ])(Hcl, hcl, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" ])(__WEBPACK_IMPORTED_MODULE_1__color__["a" ], {
|
16506 | brighter: function brighter(k) {
|
16507 | return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
|
16508 | },
|
16509 | darker: function darker(k) {
|
16510 | return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
|
16511 | },
|
16512 | rgb: function rgb() {
|
16513 | return labConvert(this).rgb();
|
16514 | }
|
16515 | }));
|
16516 |
|
16517 |
|
16518 | },
|
16519 |
|
16520 | function (module, __webpack_exports__, __webpack_require__) {
|
16521 |
|
16522 | "use strict";
|
16523 |
|
16524 | __webpack_exports__["a"] = cubehelix;
|
16525 |
|
16526 | var __WEBPACK_IMPORTED_MODULE_0__define__ = __webpack_require__(50);
|
16527 | var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(49);
|
16528 | var __WEBPACK_IMPORTED_MODULE_2__math__ = __webpack_require__(89);
|
16529 |
|
16530 | var A = -0.14861,
|
16531 | B = +1.78277,
|
16532 | C = -0.29227,
|
16533 | D = -0.90649,
|
16534 | E = +1.97294,
|
16535 | ED = E * D,
|
16536 | EB = E * B,
|
16537 | BC_DA = B * C - D * A;
|
16538 |
|
16539 | function cubehelixConvert(o) {
|
16540 | if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
|
16541 | if (!(o instanceof __WEBPACK_IMPORTED_MODULE_1__color__["b" ])) o = Object(__WEBPACK_IMPORTED_MODULE_1__color__["h" ])(o);
|
16542 | var r = o.r / 255,
|
16543 | g = o.g / 255,
|
16544 | b = o.b / 255,
|
16545 | l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
|
16546 | bl = b - l,
|
16547 | k = (E * (g - l) - C * bl) / D,
|
16548 | s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)),
|
16549 |
|
16550 |
|
16551 | h = s ? Math.atan2(k, bl) * __WEBPACK_IMPORTED_MODULE_2__math__["b" ] - 120 : NaN;
|
16552 | return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
|
16553 | }
|
16554 |
|
16555 | function cubehelix(h, s, l, opacity) {
|
16556 | return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
|
16557 | }
|
16558 |
|
16559 | function Cubehelix(h, s, l, opacity) {
|
16560 | this.h = +h;
|
16561 | this.s = +s;
|
16562 | this.l = +l;
|
16563 | this.opacity = +opacity;
|
16564 | }
|
16565 |
|
16566 | Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" ])(Cubehelix, cubehelix, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" ])(__WEBPACK_IMPORTED_MODULE_1__color__["a" ], {
|
16567 | brighter: function brighter(k) {
|
16568 | k = k == null ? __WEBPACK_IMPORTED_MODULE_1__color__["c" ] : Math.pow(__WEBPACK_IMPORTED_MODULE_1__color__["c" ], k);
|
16569 | return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
|
16570 | },
|
16571 | darker: function darker(k) {
|
16572 | k = k == null ? __WEBPACK_IMPORTED_MODULE_1__color__["d" ] : Math.pow(__WEBPACK_IMPORTED_MODULE_1__color__["d" ], k);
|
16573 | return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
|
16574 | },
|
16575 | rgb: function rgb() {
|
16576 | var h = isNaN(this.h) ? 0 : (this.h + 120) * __WEBPACK_IMPORTED_MODULE_2__math__["a" ],
|
16577 | l = +this.l,
|
16578 | a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
|
16579 | cosh = Math.cos(h),
|
16580 | sinh = Math.sin(h);
|
16581 | return new __WEBPACK_IMPORTED_MODULE_1__color__["b" ](255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity);
|
16582 | }
|
16583 | }));
|
16584 |
|
16585 |
|
16586 | },
|
16587 |
|
16588 | function (module, __webpack_exports__, __webpack_require__) {
|
16589 |
|
16590 | "use strict";
|
16591 |
|
16592 | __webpack_exports__["a"] = function (a, b) {
|
16593 | return a = +a, b -= a, function (t) {
|
16594 | return Math.round(a + b * t);
|
16595 | };
|
16596 | };
|
16597 |
|
16598 |
|
16599 | },
|
16600 |
|
16601 | function (module, __webpack_exports__, __webpack_require__) {
|
16602 |
|
16603 | "use strict";
|
16604 |
|
16605 | __webpack_require__.d(__webpack_exports__, "a", function () {
|
16606 | return interpolateTransformCss;
|
16607 | });
|
16608 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
16609 | return interpolateTransformSvg;
|
16610 | });
|
16611 | var __WEBPACK_IMPORTED_MODULE_0__number__ = __webpack_require__(29);
|
16612 | var __WEBPACK_IMPORTED_MODULE_1__parse__ = __webpack_require__(253);
|
16613 |
|
16614 | function interpolateTransform(parse, pxComma, pxParen, degParen) {
|
16615 |
|
16616 | function pop(s) {
|
16617 | return s.length ? s.pop() + " " : "";
|
16618 | }
|
16619 |
|
16620 | function translate(xa, ya, xb, yb, s, q) {
|
16621 | if (xa !== xb || ya !== yb) {
|
16622 | var i = s.push("translate(", null, pxComma, null, pxParen);
|
16623 | q.push({ i: i - 4, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" ])(xa, xb) }, { i: i - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" ])(ya, yb) });
|
16624 | } else if (xb || yb) {
|
16625 | s.push("translate(" + xb + pxComma + yb + pxParen);
|
16626 | }
|
16627 | }
|
16628 |
|
16629 | function rotate(a, b, s, q) {
|
16630 | if (a !== b) {
|
16631 | if (a - b > 180) b += 360;else if (b - a > 180) a += 360;
|
16632 | q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" ])(a, b) });
|
16633 | } else if (b) {
|
16634 | s.push(pop(s) + "rotate(" + b + degParen);
|
16635 | }
|
16636 | }
|
16637 |
|
16638 | function skewX(a, b, s, q) {
|
16639 | if (a !== b) {
|
16640 | q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" ])(a, b) });
|
16641 | } else if (b) {
|
16642 | s.push(pop(s) + "skewX(" + b + degParen);
|
16643 | }
|
16644 | }
|
16645 |
|
16646 | function scale(xa, ya, xb, yb, s, q) {
|
16647 | if (xa !== xb || ya !== yb) {
|
16648 | var i = s.push(pop(s) + "scale(", null, ",", null, ")");
|
16649 | q.push({ i: i - 4, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" ])(xa, xb) }, { i: i - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" ])(ya, yb) });
|
16650 | } else if (xb !== 1 || yb !== 1) {
|
16651 | s.push(pop(s) + "scale(" + xb + "," + yb + ")");
|
16652 | }
|
16653 | }
|
16654 |
|
16655 | return function (a, b) {
|
16656 | var s = [],
|
16657 |
|
16658 |
|
16659 | q = [];
|
16660 | a = parse(a), b = parse(b);
|
16661 | translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
|
16662 | rotate(a.rotate, b.rotate, s, q);
|
16663 | skewX(a.skewX, b.skewX, s, q);
|
16664 | scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
|
16665 | a = b = null;
|
16666 | return function (t) {
|
16667 | var i = -1,
|
16668 | n = q.length,
|
16669 | o;
|
16670 | while (++i < n) {
|
16671 | s[(o = q[i]).i] = o.x(t);
|
16672 | }return s.join("");
|
16673 | };
|
16674 | };
|
16675 | }
|
16676 |
|
16677 | var interpolateTransformCss = interpolateTransform(__WEBPACK_IMPORTED_MODULE_1__parse__["a" ], "px, ", "px)", "deg)");
|
16678 | var interpolateTransformSvg = interpolateTransform(__WEBPACK_IMPORTED_MODULE_1__parse__["b" ], ", ", ")", ")");
|
16679 |
|
16680 |
|
16681 | },
|
16682 |
|
16683 | function (module, __webpack_exports__, __webpack_require__) {
|
16684 |
|
16685 | "use strict";
|
16686 |
|
16687 | __webpack_exports__["a"] = parseCss;
|
16688 | __webpack_exports__["b"] = parseSvg;
|
16689 | var __WEBPACK_IMPORTED_MODULE_0__decompose__ = __webpack_require__(254);
|
16690 |
|
16691 | var cssNode, cssRoot, cssView, svgNode;
|
16692 |
|
16693 | function parseCss(value) {
|
16694 | if (value === "none") return __WEBPACK_IMPORTED_MODULE_0__decompose__["b" ];
|
16695 | if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
|
16696 | cssNode.style.transform = value;
|
16697 | value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
|
16698 | cssRoot.removeChild(cssNode);
|
16699 | value = value.slice(7, -1).split(",");
|
16700 | return Object(__WEBPACK_IMPORTED_MODULE_0__decompose__["a" ])(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
|
16701 | }
|
16702 |
|
16703 | function parseSvg(value) {
|
16704 | if (value == null) return __WEBPACK_IMPORTED_MODULE_0__decompose__["b" ];
|
16705 | if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
16706 | svgNode.setAttribute("transform", value);
|
16707 | if (!(value = svgNode.transform.baseVal.consolidate())) return __WEBPACK_IMPORTED_MODULE_0__decompose__["b" ];
|
16708 | value = value.matrix;
|
16709 | return Object(__WEBPACK_IMPORTED_MODULE_0__decompose__["a" ])(value.a, value.b, value.c, value.d, value.e, value.f);
|
16710 | }
|
16711 |
|
16712 |
|
16713 | },
|
16714 |
|
16715 | function (module, __webpack_exports__, __webpack_require__) {
|
16716 |
|
16717 | "use strict";
|
16718 |
|
16719 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
16720 | return identity;
|
16721 | });
|
16722 | var degrees = 180 / Math.PI;
|
16723 |
|
16724 | var identity = {
|
16725 | translateX: 0,
|
16726 | translateY: 0,
|
16727 | rotate: 0,
|
16728 | skewX: 0,
|
16729 | scaleX: 1,
|
16730 | scaleY: 1
|
16731 | };
|
16732 |
|
16733 | __webpack_exports__["a"] = function (a, b, c, d, e, f) {
|
16734 | var scaleX, scaleY, skewX;
|
16735 | if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
|
16736 | if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
|
16737 | if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
|
16738 | if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
|
16739 | return {
|
16740 | translateX: e,
|
16741 | translateY: f,
|
16742 | rotate: Math.atan2(b, a) * degrees,
|
16743 | skewX: Math.atan(skewX) * degrees,
|
16744 | scaleX: scaleX,
|
16745 | scaleY: scaleY
|
16746 | };
|
16747 | };
|
16748 |
|
16749 |
|
16750 | },
|
16751 |
|
16752 | function (module, __webpack_exports__, __webpack_require__) {
|
16753 |
|
16754 | "use strict";
|
16755 |
|
16756 | var rho = Math.SQRT2,
|
16757 | rho2 = 2,
|
16758 | rho4 = 4,
|
16759 | epsilon2 = 1e-12;
|
16760 |
|
16761 | function cosh(x) {
|
16762 | return ((x = Math.exp(x)) + 1 / x) / 2;
|
16763 | }
|
16764 |
|
16765 | function sinh(x) {
|
16766 | return ((x = Math.exp(x)) - 1 / x) / 2;
|
16767 | }
|
16768 |
|
16769 | function tanh(x) {
|
16770 | return ((x = Math.exp(2 * x)) - 1) / (x + 1);
|
16771 | }
|
16772 |
|
16773 |
|
16774 |
|
16775 | __webpack_exports__["a"] = function (p0, p1) {
|
16776 | var ux0 = p0[0],
|
16777 | uy0 = p0[1],
|
16778 | w0 = p0[2],
|
16779 | ux1 = p1[0],
|
16780 | uy1 = p1[1],
|
16781 | w1 = p1[2],
|
16782 | dx = ux1 - ux0,
|
16783 | dy = uy1 - uy0,
|
16784 | d2 = dx * dx + dy * dy,
|
16785 | i,
|
16786 | S;
|
16787 |
|
16788 |
|
16789 | if (d2 < epsilon2) {
|
16790 | S = Math.log(w1 / w0) / rho;
|
16791 | i = function i(t) {
|
16792 | return [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S)];
|
16793 | };
|
16794 | }
|
16795 |
|
16796 |
|
16797 | else {
|
16798 | var d1 = Math.sqrt(d2),
|
16799 | b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
|
16800 | b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
|
16801 | r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
|
16802 | r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
16803 | S = (r1 - r0) / rho;
|
16804 | i = function i(t) {
|
16805 | var s = t * S,
|
16806 | coshr0 = cosh(r0),
|
16807 | u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
|
16808 | return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0)];
|
16809 | };
|
16810 | }
|
16811 |
|
16812 | i.duration = S * 1000;
|
16813 |
|
16814 | return i;
|
16815 | };
|
16816 |
|
16817 |
|
16818 | },
|
16819 |
|
16820 | function (module, __webpack_exports__, __webpack_require__) {
|
16821 |
|
16822 | "use strict";
|
16823 |
|
16824 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
16825 | return hslLong;
|
16826 | });
|
16827 | var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
|
16828 | var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(19);
|
16829 |
|
16830 | function hsl(hue) {
|
16831 | return function (start, end) {
|
16832 | var h = hue((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["d" ])(start)).h, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["d" ])(end)).h),
|
16833 | s = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.s, end.s),
|
16834 | l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.l, end.l),
|
16835 | opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.opacity, end.opacity);
|
16836 | return function (t) {
|
16837 | start.h = h(t);
|
16838 | start.s = s(t);
|
16839 | start.l = l(t);
|
16840 | start.opacity = opacity(t);
|
16841 | return start + "";
|
16842 | };
|
16843 | };
|
16844 | }
|
16845 |
|
16846 | __webpack_exports__["a"] = hsl(__WEBPACK_IMPORTED_MODULE_1__color__["c" ]);
|
16847 | var hslLong = hsl(__WEBPACK_IMPORTED_MODULE_1__color__["a" ]);
|
16848 |
|
16849 |
|
16850 | },
|
16851 |
|
16852 | function (module, __webpack_exports__, __webpack_require__) {
|
16853 |
|
16854 | "use strict";
|
16855 |
|
16856 | __webpack_exports__["a"] = lab;
|
16857 | var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
|
16858 | var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(19);
|
16859 |
|
16860 | function lab(start, end) {
|
16861 | var l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["e" ])(start)).l, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["e" ])(end)).l),
|
16862 | a = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.a, end.a),
|
16863 | b = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.b, end.b),
|
16864 | opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.opacity, end.opacity);
|
16865 | return function (t) {
|
16866 | start.l = l(t);
|
16867 | start.a = a(t);
|
16868 | start.b = b(t);
|
16869 | start.opacity = opacity(t);
|
16870 | return start + "";
|
16871 | };
|
16872 | }
|
16873 |
|
16874 |
|
16875 | },
|
16876 |
|
16877 | function (module, __webpack_exports__, __webpack_require__) {
|
16878 |
|
16879 | "use strict";
|
16880 |
|
16881 | __webpack_require__.d(__webpack_exports__, "b", function () {
|
16882 | return hclLong;
|
16883 | });
|
16884 | var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
|
16885 | var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(19);
|
16886 |
|
16887 | function hcl(hue) {
|
16888 | return function (start, end) {
|
16889 | var h = hue((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["c" ])(start)).h, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["c" ])(end)).h),
|
16890 | c = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.c, end.c),
|
16891 | l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.l, end.l),
|
16892 | opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.opacity, end.opacity);
|
16893 | return function (t) {
|
16894 | start.h = h(t);
|
16895 | start.c = c(t);
|
16896 | start.l = l(t);
|
16897 | start.opacity = opacity(t);
|
16898 | return start + "";
|
16899 | };
|
16900 | };
|
16901 | }
|
16902 |
|
16903 | __webpack_exports__["a"] = hcl(__WEBPACK_IMPORTED_MODULE_1__color__["c" ]);
|
16904 | var hclLong = hcl(__WEBPACK_IMPORTED_MODULE_1__color__["a" ]);
|
16905 |
|
16906 |
|
16907 | },
|
16908 |
|
16909 | function (module, __webpack_exports__, __webpack_require__) {
|
16910 |
|
16911 | "use strict";
|
16912 |
|
16913 | __webpack_require__.d(__webpack_exports__, "a", function () {
|
16914 | return cubehelixLong;
|
16915 | });
|
16916 | var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
|
16917 | var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(19);
|
16918 |
|
16919 | function cubehelix(hue) {
|
16920 | return function cubehelixGamma(y) {
|
16921 | y = +y;
|
16922 |
|
16923 | function cubehelix(start, end) {
|
16924 | var h = hue((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["b" ])(start)).h, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["b" ])(end)).h),
|
16925 | s = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.s, end.s),
|
16926 | l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.l, end.l),
|
16927 | opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" ])(start.opacity, end.opacity);
|
16928 | return function (t) {
|
16929 | start.h = h(t);
|
16930 | start.s = s(t);
|
16931 | start.l = l(Math.pow(t, y));
|
16932 | start.opacity = opacity(t);
|
16933 | return start + "";
|
16934 | };
|
16935 | }
|
16936 |
|
16937 | cubehelix.gamma = cubehelixGamma;
|
16938 |
|
16939 | return cubehelix;
|
16940 | }(1);
|
16941 | }
|
16942 |
|
16943 | __webpack_exports__["b"] = cubehelix(__WEBPACK_IMPORTED_MODULE_1__color__["c" ]);
|
16944 | var cubehelixLong = cubehelix(__WEBPACK_IMPORTED_MODULE_1__color__["a" ]);
|
16945 |
|
16946 |
|
16947 | },
|
16948 |
|
16949 | function (module, __webpack_exports__, __webpack_require__) {
|
16950 |
|
16951 | "use strict";
|
16952 |
|
16953 | __webpack_exports__["a"] = function (interpolator, n) {
|
16954 | var samples = new Array(n);
|
16955 | for (var i = 0; i < n; ++i) {
|
16956 | samples[i] = interpolator(i / (n - 1));
|
16957 | }return samples;
|
16958 | };
|
16959 |
|
16960 |
|
16961 | },
|
16962 |
|
16963 | function (module, exports, __webpack_require__) {
|
16964 |
|
16965 | var __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
16966 | return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
16967 | } : function (obj) {
|
16968 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
|
16969 | };
|
16970 |
|
16971 | |
16972 |
|
16973 |
|
16974 |
|
16975 |
|
16976 |
|
16977 |
|
16978 | ;(function (exports) {
|
16979 | 'use strict';
|
16980 |
|
16981 | |
16982 |
|
16983 |
|
16984 |
|
16985 |
|
16986 |
|
16987 |
|
16988 | function EventEmitter() {}
|
16989 |
|
16990 |
|
16991 | var proto = EventEmitter.prototype;
|
16992 | var originalGlobalValue = exports.EventEmitter;
|
16993 |
|
16994 | |
16995 |
|
16996 |
|
16997 |
|
16998 |
|
16999 |
|
17000 |
|
17001 |
|
17002 | function indexOfListener(listeners, listener) {
|
17003 | var i = listeners.length;
|
17004 | while (i--) {
|
17005 | if (listeners[i].listener === listener) {
|
17006 | return i;
|
17007 | }
|
17008 | }
|
17009 |
|
17010 | return -1;
|
17011 | }
|
17012 |
|
17013 | |
17014 |
|
17015 |
|
17016 |
|
17017 |
|
17018 |
|
17019 |
|
17020 | function alias(name) {
|
17021 | return function aliasClosure() {
|
17022 | return this[name].apply(this, arguments);
|
17023 | };
|
17024 | }
|
17025 |
|
17026 | |
17027 |
|
17028 |
|
17029 |
|
17030 |
|
17031 |
|
17032 |
|
17033 |
|
17034 |
|
17035 | proto.getListeners = function getListeners(evt) {
|
17036 | var events = this._getEvents();
|
17037 | var response;
|
17038 | var key;
|
17039 |
|
17040 |
|
17041 |
|
17042 | if (evt instanceof RegExp) {
|
17043 | response = {};
|
17044 | for (key in events) {
|
17045 | if (events.hasOwnProperty(key) && evt.test(key)) {
|
17046 | response[key] = events[key];
|
17047 | }
|
17048 | }
|
17049 | } else {
|
17050 | response = events[evt] || (events[evt] = []);
|
17051 | }
|
17052 |
|
17053 | return response;
|
17054 | };
|
17055 |
|
17056 | |
17057 |
|
17058 |
|
17059 |
|
17060 |
|
17061 |
|
17062 | proto.flattenListeners = function flattenListeners(listeners) {
|
17063 | var flatListeners = [];
|
17064 | var i;
|
17065 |
|
17066 | for (i = 0; i < listeners.length; i += 1) {
|
17067 | flatListeners.push(listeners[i].listener);
|
17068 | }
|
17069 |
|
17070 | return flatListeners;
|
17071 | };
|
17072 |
|
17073 | |
17074 |
|
17075 |
|
17076 |
|
17077 |
|
17078 |
|
17079 | proto.getListenersAsObject = function getListenersAsObject(evt) {
|
17080 | var listeners = this.getListeners(evt);
|
17081 | var response;
|
17082 |
|
17083 | if (listeners instanceof Array) {
|
17084 | response = {};
|
17085 | response[evt] = listeners;
|
17086 | }
|
17087 |
|
17088 | return response || listeners;
|
17089 | };
|
17090 |
|
17091 | function isValidListener(listener) {
|
17092 | if (typeof listener === 'function' || listener instanceof RegExp) {
|
17093 | return true;
|
17094 | } else if (listener && (typeof listener === 'undefined' ? 'undefined' : _typeof(listener)) === 'object') {
|
17095 | return isValidListener(listener.listener);
|
17096 | } else {
|
17097 | return false;
|
17098 | }
|
17099 | }
|
17100 |
|
17101 | |
17102 |
|
17103 |
|
17104 |
|
17105 |
|
17106 |
|
17107 |
|
17108 |
|
17109 |
|
17110 |
|
17111 | proto.addListener = function addListener(evt, listener) {
|
17112 | if (!isValidListener(listener)) {
|
17113 | throw new TypeError('listener must be a function');
|
17114 | }
|
17115 |
|
17116 | var listeners = this.getListenersAsObject(evt);
|
17117 | var listenerIsWrapped = (typeof listener === 'undefined' ? 'undefined' : _typeof(listener)) === 'object';
|
17118 | var key;
|
17119 |
|
17120 | for (key in listeners) {
|
17121 | if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
|
17122 | listeners[key].push(listenerIsWrapped ? listener : {
|
17123 | listener: listener,
|
17124 | once: false
|
17125 | });
|
17126 | }
|
17127 | }
|
17128 |
|
17129 | return this;
|
17130 | };
|
17131 |
|
17132 | |
17133 |
|
17134 |
|
17135 | proto.on = alias('addListener');
|
17136 |
|
17137 | |
17138 |
|
17139 |
|
17140 |
|
17141 |
|
17142 |
|
17143 |
|
17144 |
|
17145 | proto.addOnceListener = function addOnceListener(evt, listener) {
|
17146 | return this.addListener(evt, {
|
17147 | listener: listener,
|
17148 | once: true
|
17149 | });
|
17150 | };
|
17151 |
|
17152 | |
17153 |
|
17154 |
|
17155 | proto.once = alias('addOnceListener');
|
17156 |
|
17157 | |
17158 |
|
17159 |
|
17160 |
|
17161 |
|
17162 |
|
17163 |
|
17164 | proto.defineEvent = function defineEvent(evt) {
|
17165 | this.getListeners(evt);
|
17166 | return this;
|
17167 | };
|
17168 |
|
17169 | |
17170 |
|
17171 |
|
17172 |
|
17173 |
|
17174 |
|
17175 | proto.defineEvents = function defineEvents(evts) {
|
17176 | for (var i = 0; i < evts.length; i += 1) {
|
17177 | this.defineEvent(evts[i]);
|
17178 | }
|
17179 | return this;
|
17180 | };
|
17181 |
|
17182 | |
17183 |
|
17184 |
|
17185 |
|
17186 |
|
17187 |
|
17188 |
|
17189 |
|
17190 | proto.removeListener = function removeListener(evt, listener) {
|
17191 | var listeners = this.getListenersAsObject(evt);
|
17192 | var index;
|
17193 | var key;
|
17194 |
|
17195 | for (key in listeners) {
|
17196 | if (listeners.hasOwnProperty(key)) {
|
17197 | index = indexOfListener(listeners[key], listener);
|
17198 |
|
17199 | if (index !== -1) {
|
17200 | listeners[key].splice(index, 1);
|
17201 | }
|
17202 | }
|
17203 | }
|
17204 |
|
17205 | return this;
|
17206 | };
|
17207 |
|
17208 | |
17209 |
|
17210 |
|
17211 | proto.off = alias('removeListener');
|
17212 |
|
17213 | |
17214 |
|
17215 |
|
17216 |
|
17217 |
|
17218 |
|
17219 |
|
17220 |
|
17221 |
|
17222 |
|
17223 | proto.addListeners = function addListeners(evt, listeners) {
|
17224 |
|
17225 | return this.manipulateListeners(false, evt, listeners);
|
17226 | };
|
17227 |
|
17228 | |
17229 |
|
17230 |
|
17231 |
|
17232 |
|
17233 |
|
17234 |
|
17235 |
|
17236 |
|
17237 |
|
17238 | proto.removeListeners = function removeListeners(evt, listeners) {
|
17239 |
|
17240 | return this.manipulateListeners(true, evt, listeners);
|
17241 | };
|
17242 |
|
17243 | |
17244 |
|
17245 |
|
17246 |
|
17247 |
|
17248 |
|
17249 |
|
17250 |
|
17251 |
|
17252 |
|
17253 |
|
17254 |
|
17255 | proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
|
17256 | var i;
|
17257 | var value;
|
17258 | var single = remove ? this.removeListener : this.addListener;
|
17259 | var multiple = remove ? this.removeListeners : this.addListeners;
|
17260 |
|
17261 |
|
17262 | if ((typeof evt === 'undefined' ? 'undefined' : _typeof(evt)) === 'object' && !(evt instanceof RegExp)) {
|
17263 | for (i in evt) {
|
17264 | if (evt.hasOwnProperty(i) && (value = evt[i])) {
|
17265 |
|
17266 | if (typeof value === 'function') {
|
17267 | single.call(this, i, value);
|
17268 | } else {
|
17269 |
|
17270 | multiple.call(this, i, value);
|
17271 | }
|
17272 | }
|
17273 | }
|
17274 | } else {
|
17275 |
|
17276 |
|
17277 |
|
17278 | i = listeners.length;
|
17279 | while (i--) {
|
17280 | single.call(this, evt, listeners[i]);
|
17281 | }
|
17282 | }
|
17283 |
|
17284 | return this;
|
17285 | };
|
17286 |
|
17287 | |
17288 |
|
17289 |
|
17290 |
|
17291 |
|
17292 |
|
17293 |
|
17294 |
|
17295 |
|
17296 | proto.removeEvent = function removeEvent(evt) {
|
17297 | var type = typeof evt === 'undefined' ? 'undefined' : _typeof(evt);
|
17298 | var events = this._getEvents();
|
17299 | var key;
|
17300 |
|
17301 |
|
17302 | if (type === 'string') {
|
17303 |
|
17304 | delete events[evt];
|
17305 | } else if (evt instanceof RegExp) {
|
17306 |
|
17307 | for (key in events) {
|
17308 | if (events.hasOwnProperty(key) && evt.test(key)) {
|
17309 | delete events[key];
|
17310 | }
|
17311 | }
|
17312 | } else {
|
17313 |
|
17314 | delete this._events;
|
17315 | }
|
17316 |
|
17317 | return this;
|
17318 | };
|
17319 |
|
17320 | |
17321 |
|
17322 |
|
17323 |
|
17324 |
|
17325 | proto.removeAllListeners = alias('removeEvent');
|
17326 |
|
17327 | |
17328 |
|
17329 |
|
17330 |
|
17331 |
|
17332 |
|
17333 |
|
17334 |
|
17335 |
|
17336 |
|
17337 |
|
17338 |
|
17339 | proto.emitEvent = function emitEvent(evt, args) {
|
17340 | var listenersMap = this.getListenersAsObject(evt);
|
17341 | var listeners;
|
17342 | var listener;
|
17343 | var i;
|
17344 | var key;
|
17345 | var response;
|
17346 |
|
17347 | for (key in listenersMap) {
|
17348 | if (listenersMap.hasOwnProperty(key)) {
|
17349 | listeners = listenersMap[key].slice(0);
|
17350 |
|
17351 | for (i = 0; i < listeners.length; i++) {
|
17352 |
|
17353 |
|
17354 | listener = listeners[i];
|
17355 |
|
17356 | if (listener.once === true) {
|
17357 | this.removeListener(evt, listener.listener);
|
17358 | }
|
17359 |
|
17360 | response = listener.listener.apply(this, args || []);
|
17361 |
|
17362 | if (response === this._getOnceReturnValue()) {
|
17363 | this.removeListener(evt, listener.listener);
|
17364 | }
|
17365 | }
|
17366 | }
|
17367 | }
|
17368 |
|
17369 | return this;
|
17370 | };
|
17371 |
|
17372 | |
17373 |
|
17374 |
|
17375 | proto.trigger = alias('emitEvent');
|
17376 |
|
17377 | |
17378 |
|
17379 |
|
17380 |
|
17381 |
|
17382 |
|
17383 |
|
17384 |
|
17385 | proto.emit = function emit(evt) {
|
17386 | var args = Array.prototype.slice.call(arguments, 1);
|
17387 | return this.emitEvent(evt, args);
|
17388 | };
|
17389 |
|
17390 | |
17391 |
|
17392 |
|
17393 |
|
17394 |
|
17395 |
|
17396 |
|
17397 |
|
17398 | proto.setOnceReturnValue = function setOnceReturnValue(value) {
|
17399 | this._onceReturnValue = value;
|
17400 | return this;
|
17401 | };
|
17402 |
|
17403 | |
17404 |
|
17405 |
|
17406 |
|
17407 |
|
17408 |
|
17409 |
|
17410 |
|
17411 | proto._getOnceReturnValue = function _getOnceReturnValue() {
|
17412 | if (this.hasOwnProperty('_onceReturnValue')) {
|
17413 | return this._onceReturnValue;
|
17414 | } else {
|
17415 | return true;
|
17416 | }
|
17417 | };
|
17418 |
|
17419 | |
17420 |
|
17421 |
|
17422 |
|
17423 |
|
17424 |
|
17425 | proto._getEvents = function _getEvents() {
|
17426 | return this._events || (this._events = {});
|
17427 | };
|
17428 |
|
17429 | |
17430 |
|
17431 |
|
17432 |
|
17433 |
|
17434 | EventEmitter.noConflict = function noConflict() {
|
17435 | exports.EventEmitter = originalGlobalValue;
|
17436 | return EventEmitter;
|
17437 | };
|
17438 |
|
17439 |
|
17440 | if (true) {
|
17441 | !(__WEBPACK_AMD_DEFINE_RESULT__ = function () {
|
17442 | return EventEmitter;
|
17443 | }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
17444 | } else if ((typeof module === 'undefined' ? 'undefined' : _typeof(module)) === 'object' && module.exports) {
|
17445 | module.exports = EventEmitter;
|
17446 | } else {
|
17447 | exports.EventEmitter = EventEmitter;
|
17448 | }
|
17449 | })(this || {});
|
17450 |
|
17451 |
|
17452 | },
|
17453 |
|
17454 | function (module, exports, __webpack_require__) {
|
17455 |
|
17456 | var Shape = {
|
17457 | Rect: __webpack_require__(98),
|
17458 | Circle: __webpack_require__(99),
|
17459 | Ellipse: __webpack_require__(100),
|
17460 | Path: __webpack_require__(101),
|
17461 | Text: __webpack_require__(102),
|
17462 | Line: __webpack_require__(103),
|
17463 | Image: __webpack_require__(104),
|
17464 | Polygon: __webpack_require__(105),
|
17465 | Polyline: __webpack_require__(106),
|
17466 | Arc: __webpack_require__(107),
|
17467 | Fan: __webpack_require__(108),
|
17468 | Cubic: __webpack_require__(109),
|
17469 | Quadratic: __webpack_require__(110),
|
17470 | Marker: __webpack_require__(111)
|
17471 | };
|
17472 |
|
17473 | module.exports = Shape;
|
17474 |
|
17475 |
|
17476 | },
|
17477 |
|
17478 | function (module, exports, __webpack_require__) {
|
17479 |
|
17480 | var Util = __webpack_require__(0);
|
17481 | var Inside = __webpack_require__(2);
|
17482 | var Cubic = __webpack_require__(30);
|
17483 | var Quadratic = __webpack_require__(53);
|
17484 | var Ellipse = __webpack_require__(264);
|
17485 | var vec3 = __webpack_require__(3).vec3;
|
17486 | var mat3 = __webpack_require__(3).mat3;
|
17487 |
|
17488 | var ARR_CMD = ['m', 'l', 'c', 'a', 'q', 'h', 'v', 't', 's', 'z'];
|
17489 |
|
17490 | function toAbsolute(x, y, curPoint) {
|
17491 |
|
17492 | return {
|
17493 | x: curPoint.x + x,
|
17494 | y: curPoint.y + y
|
17495 | };
|
17496 | }
|
17497 |
|
17498 | function toSymmetry(point, center) {
|
17499 |
|
17500 | return {
|
17501 | x: center.x + (center.x - point.x),
|
17502 | y: center.y + (center.y - point.y)
|
17503 | };
|
17504 | }
|
17505 |
|
17506 | function vMag(v) {
|
17507 | return Math.sqrt(v[0] * v[0] + v[1] * v[1]);
|
17508 | }
|
17509 |
|
17510 | function vRatio(u, v) {
|
17511 | return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));
|
17512 | }
|
17513 |
|
17514 | function vAngle(u, v) {
|
17515 | return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v));
|
17516 | }
|
17517 |
|
17518 | function getArcParams(point1, point2, fa, fs, rx, ry, psiDeg) {
|
17519 | var psi = Util.mod(Util.toRadian(psiDeg), Math.PI * 2);
|
17520 | var x1 = point1.x;
|
17521 | var y1 = point1.y;
|
17522 | var x2 = point2.x;
|
17523 | var y2 = point2.y;
|
17524 | var xp = Math.cos(psi) * (x1 - x2) / 2.0 + Math.sin(psi) * (y1 - y2) / 2.0;
|
17525 | var yp = -1 * Math.sin(psi) * (x1 - x2) / 2.0 + Math.cos(psi) * (y1 - y2) / 2.0;
|
17526 | var lambda = xp * xp / (rx * rx) + yp * yp / (ry * ry);
|
17527 |
|
17528 | if (lambda > 1) {
|
17529 | rx *= Math.sqrt(lambda);
|
17530 | ry *= Math.sqrt(lambda);
|
17531 | }
|
17532 |
|
17533 | var f = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) / (rx * rx * (yp * yp) + ry * ry * (xp * xp)));
|
17534 |
|
17535 | if (fa === fs) {
|
17536 | f *= -1;
|
17537 | }
|
17538 | if (isNaN(f)) {
|
17539 | f = 0;
|
17540 | }
|
17541 |
|
17542 | var cxp = f * rx * yp / ry;
|
17543 | var cyp = f * -ry * xp / rx;
|
17544 |
|
17545 | var cx = (x1 + x2) / 2.0 + Math.cos(psi) * cxp - Math.sin(psi) * cyp;
|
17546 | var cy = (y1 + y2) / 2.0 + Math.sin(psi) * cxp + Math.cos(psi) * cyp;
|
17547 |
|
17548 | var theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);
|
17549 | var u = [(xp - cxp) / rx, (yp - cyp) / ry];
|
17550 | var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
|
17551 | var dTheta = vAngle(u, v);
|
17552 |
|
17553 | if (vRatio(u, v) <= -1) {
|
17554 | dTheta = Math.PI;
|
17555 | }
|
17556 | if (vRatio(u, v) >= 1) {
|
17557 | dTheta = 0;
|
17558 | }
|
17559 | if (fs === 0 && dTheta > 0) {
|
17560 | dTheta = dTheta - 2 * Math.PI;
|
17561 | }
|
17562 | if (fs === 1 && dTheta < 0) {
|
17563 | dTheta = dTheta + 2 * Math.PI;
|
17564 | }
|
17565 | return [point1, cx, cy, rx, ry, theta, dTheta, psi, fs];
|
17566 | }
|
17567 |
|
17568 | var PathSegment = function PathSegment(item, preSegment, isLast) {
|
17569 | this.preSegment = preSegment;
|
17570 | this.isLast = isLast;
|
17571 | this.init(item, preSegment);
|
17572 | };
|
17573 |
|
17574 | Util.augment(PathSegment, {
|
17575 | init: function init(item, preSegment) {
|
17576 | var command = item[0];
|
17577 | preSegment = preSegment || {
|
17578 | endPoint: {
|
17579 | x: 0,
|
17580 | y: 0
|
17581 | }
|
17582 | };
|
17583 | var relative = ARR_CMD.indexOf(command) >= 0;
|
17584 | var cmd = relative ? command.toUpperCase() : command;
|
17585 | var p = item;
|
17586 | var point1 = void 0;
|
17587 | var point2 = void 0;
|
17588 | var point3 = void 0;
|
17589 | var point = void 0;
|
17590 | var preEndPoint = preSegment.endPoint;
|
17591 |
|
17592 | var p1 = p[1];
|
17593 | var p2 = p[2];
|
17594 | switch (cmd) {
|
17595 | default:
|
17596 | break;
|
17597 | case 'M':
|
17598 | if (relative) {
|
17599 | point = toAbsolute(p1, p2, preEndPoint);
|
17600 | } else {
|
17601 | point = {
|
17602 | x: p1,
|
17603 | y: p2
|
17604 | };
|
17605 | }
|
17606 | this.command = 'M';
|
17607 | this.params = [preEndPoint, point];
|
17608 | this.subStart = point;
|
17609 | this.endPoint = point;
|
17610 | break;
|
17611 | case 'L':
|
17612 | if (relative) {
|
17613 | point = toAbsolute(p1, p2, preEndPoint);
|
17614 | } else {
|
17615 | point = {
|
17616 | x: p1,
|
17617 | y: p2
|
17618 | };
|
17619 | }
|
17620 | this.command = 'L';
|
17621 | this.params = [preEndPoint, point];
|
17622 | this.subStart = preSegment.subStart;
|
17623 | this.endPoint = point;
|
17624 | if (this.isLast) {
|
17625 | this.endTangent = function () {
|
17626 | return [point.x - preEndPoint.x, point.y - preEndPoint.y];
|
17627 | };
|
17628 | }
|
17629 | break;
|
17630 | case 'H':
|
17631 | if (relative) {
|
17632 | point = toAbsolute(p1, 0, preEndPoint);
|
17633 | } else {
|
17634 | point = {
|
17635 | x: p1,
|
17636 | y: preEndPoint.y
|
17637 | };
|
17638 | }
|
17639 | this.command = 'L';
|
17640 | this.params = [preEndPoint, point];
|
17641 | this.subStart = preSegment.subStart;
|
17642 | this.endPoint = point;
|
17643 | this.endTangent = function () {
|
17644 | return [point.x - preEndPoint.x, point.y - preEndPoint.y];
|
17645 | };
|
17646 | break;
|
17647 | case 'V':
|
17648 | if (relative) {
|
17649 | point = toAbsolute(0, p1, preEndPoint);
|
17650 | } else {
|
17651 | point = {
|
17652 | x: preEndPoint.x,
|
17653 | y: p1
|
17654 | };
|
17655 | }
|
17656 | this.command = 'L';
|
17657 | this.params = [preEndPoint, point];
|
17658 | this.subStart = preSegment.subStart;
|
17659 | this.endPoint = point;
|
17660 | this.endTangent = function () {
|
17661 | return [point.x - preEndPoint.x, point.y - preEndPoint.y];
|
17662 | };
|
17663 | break;
|
17664 | case 'Q':
|
17665 | if (relative) {
|
17666 | point1 = toAbsolute(p1, p2, preEndPoint);
|
17667 | point2 = toAbsolute(p[3], p[4], preEndPoint);
|
17668 | } else {
|
17669 | point1 = {
|
17670 | x: p1,
|
17671 | y: p2
|
17672 | };
|
17673 | point2 = {
|
17674 | x: p[3],
|
17675 | y: p[4]
|
17676 | };
|
17677 | }
|
17678 | this.command = 'Q';
|
17679 | this.params = [preEndPoint, point1, point2];
|
17680 | this.subStart = preSegment.subStart;
|
17681 | this.endPoint = point2;
|
17682 | this.endTangent = function () {
|
17683 | return [point2.x - point1.x, point2.y - point1.y];
|
17684 | };
|
17685 | break;
|
17686 | case 'T':
|
17687 | if (relative) {
|
17688 | point2 = toAbsolute(p1, p2, preEndPoint);
|
17689 | } else {
|
17690 | point2 = {
|
17691 | x: p1,
|
17692 | y: p2
|
17693 | };
|
17694 | }
|
17695 | if (preSegment.command === 'Q') {
|
17696 | point1 = toSymmetry(preSegment.params[1], preEndPoint);
|
17697 | this.command = 'Q';
|
17698 | this.params = [preEndPoint, point1, point2];
|
17699 | this.subStart = preSegment.subStart;
|
17700 | this.endPoint = point2;
|
17701 | this.endTangent = function () {
|
17702 | return [point2.x - point1.x, point2.y - point1.y];
|
17703 | };
|
17704 | } else {
|
17705 | this.command = 'TL';
|
17706 | this.params = [preEndPoint, point2];
|
17707 | this.subStart = preSegment.subStart;
|
17708 | this.endPoint = point2;
|
17709 | this.endTangent = function () {
|
17710 | return [point2.x - preEndPoint.x, point2.y - preEndPoint.y];
|
17711 | };
|
17712 | }
|
17713 |
|
17714 | break;
|
17715 | case 'C':
|
17716 | if (relative) {
|
17717 | point1 = toAbsolute(p1, p2, preEndPoint);
|
17718 | point2 = toAbsolute(p[3], p[4], preEndPoint);
|
17719 | point3 = toAbsolute(p[5], p[6], preEndPoint);
|
17720 | } else {
|
17721 | point1 = {
|
17722 | x: p1,
|
17723 | y: p2
|
17724 | };
|
17725 | point2 = {
|
17726 | x: p[3],
|
17727 | y: p[4]
|
17728 | };
|
17729 | point3 = {
|
17730 | x: p[5],
|
17731 | y: p[6]
|
17732 | };
|
17733 | }
|
17734 | this.command = 'C';
|
17735 | this.params = [preEndPoint, point1, point2, point3];
|
17736 | this.subStart = preSegment.subStart;
|
17737 | this.endPoint = point3;
|
17738 | this.endTangent = function () {
|
17739 | return [point3.x - point2.x, point3.y - point2.y];
|
17740 | };
|
17741 | break;
|
17742 | case 'S':
|
17743 | if (relative) {
|
17744 | point2 = toAbsolute(p1, p2, preEndPoint);
|
17745 | point3 = toAbsolute(p[3], p[4], preEndPoint);
|
17746 | } else {
|
17747 | point2 = {
|
17748 | x: p1,
|
17749 | y: p2
|
17750 | };
|
17751 | point3 = {
|
17752 | x: p[3],
|
17753 | y: p[4]
|
17754 | };
|
17755 | }
|
17756 | if (preSegment.command === 'C') {
|
17757 | point1 = toSymmetry(preSegment.params[2], preEndPoint);
|
17758 | this.command = 'C';
|
17759 | this.params = [preEndPoint, point1, point2, point3];
|
17760 | this.subStart = preSegment.subStart;
|
17761 | this.endPoint = point3;
|
17762 | this.endTangent = function () {
|
17763 | return [point3.x - point2.x, point3.y - point2.y];
|
17764 | };
|
17765 | } else {
|
17766 | this.command = 'SQ';
|
17767 | this.params = [preEndPoint, point2, point3];
|
17768 | this.subStart = preSegment.subStart;
|
17769 | this.endPoint = point3;
|
17770 | this.endTangent = function () {
|
17771 | return [point3.x - point2.x, point3.y - point2.y];
|
17772 | };
|
17773 | }
|
17774 | break;
|
17775 | case 'A':
|
17776 | {
|
17777 | var rx = p1;
|
17778 | var ry = p2;
|
17779 | var psi = p[3];
|
17780 | var fa = p[4];
|
17781 | var fs = p[5];
|
17782 | if (relative) {
|
17783 | point = toAbsolute(p[6], p[7], preEndPoint);
|
17784 | } else {
|
17785 | point = {
|
17786 | x: p[6],
|
17787 | y: p[7]
|
17788 | };
|
17789 | }
|
17790 |
|
17791 | this.command = 'A';
|
17792 | this.params = getArcParams(preEndPoint, point, fa, fs, rx, ry, psi);
|
17793 | this.subStart = preSegment.subStart;
|
17794 | this.endPoint = point;
|
17795 | break;
|
17796 | }
|
17797 | case 'Z':
|
17798 | {
|
17799 | this.command = 'Z';
|
17800 | this.params = [preEndPoint, preSegment.subStart];
|
17801 | this.subStart = preSegment.subStart;
|
17802 | this.endPoint = preSegment.subStart;
|
17803 | }
|
17804 | }
|
17805 | },
|
17806 | isInside: function isInside(x, y, lineWidth) {
|
17807 | var self = this;
|
17808 | var command = self.command;
|
17809 | var params = self.params;
|
17810 | var box = self.box;
|
17811 | if (box) {
|
17812 | if (!Inside.box(box.minX, box.maxX, box.minY, box.maxY, x, y)) {
|
17813 | return false;
|
17814 | }
|
17815 | }
|
17816 | switch (command) {
|
17817 | default:
|
17818 | break;
|
17819 | case 'M':
|
17820 | return false;
|
17821 | case 'TL':
|
17822 | case 'L':
|
17823 | case 'Z':
|
17824 | return Inside.line(params[0].x, params[0].y, params[1].x, params[1].y, lineWidth, x, y);
|
17825 | case 'SQ':
|
17826 | case 'Q':
|
17827 | return Inside.quadraticline(params[0].x, params[0].y, params[1].x, params[1].y, params[2].x, params[2].y, lineWidth, x, y);
|
17828 | case 'C':
|
17829 | {
|
17830 | return Inside.cubicline(params[0].x, params[0].y, params[1].x, params[1].y, params[2].x, params[2].y, params[3].x, params[3].y, lineWidth, x, y);
|
17831 | }
|
17832 | case 'A':
|
17833 | {
|
17834 | var p = params;
|
17835 | var cx = p[1];
|
17836 | var cy = p[2];
|
17837 | var rx = p[3];
|
17838 | var ry = p[4];
|
17839 | var theta = p[5];
|
17840 | var dTheta = p[6];
|
17841 | var psi = p[7];
|
17842 | var fs = p[8];
|
17843 |
|
17844 | var r = rx > ry ? rx : ry;
|
17845 | var scaleX = rx > ry ? 1 : rx / ry;
|
17846 | var scaleY = rx > ry ? ry / rx : 1;
|
17847 |
|
17848 | p = [x, y, 1];
|
17849 | var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
17850 | mat3.translate(m, m, [-cx, -cy]);
|
17851 | mat3.rotate(m, m, -psi);
|
17852 | mat3.scale(m, m, [1 / scaleX, 1 / scaleY]);
|
17853 | vec3.transformMat3(p, p, m);
|
17854 | return Inside.arcline(0, 0, r, theta, theta + dTheta, 1 - fs, lineWidth, p[0], p[1]);
|
17855 | }
|
17856 | }
|
17857 | return false;
|
17858 | },
|
17859 | draw: function draw(context) {
|
17860 | var command = this.command;
|
17861 | var params = this.params;
|
17862 | var point1 = void 0;
|
17863 | var point2 = void 0;
|
17864 | var point3 = void 0;
|
17865 |
|
17866 | switch (command) {
|
17867 | default:
|
17868 | break;
|
17869 | case 'M':
|
17870 | context.moveTo(params[1].x, params[1].y);
|
17871 | break;
|
17872 | case 'TL':
|
17873 | case 'L':
|
17874 | context.lineTo(params[1].x, params[1].y);
|
17875 | break;
|
17876 | case 'SQ':
|
17877 | case 'Q':
|
17878 | point1 = params[1];
|
17879 | point2 = params[2];
|
17880 | context.quadraticCurveTo(point1.x, point1.y, point2.x, point2.y);
|
17881 | break;
|
17882 | case 'C':
|
17883 | point1 = params[1];
|
17884 | point2 = params[2];
|
17885 | point3 = params[3];
|
17886 | context.bezierCurveTo(point1.x, point1.y, point2.x, point2.y, point3.x, point3.y);
|
17887 | break;
|
17888 | case 'A':
|
17889 | {
|
17890 | var p = params;
|
17891 | var p1 = p[1];
|
17892 | var p2 = p[2];
|
17893 | var cx = p1;
|
17894 | var cy = p2;
|
17895 | var rx = p[3];
|
17896 | var ry = p[4];
|
17897 | var theta = p[5];
|
17898 | var dTheta = p[6];
|
17899 | var psi = p[7];
|
17900 | var fs = p[8];
|
17901 |
|
17902 | var r = rx > ry ? rx : ry;
|
17903 | var scaleX = rx > ry ? 1 : rx / ry;
|
17904 | var scaleY = rx > ry ? ry / rx : 1;
|
17905 |
|
17906 | context.translate(cx, cy);
|
17907 | context.rotate(psi);
|
17908 | context.scale(scaleX, scaleY);
|
17909 | context.arc(0, 0, r, theta, theta + dTheta, 1 - fs);
|
17910 | context.scale(1 / scaleX, 1 / scaleY);
|
17911 | context.rotate(-psi);
|
17912 | context.translate(-cx, -cy);
|
17913 | break;
|
17914 | }
|
17915 | case 'Z':
|
17916 | context.closePath();
|
17917 | break;
|
17918 | }
|
17919 | },
|
17920 | getBBox: function getBBox(lineWidth) {
|
17921 | var halfWidth = lineWidth / 2;
|
17922 | var params = this.params;
|
17923 | var yDims = void 0;
|
17924 | var xDims = void 0;
|
17925 | var i = void 0;
|
17926 | var l = void 0;
|
17927 |
|
17928 | switch (this.command) {
|
17929 | default:
|
17930 | case 'M':
|
17931 | case 'Z':
|
17932 | break;
|
17933 | case 'TL':
|
17934 | case 'L':
|
17935 | this.box = {
|
17936 | minX: Math.min(params[0].x, params[1].x) - halfWidth,
|
17937 | maxX: Math.max(params[0].x, params[1].x) + halfWidth,
|
17938 | minY: Math.min(params[0].y, params[1].y) - halfWidth,
|
17939 | maxY: Math.max(params[0].y, params[1].y) + halfWidth
|
17940 | };
|
17941 | break;
|
17942 | case 'SQ':
|
17943 | case 'Q':
|
17944 | xDims = Quadratic.extrema(params[0].x, params[1].x, params[2].x);
|
17945 | for (i = 0, l = xDims.length; i < l; i++) {
|
17946 | xDims[i] = Quadratic.at(params[0].x, params[1].x, params[2].x, xDims[i]);
|
17947 | }
|
17948 | xDims.push(params[0].x, params[2].x);
|
17949 | yDims = Quadratic.extrema(params[0].y, params[1].y, params[2].y);
|
17950 | for (i = 0, l = yDims.length; i < l; i++) {
|
17951 | yDims[i] = Quadratic.at(params[0].y, params[1].y, params[2].y, yDims);
|
17952 | }
|
17953 | yDims.push(params[0].y, params[2].y);
|
17954 | this.box = {
|
17955 | minX: Math.min.apply(Math, xDims) - halfWidth,
|
17956 | maxX: Math.max.apply(Math, xDims) + halfWidth,
|
17957 | minY: Math.min.apply(Math, yDims) - halfWidth,
|
17958 | maxY: Math.max.apply(Math, yDims) + halfWidth
|
17959 | };
|
17960 | break;
|
17961 | case 'C':
|
17962 | xDims = Cubic.extrema(params[0].x, params[1].x, params[2].x, params[3].x);
|
17963 | for (i = 0, l = xDims.length; i < l; i++) {
|
17964 | xDims[i] = Cubic.at(params[0].x, params[1].x, params[2].x, params[3].x, xDims[i]);
|
17965 | }
|
17966 | yDims = Cubic.extrema(params[0].y, params[1].y, params[2].y, params[3].y);
|
17967 | for (i = 0, l = yDims.length; i < l; i++) {
|
17968 | yDims[i] = Cubic.at(params[0].y, params[1].y, params[2].y, params[3].y, yDims[i]);
|
17969 | }
|
17970 | xDims.push(params[0].x, params[3].x);
|
17971 | yDims.push(params[0].y, params[3].y);
|
17972 | this.box = {
|
17973 | minX: Math.min.apply(Math, xDims) - halfWidth,
|
17974 | maxX: Math.max.apply(Math, xDims) + halfWidth,
|
17975 | minY: Math.min.apply(Math, yDims) - halfWidth,
|
17976 | maxY: Math.max.apply(Math, yDims) + halfWidth
|
17977 | };
|
17978 | break;
|
17979 | case 'A':
|
17980 | {
|
17981 |
|
17982 | var p = params;
|
17983 | var cx = p[1];
|
17984 | var cy = p[2];
|
17985 | var rx = p[3];
|
17986 | var ry = p[4];
|
17987 | var theta = p[5];
|
17988 | var dTheta = p[6];
|
17989 | var psi = p[7];
|
17990 | var fs = p[8];
|
17991 | var start = theta;
|
17992 | var end = theta + dTheta;
|
17993 |
|
17994 | var xDim = Ellipse.xExtrema(psi, rx, ry);
|
17995 | var minX = Infinity;
|
17996 | var maxX = -Infinity;
|
17997 | var xs = [start, end];
|
17998 | for (i = -Math.PI * 2; i <= Math.PI * 2; i += Math.PI) {
|
17999 | var xAngle = xDim + i;
|
18000 | if (fs === 1) {
|
18001 | if (start < xAngle && xAngle < end) {
|
18002 | xs.push(xAngle);
|
18003 | }
|
18004 | } else {
|
18005 | if (end < xAngle && xAngle < start) {
|
18006 | xs.push(xAngle);
|
18007 | }
|
18008 | }
|
18009 | }
|
18010 |
|
18011 | for (i = 0, l = xs.length; i < l; i++) {
|
18012 | var x = Ellipse.xAt(psi, rx, ry, cx, xs[i]);
|
18013 | if (x < minX) {
|
18014 | minX = x;
|
18015 | }
|
18016 | if (x > maxX) {
|
18017 | maxX = x;
|
18018 | }
|
18019 | }
|
18020 |
|
18021 | var yDim = Ellipse.yExtrema(psi, rx, ry);
|
18022 | var minY = Infinity;
|
18023 | var maxY = -Infinity;
|
18024 | var ys = [start, end];
|
18025 | for (i = -Math.PI * 2; i <= Math.PI * 2; i += Math.PI) {
|
18026 | var yAngle = yDim + i;
|
18027 | if (fs === 1) {
|
18028 | if (start < yAngle && yAngle < end) {
|
18029 | ys.push(yAngle);
|
18030 | }
|
18031 | } else {
|
18032 | if (end < yAngle && yAngle < start) {
|
18033 | ys.push(yAngle);
|
18034 | }
|
18035 | }
|
18036 | }
|
18037 |
|
18038 | for (i = 0, l = ys.length; i < l; i++) {
|
18039 | var y = Ellipse.yAt(psi, rx, ry, cy, ys[i]);
|
18040 | if (y < minY) {
|
18041 | minY = y;
|
18042 | }
|
18043 | if (y > maxY) {
|
18044 | maxY = y;
|
18045 | }
|
18046 | }
|
18047 | this.box = {
|
18048 | minX: minX - halfWidth,
|
18049 | maxX: maxX + halfWidth,
|
18050 | minY: minY - halfWidth,
|
18051 | maxY: maxY + halfWidth
|
18052 | };
|
18053 | break;
|
18054 | }
|
18055 | }
|
18056 | }
|
18057 | });
|
18058 |
|
18059 | module.exports = PathSegment;
|
18060 |
|
18061 |
|
18062 | },
|
18063 |
|
18064 | function (module, exports) {
|
18065 |
|
18066 | module.exports = {
|
18067 | xAt: function xAt(psi, rx, ry, cx, t) {
|
18068 | return rx * Math.cos(psi) * Math.cos(t) - ry * Math.sin(psi) * Math.sin(t) + cx;
|
18069 | },
|
18070 | yAt: function yAt(psi, rx, ry, cy, t) {
|
18071 | return rx * Math.sin(psi) * Math.cos(t) + ry * Math.cos(psi) * Math.sin(t) + cy;
|
18072 | },
|
18073 | xExtrema: function xExtrema(psi, rx, ry) {
|
18074 | return Math.atan(-ry / rx * Math.tan(psi));
|
18075 | },
|
18076 | yExtrema: function yExtrema(psi, rx, ry) {
|
18077 | return Math.atan(ry / (rx * Math.tan(psi)));
|
18078 | }
|
18079 | };
|
18080 |
|
18081 |
|
18082 | }]
|
18083 | )
|
18084 | );
|
18085 | });
|
18086 | }.call(exports, __webpack_require__(26)(module)))
|
18087 |
|
18088 | }),
|
18089 |
|
18090 | (function(module, exports) {
|
18091 |
|
18092 |
|
18093 |
|
18094 |
|
18095 |
|
18096 |
|
18097 |
|
18098 |
|
18099 |
|
18100 |
|
18101 |
|
18102 |
|
18103 |
|
18104 |
|
18105 |
|
18106 |
|
18107 |
|
18108 |
|
18109 |
|
18110 |
|
18111 |
|
18112 |
|
18113 |
|
18114 |
|
18115 | var isArray = Array.isArray;
|
18116 |
|
18117 | module.exports = isArray;
|
18118 |
|
18119 | }),
|
18120 |
|
18121 | (function(module, exports, __webpack_require__) {
|
18122 |
|
18123 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
18124 |
|
18125 | var freeGlobal = __webpack_require__(71);
|
18126 |
|
18127 |
|
18128 | var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self;
|
18129 |
|
18130 |
|
18131 | var root = freeGlobal || freeSelf || Function('return this')();
|
18132 |
|
18133 | module.exports = root;
|
18134 |
|
18135 | }),
|
18136 |
|
18137 | (function(module, exports) {
|
18138 |
|
18139 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
18140 |
|
18141 |
|
18142 |
|
18143 |
|
18144 |
|
18145 |
|
18146 |
|
18147 |
|
18148 |
|
18149 |
|
18150 |
|
18151 |
|
18152 |
|
18153 |
|
18154 |
|
18155 |
|
18156 |
|
18157 |
|
18158 |
|
18159 |
|
18160 |
|
18161 |
|
18162 |
|
18163 |
|
18164 |
|
18165 | function isObjectLike(value) {
|
18166 | return value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object';
|
18167 | }
|
18168 |
|
18169 | module.exports = isObjectLike;
|
18170 |
|
18171 | }),
|
18172 |
|
18173 | (function(module, exports, __webpack_require__) {
|
18174 |
|
18175 | var _Symbol = __webpack_require__(12),
|
18176 | getRawTag = __webpack_require__(135),
|
18177 | objectToString = __webpack_require__(136);
|
18178 |
|
18179 |
|
18180 | var nullTag = '[object Null]',
|
18181 | undefinedTag = '[object Undefined]';
|
18182 |
|
18183 |
|
18184 | var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
18185 |
|
18186 |
|
18187 |
|
18188 |
|
18189 |
|
18190 |
|
18191 |
|
18192 |
|
18193 | function baseGetTag(value) {
|
18194 | if (value == null) {
|
18195 | return value === undefined ? undefinedTag : nullTag;
|
18196 | }
|
18197 | return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
18198 | }
|
18199 |
|
18200 | module.exports = baseGetTag;
|
18201 |
|
18202 | }),
|
18203 |
|
18204 | (function(module, exports) {
|
18205 |
|
18206 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
18207 |
|
18208 |
|
18209 |
|
18210 |
|
18211 |
|
18212 |
|
18213 |
|
18214 |
|
18215 |
|
18216 |
|
18217 |
|
18218 |
|
18219 |
|
18220 |
|
18221 |
|
18222 |
|
18223 |
|
18224 |
|
18225 |
|
18226 |
|
18227 |
|
18228 |
|
18229 |
|
18230 |
|
18231 |
|
18232 |
|
18233 | function isObject(value) {
|
18234 | var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
18235 | return value != null && (type == 'object' || type == 'function');
|
18236 | }
|
18237 |
|
18238 | module.exports = isObject;
|
18239 |
|
18240 | }),
|
18241 |
|
18242 | (function(module, exports, __webpack_require__) {
|
18243 |
|
18244 | var isFunction = __webpack_require__(48),
|
18245 | isLength = __webpack_require__(47);
|
18246 |
|
18247 |
|
18248 |
|
18249 |
|
18250 |
|
18251 |
|
18252 |
|
18253 |
|
18254 |
|
18255 |
|
18256 |
|
18257 |
|
18258 |
|
18259 |
|
18260 |
|
18261 |
|
18262 |
|
18263 |
|
18264 |
|
18265 |
|
18266 |
|
18267 |
|
18268 |
|
18269 |
|
18270 |
|
18271 |
|
18272 | function isArrayLike(value) {
|
18273 | return value != null && isLength(value.length) && !isFunction(value);
|
18274 | }
|
18275 |
|
18276 | module.exports = isArrayLike;
|
18277 |
|
18278 | }),
|
18279 |
|
18280 | (function(module, exports, __webpack_require__) {
|
18281 |
|
18282 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
18283 |
|
18284 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
18285 |
|
18286 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
18287 |
|
18288 |
|
18289 |
|
18290 |
|
18291 |
|
18292 |
|
18293 | var Base = __webpack_require__(63);
|
18294 | var Attr = __webpack_require__(286);
|
18295 | var Util = __webpack_require__(0);
|
18296 | var Global = __webpack_require__(1);
|
18297 | var Adjust = __webpack_require__(294);
|
18298 | var Labels = __webpack_require__(299);
|
18299 | var Shape = __webpack_require__(66);
|
18300 | var TooltipMixin = __webpack_require__(310);
|
18301 | var ActiveMixin = __webpack_require__(311);
|
18302 | var SelectMixin = __webpack_require__(312);
|
18303 | var GROUP_ATTRS = ['color', 'shape', 'size'];
|
18304 | var FIELD_ORIGIN = '_origin';
|
18305 |
|
18306 | function parseFields(field) {
|
18307 | if (Util.isArray(field)) {
|
18308 | return field;
|
18309 | }
|
18310 | if (Util.isString(field)) {
|
18311 | return field.split('*');
|
18312 | }
|
18313 | return [field];
|
18314 | }
|
18315 |
|
18316 |
|
18317 | function parseAdjusts(adjusts) {
|
18318 | if (Util.isString(adjusts)) {
|
18319 | adjusts = [adjusts];
|
18320 | }
|
18321 | Util.each(adjusts, function (adjust, index) {
|
18322 | if (!Util.isObject(adjust)) {
|
18323 | adjusts[index] = { type: adjust };
|
18324 | }
|
18325 | });
|
18326 | return adjusts;
|
18327 | }
|
18328 |
|
18329 |
|
18330 |
|
18331 |
|
18332 |
|
18333 |
|
18334 | var GeomBase = function (_Base) {
|
18335 | _inherits(GeomBase, _Base);
|
18336 |
|
18337 | |
18338 |
|
18339 |
|
18340 |
|
18341 |
|
18342 | GeomBase.prototype.getDefaultCfg = function getDefaultCfg() {
|
18343 | return {
|
18344 | |
18345 |
|
18346 |
|
18347 |
|
18348 | _id: null,
|
18349 | |
18350 |
|
18351 |
|
18352 |
|
18353 | type: 'base',
|
18354 |
|
18355 | |
18356 |
|
18357 |
|
18358 |
|
18359 | coord: null,
|
18360 |
|
18361 | |
18362 |
|
18363 |
|
18364 |
|
18365 |
|
18366 | attrs: {},
|
18367 |
|
18368 | |
18369 |
|
18370 |
|
18371 |
|
18372 | view: null,
|
18373 |
|
18374 | |
18375 |
|
18376 |
|
18377 |
|
18378 | data: [],
|
18379 |
|
18380 | |
18381 |
|
18382 |
|
18383 |
|
18384 | scales: {},
|
18385 |
|
18386 | |
18387 |
|
18388 |
|
18389 |
|
18390 | container: null,
|
18391 |
|
18392 | |
18393 |
|
18394 |
|
18395 |
|
18396 | labelContainer: null,
|
18397 |
|
18398 | |
18399 |
|
18400 |
|
18401 |
|
18402 | shapeContainer: null,
|
18403 |
|
18404 | |
18405 |
|
18406 |
|
18407 |
|
18408 | attrOptions: {},
|
18409 | styleOptions: null,
|
18410 | selectedOptions: null,
|
18411 | |
18412 |
|
18413 |
|
18414 |
|
18415 | hasDefaultAdjust: false,
|
18416 | adjusts: null,
|
18417 | |
18418 |
|
18419 |
|
18420 |
|
18421 |
|
18422 | shapeType: null,
|
18423 | |
18424 |
|
18425 |
|
18426 |
|
18427 |
|
18428 | generatePoints: false,
|
18429 |
|
18430 | |
18431 |
|
18432 |
|
18433 |
|
18434 | sortable: false,
|
18435 |
|
18436 | labelCfg: null,
|
18437 | |
18438 |
|
18439 |
|
18440 |
|
18441 | shareTooltip: true,
|
18442 | tooltipCfg: null,
|
18443 | |
18444 |
|
18445 |
|
18446 |
|
18447 | animate: true,
|
18448 | |
18449 |
|
18450 |
|
18451 |
|
18452 | animateCfg: null
|
18453 | };
|
18454 | };
|
18455 |
|
18456 | function GeomBase(cfg) {
|
18457 | _classCallCheck(this, GeomBase);
|
18458 |
|
18459 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
18460 |
|
18461 | Util.assign(_this, TooltipMixin, ActiveMixin, SelectMixin);
|
18462 | if (_this.get('container')) {
|
18463 | _this._initContainer();
|
18464 | }
|
18465 | _this._initOptions();
|
18466 | return _this;
|
18467 | }
|
18468 |
|
18469 |
|
18470 |
|
18471 |
|
18472 | GeomBase.prototype._initOptions = function _initOptions() {
|
18473 | var adjusts = this.get('adjusts');
|
18474 | if (adjusts) {
|
18475 | adjusts = parseAdjusts(adjusts);
|
18476 | this.set('adjusts', adjusts);
|
18477 | }
|
18478 | };
|
18479 |
|
18480 | GeomBase.prototype._createScale = function _createScale(field) {
|
18481 | var scales = this.get('scales');
|
18482 | var scale = scales[field];
|
18483 | if (!scale) {
|
18484 | scale = this.get('view').createScale(field);
|
18485 | scales[field] = scale;
|
18486 | }
|
18487 | return scale;
|
18488 | };
|
18489 |
|
18490 | GeomBase.prototype._setAttrOptions = function _setAttrOptions(attrName, attrCfg) {
|
18491 | var options = this.get('attrOptions');
|
18492 | options[attrName] = attrCfg;
|
18493 | };
|
18494 |
|
18495 | GeomBase.prototype._createAttrOption = function _createAttrOption(attrName, field, cfg, defaultValues) {
|
18496 | var attrCfg = {};
|
18497 | attrCfg.field = field;
|
18498 | if (cfg) {
|
18499 | if (Util.isFunction(cfg)) {
|
18500 | attrCfg.callback = cfg;
|
18501 | } else {
|
18502 | attrCfg.values = cfg;
|
18503 | }
|
18504 | } else if (attrName !== 'color') {
|
18505 | attrCfg.values = defaultValues;
|
18506 | }
|
18507 | this._setAttrOptions(attrName, attrCfg);
|
18508 | };
|
18509 |
|
18510 | |
18511 |
|
18512 |
|
18513 |
|
18514 |
|
18515 |
|
18516 |
|
18517 |
|
18518 | GeomBase.prototype.position = function position(field) {
|
18519 | this._setAttrOptions('position', {
|
18520 | field: field
|
18521 | });
|
18522 | return this;
|
18523 | };
|
18524 |
|
18525 | |
18526 |
|
18527 |
|
18528 |
|
18529 |
|
18530 |
|
18531 |
|
18532 |
|
18533 |
|
18534 | GeomBase.prototype.color = function color(field, values) {
|
18535 | this._createAttrOption('color', field, values, Global.colors);
|
18536 | return this;
|
18537 | };
|
18538 |
|
18539 | |
18540 |
|
18541 |
|
18542 |
|
18543 |
|
18544 |
|
18545 |
|
18546 |
|
18547 |
|
18548 | GeomBase.prototype.size = function size(field, values) {
|
18549 | this._createAttrOption('size', field, values, Global.sizes);
|
18550 | return this;
|
18551 | };
|
18552 |
|
18553 | |
18554 |
|
18555 |
|
18556 |
|
18557 |
|
18558 |
|
18559 |
|
18560 |
|
18561 |
|
18562 | GeomBase.prototype.shape = function shape(field, values) {
|
18563 | var type = this.get('type');
|
18564 | var shapes = Global.shapes[type] || [];
|
18565 | this._createAttrOption('shape', field, values, shapes);
|
18566 | return this;
|
18567 | };
|
18568 |
|
18569 | |
18570 |
|
18571 |
|
18572 |
|
18573 |
|
18574 |
|
18575 |
|
18576 |
|
18577 |
|
18578 | GeomBase.prototype.opacity = function opacity(field, values) {
|
18579 | this._createAttrOption('opacity', field, values, Global.opacities);
|
18580 | return this;
|
18581 | };
|
18582 |
|
18583 | GeomBase.prototype.style = function style(field, cfg) {
|
18584 | var styleOptions = this.get('styleOptions');
|
18585 | if (!styleOptions) {
|
18586 | styleOptions = {};
|
18587 | this.set('styleOptions', styleOptions);
|
18588 | }
|
18589 | if (Util.isObject(field)) {
|
18590 | cfg = field;
|
18591 | field = null;
|
18592 | }
|
18593 | var fields = void 0;
|
18594 | if (field) {
|
18595 | fields = parseFields(field);
|
18596 | }
|
18597 | styleOptions.fields = fields;
|
18598 | styleOptions.style = cfg;
|
18599 | return this;
|
18600 | };
|
18601 |
|
18602 | GeomBase.prototype.label = function label(field, callback, cfg) {
|
18603 | var self = this;
|
18604 | var labelCfg = self.get('labelCfg');
|
18605 |
|
18606 | if (!labelCfg) {
|
18607 | labelCfg = {};
|
18608 | self.set('labelCfg', labelCfg);
|
18609 | }
|
18610 | var fields = void 0;
|
18611 | if (field) {
|
18612 | fields = parseFields(field);
|
18613 | }
|
18614 | labelCfg.fields = fields;
|
18615 |
|
18616 | if (Util.isFunction(callback)) {
|
18617 | if (!cfg) {
|
18618 | cfg = {};
|
18619 | }
|
18620 | cfg.content = callback;
|
18621 | } else if (Util.isObject(callback)) {
|
18622 |
|
18623 | cfg = callback;
|
18624 | }
|
18625 |
|
18626 | labelCfg.cfg = cfg;
|
18627 |
|
18628 | return this;
|
18629 | };
|
18630 |
|
18631 | GeomBase.prototype.tooltip = function tooltip(field, cfg) {
|
18632 | var tooltipCfg = this.get('tooltipCfg');
|
18633 | if (!tooltipCfg) {
|
18634 | tooltipCfg = {};
|
18635 | }
|
18636 | if (field === false) {
|
18637 |
|
18638 | this.set('tooltipCfg', false);
|
18639 | } else {
|
18640 | var tooltipFields = void 0;
|
18641 | if (field) {
|
18642 | tooltipFields = parseFields(field);
|
18643 | }
|
18644 | tooltipCfg.fields = tooltipFields;
|
18645 | tooltipCfg.cfg = cfg;
|
18646 | }
|
18647 |
|
18648 | this.set('tooltipCfg', tooltipCfg);
|
18649 | return this;
|
18650 | };
|
18651 |
|
18652 | GeomBase.prototype.animate = function animate(cfg) {
|
18653 | this.set('animateCfg', cfg);
|
18654 | return this;
|
18655 | };
|
18656 |
|
18657 | |
18658 |
|
18659 |
|
18660 |
|
18661 |
|
18662 |
|
18663 |
|
18664 | GeomBase.prototype.active = function active(enable) {
|
18665 | this.set('allowActive', enable);
|
18666 | return this;
|
18667 | };
|
18668 |
|
18669 | |
18670 |
|
18671 |
|
18672 |
|
18673 |
|
18674 |
|
18675 |
|
18676 |
|
18677 | GeomBase.prototype.adjust = function adjust(adjusts) {
|
18678 | if (!this.get('hasDefaultAdjust')) {
|
18679 | if (adjusts) {
|
18680 | adjusts = parseAdjusts(adjusts);
|
18681 | }
|
18682 | this.set('adjusts', adjusts);
|
18683 | }
|
18684 | return this;
|
18685 | };
|
18686 |
|
18687 | |
18688 |
|
18689 |
|
18690 |
|
18691 |
|
18692 |
|
18693 |
|
18694 |
|
18695 | GeomBase.prototype.select = function select(enable, cfg) {
|
18696 | if (enable === false) {
|
18697 | this.set('allowSelect', false);
|
18698 | } else if (Util.isObject(enable)) {
|
18699 | this.set('allowSelect', true);
|
18700 | this.set('selectedOptions', enable);
|
18701 | } else {
|
18702 | this.set('allowSelect', true);
|
18703 | this.set('selectedOptions', cfg);
|
18704 | }
|
18705 |
|
18706 | return this;
|
18707 | };
|
18708 |
|
18709 | GeomBase.prototype.hasAdjust = function hasAdjust(adjustType) {
|
18710 | var self = this;
|
18711 | var adjusts = self.get('adjusts');
|
18712 | if (!adjustType) {
|
18713 | return false;
|
18714 | }
|
18715 | var rst = false;
|
18716 | Util.each(adjusts, function (adjust) {
|
18717 | if (adjust.type === adjustType) {
|
18718 | rst = true;
|
18719 | return false;
|
18720 | }
|
18721 | });
|
18722 | return rst;
|
18723 | };
|
18724 |
|
18725 | GeomBase.prototype.hasStack = function hasStack() {
|
18726 | var isStacked = this.get('isStacked');
|
18727 | if (Util.isNil(isStacked)) {
|
18728 | isStacked = this.hasAdjust('stack');
|
18729 | this.set('isStacked', isStacked);
|
18730 | }
|
18731 | return isStacked;
|
18732 | };
|
18733 |
|
18734 | GeomBase.prototype.isInCircle = function isInCircle() {
|
18735 | var coord = this.get('coord');
|
18736 | return coord && coord.isPolar;
|
18737 | };
|
18738 |
|
18739 | GeomBase.prototype._initContainer = function _initContainer() {
|
18740 | var self = this;
|
18741 | var shapeContainer = self.get('shapeContainer');
|
18742 | if (!shapeContainer) {
|
18743 | var container = self.get('container');
|
18744 | var view = self.get('view');
|
18745 | var viewId = view && view.get('_id');
|
18746 | shapeContainer = container.addGroup({
|
18747 | viewId: viewId
|
18748 | });
|
18749 | self.set('shapeContainer', shapeContainer);
|
18750 | }
|
18751 | };
|
18752 |
|
18753 | GeomBase.prototype.init = function init() {
|
18754 | var self = this;
|
18755 | self._initContainer();
|
18756 | self._initAttrs();
|
18757 | if (self.get('tooltipCfg') && self.get('tooltipCfg').fields) {
|
18758 | var tooltipFields = self.get('tooltipCfg').fields;
|
18759 | Util.each(tooltipFields, function (field) {
|
18760 | self._createScale(field);
|
18761 | });
|
18762 | }
|
18763 | var dataArray = self._processData();
|
18764 | if (self.get('adjusts')) {
|
18765 | self._adjust(dataArray);
|
18766 | }
|
18767 | self.set('dataArray', dataArray);
|
18768 | };
|
18769 |
|
18770 |
|
18771 |
|
18772 |
|
18773 | GeomBase.prototype._initAttrs = function _initAttrs() {
|
18774 | var self = this;
|
18775 | var attrs = this.get('attrs');
|
18776 | var attrOptions = this.get('attrOptions');
|
18777 | var coord = self.get('coord');
|
18778 | var isPie = false;
|
18779 |
|
18780 | for (var type in attrOptions) {
|
18781 | if (attrOptions.hasOwnProperty(type)) {
|
18782 | var option = attrOptions[type];
|
18783 | var className = Util.upperFirst(type);
|
18784 | var fields = parseFields(option.field);
|
18785 | if (type === 'position') {
|
18786 | option.coord = coord;
|
18787 |
|
18788 | if (fields.length === 1 && coord.type === 'theta') {
|
18789 | fields.unshift('1');
|
18790 | isPie = true;
|
18791 | }
|
18792 | }
|
18793 | var scales = [];
|
18794 | for (var i = 0; i < fields.length; i++) {
|
18795 | var field = fields[i];
|
18796 | var scale = self._createScale(field);
|
18797 | if (type === 'color' && Util.isNil(option.values)) {
|
18798 |
|
18799 | if (scale.values.length <= 8) {
|
18800 | option.values = isPie ? Global.colors_pie : Global.colors;
|
18801 | } else if (scale.values.length <= 16) {
|
18802 | option.values = isPie ? Global.colors_pie_16 : Global.colors_16;
|
18803 | } else {
|
18804 | option.values = Global.colors_24;
|
18805 | }
|
18806 |
|
18807 | if (Util.isNil(option.values)) {
|
18808 | option.values = Global.colors;
|
18809 | }
|
18810 | }
|
18811 | scales.push(scale);
|
18812 | }
|
18813 |
|
18814 | if (coord.type === 'theta' && type === 'position' && scales.length > 1) {
|
18815 | var yScale = scales[1];
|
18816 | yScale.change({
|
18817 | nice: false,
|
18818 | min: 0,
|
18819 | max: Math.max.apply(null, yScale.values)
|
18820 | });
|
18821 | }
|
18822 | option.scales = scales;
|
18823 | var attr = new Attr[className](option);
|
18824 | attrs[type] = attr;
|
18825 | }
|
18826 | }
|
18827 | };
|
18828 |
|
18829 |
|
18830 |
|
18831 | GeomBase.prototype._processData = function _processData() {
|
18832 | var self = this;
|
18833 | var data = this.get('data');
|
18834 | var dataArray = [];
|
18835 | var groupedArray = this._groupData(data);
|
18836 | for (var i = 0; i < groupedArray.length; i++) {
|
18837 | var subData = groupedArray[i];
|
18838 | var tempData = self._saveOrigin(subData);
|
18839 | self._numberic(tempData);
|
18840 | dataArray.push(tempData);
|
18841 | }
|
18842 | return dataArray;
|
18843 | };
|
18844 |
|
18845 |
|
18846 |
|
18847 |
|
18848 | GeomBase.prototype._groupData = function _groupData(data) {
|
18849 | var groupScales = this._getGroupScales();
|
18850 | var fields = groupScales.map(function (scale) {
|
18851 | return scale.field;
|
18852 | });
|
18853 |
|
18854 | return Util.Array.group(data, fields);
|
18855 | };
|
18856 |
|
18857 |
|
18858 |
|
18859 |
|
18860 | GeomBase.prototype._saveOrigin = function _saveOrigin(data) {
|
18861 | var rst = [];
|
18862 | for (var i = 0; i < data.length; i++) {
|
18863 | var origin = data[i];
|
18864 | var obj = {};
|
18865 | for (var k in origin) {
|
18866 | obj[k] = origin[k];
|
18867 | }
|
18868 |
|
18869 | obj[FIELD_ORIGIN] = origin;
|
18870 | rst.push(obj);
|
18871 | }
|
18872 | return rst;
|
18873 | };
|
18874 |
|
18875 |
|
18876 |
|
18877 |
|
18878 | GeomBase.prototype._numberic = function _numberic(data) {
|
18879 | var positionAttr = this.getAttr('position');
|
18880 | var scales = positionAttr.scales;
|
18881 | for (var j = 0; j < data.length; j++) {
|
18882 | var obj = data[j];
|
18883 | for (var i = 0; i < Math.min(2, scales.length); i++) {
|
18884 | var scale = scales[i];
|
18885 | if (scale.isCategory) {
|
18886 | var field = scale.field;
|
18887 | obj[field] = scale.translate(obj[field]);
|
18888 | }
|
18889 | }
|
18890 | }
|
18891 | };
|
18892 |
|
18893 | GeomBase.prototype._getGroupScales = function _getGroupScales() {
|
18894 | var self = this;
|
18895 | var scales = self.get('groupScales');
|
18896 | if (!scales) {
|
18897 | scales = [];
|
18898 | var attrs = self.get('attrs');
|
18899 | Util.each(attrs, function (attr) {
|
18900 | if (GROUP_ATTRS.indexOf(attr.type) !== -1) {
|
18901 | var attrScales = attr.scales;
|
18902 | Util.each(attrScales, function (scale) {
|
18903 | if (scale.isCategory && Util.indexOf(scales, scale) === -1) {
|
18904 | scales.push(scale);
|
18905 | }
|
18906 | });
|
18907 | }
|
18908 | });
|
18909 | self.set('groupScales', scales);
|
18910 | }
|
18911 | return scales;
|
18912 | };
|
18913 |
|
18914 | GeomBase.prototype._updateStackRange = function _updateStackRange(field, scale, dataArray) {
|
18915 | var mergeArray = Util.Array.merge(dataArray);
|
18916 | var min = scale.min;
|
18917 | var max = scale.max;
|
18918 | for (var i = 0; i < mergeArray.length; i++) {
|
18919 | var obj = mergeArray[i];
|
18920 | var tmpMin = Math.min.apply(null, obj[field]);
|
18921 | var tmpMax = Math.max.apply(null, obj[field]);
|
18922 | if (tmpMin < min) {
|
18923 | min = tmpMin;
|
18924 | }
|
18925 | if (tmpMax > max) {
|
18926 | max = tmpMax;
|
18927 | }
|
18928 | }
|
18929 | if (min < scale.min || max > scale.max) {
|
18930 | scale.change({
|
18931 | min: min,
|
18932 | max: max
|
18933 | });
|
18934 | }
|
18935 | };
|
18936 |
|
18937 |
|
18938 |
|
18939 |
|
18940 | GeomBase.prototype._adjust = function _adjust(dataArray) {
|
18941 | var self = this;
|
18942 | var adjusts = self.get('adjusts');
|
18943 |
|
18944 | var yScale = self.getYScale();
|
18945 | var xScale = self.getXScale();
|
18946 | var xField = xScale.field;
|
18947 | var yField = yScale ? yScale.field : null;
|
18948 | Util.each(adjusts, function (adjust) {
|
18949 | var adjustCfg = Util.mix({
|
18950 | xField: xField,
|
18951 | yField: yField
|
18952 | }, adjust);
|
18953 | var adjustType = Util.upperFirst(adjust.type);
|
18954 | if (adjustType === 'Dodge') {
|
18955 | var adjustNames = [];
|
18956 | if (xScale.isCategory || xScale.isIdentity) {
|
18957 | adjustNames.push('x');
|
18958 | } else if (!yScale) {
|
18959 | adjustNames.push('y');
|
18960 | } else {
|
18961 | throw new Error('dodge is not support linear attribute, please use category attribute!');
|
18962 | }
|
18963 | adjustCfg.adjustNames = adjustNames;
|
18964 | |
18965 |
|
18966 |
|
18967 |
|
18968 | } else if (adjustType === 'Stack') {
|
18969 | var coord = self.get('coord');
|
18970 | if (!yScale) {
|
18971 |
|
18972 | adjustCfg.height = coord.getHeight();
|
18973 | var size = self.getDefaultValue('size') || 3;
|
18974 | adjustCfg.size = size;
|
18975 | }
|
18976 | if (!coord.isTransposed) {
|
18977 | adjustCfg.reverseOrder = true;
|
18978 | }
|
18979 | }
|
18980 | var adjustElement = new Adjust[adjustType](adjustCfg);
|
18981 | adjustElement.processAdjust(dataArray);
|
18982 | if (adjustType === 'Stack' && yScale) {
|
18983 | self._updateStackRange(yField, yScale, dataArray);
|
18984 | }
|
18985 | });
|
18986 | };
|
18987 |
|
18988 | |
18989 |
|
18990 |
|
18991 |
|
18992 |
|
18993 |
|
18994 | GeomBase.prototype.setCoord = function setCoord(coord) {
|
18995 | this.set('coord', coord);
|
18996 | var position = this.getAttr('position');
|
18997 | var shapeContainer = this.get('shapeContainer');
|
18998 | shapeContainer.setMatrix(coord.matrix);
|
18999 | if (position) {
|
19000 | position.coord = coord;
|
19001 | }
|
19002 | };
|
19003 |
|
19004 |
|
19005 |
|
19006 |
|
19007 | GeomBase.prototype.paint = function paint() {
|
19008 | var self = this;
|
19009 | var dataArray = self.get('dataArray');
|
19010 | var mappedArray = [];
|
19011 | var shapeFactory = self.getShapeFactory();
|
19012 | shapeFactory.setCoord(self.get('coord'));
|
19013 | var shapeContainer = self.get('shapeContainer');
|
19014 | self._beforeMapping(dataArray);
|
19015 | for (var i = 0; i < dataArray.length; i++) {
|
19016 | var data = dataArray[i];
|
19017 | var index = i;
|
19018 | data = self._mapping(data);
|
19019 | mappedArray.push(data);
|
19020 | self.draw(data, shapeContainer, shapeFactory, index);
|
19021 | }
|
19022 | if (self.get('labelCfg')) {
|
19023 | self._addLabels(Util.union.apply(null, mappedArray));
|
19024 | }
|
19025 |
|
19026 | if (!self.get('sortable')) {
|
19027 | self._sort(mappedArray);
|
19028 | } else {
|
19029 | self.set('dataArray', mappedArray);
|
19030 | }
|
19031 | };
|
19032 |
|
19033 | GeomBase.prototype._sort = function _sort(mappedArray) {
|
19034 | var self = this;
|
19035 | var xScale = self.getXScale();
|
19036 | var xField = xScale.field;
|
19037 | Util.each(mappedArray, function (itemArr) {
|
19038 | itemArr.sort(function (obj1, obj2) {
|
19039 | return xScale.translate(obj1[FIELD_ORIGIN][xField]) - xScale.translate(obj2[FIELD_ORIGIN][xField]);
|
19040 | });
|
19041 | });
|
19042 |
|
19043 | self.set('dataArray', mappedArray);
|
19044 | };
|
19045 |
|
19046 |
|
19047 |
|
19048 |
|
19049 | GeomBase.prototype._beforeMapping = function _beforeMapping(dataArray) {
|
19050 | var self = this;
|
19051 | if (self.get('sortable')) {
|
19052 | var xScale = self.getXScale();
|
19053 | var field = xScale.field;
|
19054 | Util.each(dataArray, function (data) {
|
19055 | data.sort(function (v1, v2) {
|
19056 | return xScale.translate(v1[field]) - xScale.translate(v2[field]);
|
19057 | });
|
19058 | });
|
19059 | }
|
19060 | if (self.get('generatePoints')) {
|
19061 | Util.each(dataArray, function (data) {
|
19062 | self._generatePoints(data);
|
19063 | });
|
19064 | Util.each(dataArray, function (data, index) {
|
19065 | var nextData = dataArray[index + 1];
|
19066 | if (nextData) {
|
19067 | data[0].nextPoints = nextData[0].points;
|
19068 | }
|
19069 | });
|
19070 | }
|
19071 | };
|
19072 |
|
19073 |
|
19074 |
|
19075 |
|
19076 | GeomBase.prototype._addLabels = function _addLabels(points) {
|
19077 | var self = this;
|
19078 | var type = self.get('type');
|
19079 | var coord = self.get('coord');
|
19080 | var C = Labels.getLabelsClass(coord.type, type);
|
19081 | var container = self.get('container');
|
19082 | var scales = Util.map(self.get('labelCfg').fields, function (field) {
|
19083 | return self._createScale(field);
|
19084 | });
|
19085 | var labelContainer = container.addGroup(C, {
|
19086 | _id: this.get('_id'),
|
19087 | labelCfg: Util.mix({
|
19088 | scales: scales
|
19089 | }, self.get('labelCfg')),
|
19090 | coord: coord,
|
19091 | geom: self,
|
19092 | geomType: type
|
19093 | });
|
19094 | labelContainer.showLabels(points);
|
19095 | self.set('labelContainer', labelContainer);
|
19096 | };
|
19097 |
|
19098 | |
19099 |
|
19100 |
|
19101 |
|
19102 |
|
19103 |
|
19104 |
|
19105 | GeomBase.prototype.getShapeFactory = function getShapeFactory() {
|
19106 | var shapeFactory = this.get('shapeFactory');
|
19107 | if (!shapeFactory) {
|
19108 | var shapeType = this.get('shapeType');
|
19109 | shapeFactory = Shape.getShapeFactory(shapeType);
|
19110 | this.set('shapeFactory', shapeFactory);
|
19111 | }
|
19112 | return shapeFactory;
|
19113 | };
|
19114 |
|
19115 |
|
19116 |
|
19117 |
|
19118 | GeomBase.prototype._generatePoints = function _generatePoints(data) {
|
19119 | var self = this;
|
19120 | var shapeFactory = self.getShapeFactory();
|
19121 | var shapeAttr = self.getAttr('shape');
|
19122 | for (var i = 0; i < data.length; i++) {
|
19123 | var obj = data[i];
|
19124 | var cfg = self.createShapePointsCfg(obj);
|
19125 | var shape = shapeAttr ? self._getAttrValues(shapeAttr, obj) : null;
|
19126 | var points = shapeFactory.getShapePoints(shape, cfg);
|
19127 | obj.points = points;
|
19128 | }
|
19129 | };
|
19130 |
|
19131 | |
19132 |
|
19133 |
|
19134 |
|
19135 |
|
19136 |
|
19137 |
|
19138 |
|
19139 | GeomBase.prototype.createShapePointsCfg = function createShapePointsCfg(obj) {
|
19140 | var xScale = this.getXScale();
|
19141 | var yScale = this.getYScale();
|
19142 | var x = this._normalizeValues(obj[xScale.field], xScale);
|
19143 | var y = void 0;
|
19144 |
|
19145 | if (yScale) {
|
19146 | y = this._normalizeValues(obj[yScale.field], yScale);
|
19147 | } else {
|
19148 | y = obj.y ? obj.y : 0.1;
|
19149 | }
|
19150 |
|
19151 | return {
|
19152 | x: x,
|
19153 | y: y,
|
19154 | y0: yScale ? yScale.scale(this.getYMinValue()) : undefined
|
19155 | };
|
19156 | };
|
19157 |
|
19158 | |
19159 |
|
19160 |
|
19161 |
|
19162 |
|
19163 |
|
19164 |
|
19165 | GeomBase.prototype.getYMinValue = function getYMinValue() {
|
19166 | var yScale = this.getYScale();
|
19167 | var min = yScale.min;
|
19168 | var value = void 0;
|
19169 | if (min >= 0) {
|
19170 | value = min;
|
19171 | } else {
|
19172 | value = 0;
|
19173 | }
|
19174 | return value;
|
19175 | };
|
19176 |
|
19177 |
|
19178 |
|
19179 |
|
19180 | GeomBase.prototype._normalizeValues = function _normalizeValues(values, scale) {
|
19181 | var rst = [];
|
19182 | if (Util.isArray(values)) {
|
19183 | for (var i = 0; i < values.length; i++) {
|
19184 | var v = values[i];
|
19185 | rst.push(scale.scale(v));
|
19186 | }
|
19187 | } else {
|
19188 | rst = scale.scale(values);
|
19189 | }
|
19190 | return rst;
|
19191 | };
|
19192 |
|
19193 |
|
19194 |
|
19195 |
|
19196 | GeomBase.prototype._mapping = function _mapping(data) {
|
19197 | var self = this;
|
19198 | var attrs = self.get('attrs');
|
19199 | var mappedData = [];
|
19200 | for (var i = 0; i < data.length; i++) {
|
19201 | var record = data[i];
|
19202 | var newRecord = {};
|
19203 | newRecord[FIELD_ORIGIN] = record[FIELD_ORIGIN];
|
19204 | newRecord.points = record.points;
|
19205 | newRecord.nextPoints = record.nextPoints;
|
19206 | for (var k in attrs) {
|
19207 | if (attrs.hasOwnProperty(k)) {
|
19208 | var attr = attrs[k];
|
19209 | var names = attr.names;
|
19210 | var values = self._getAttrValues(attr, record);
|
19211 | if (names.length > 1) {
|
19212 |
|
19213 | for (var j = 0; j < values.length; j++) {
|
19214 | var val = values[j];
|
19215 | var name = names[j];
|
19216 | newRecord[name] = Util.isArray(val) && val.length === 1 ? val[0] : val;
|
19217 | }
|
19218 | } else {
|
19219 | newRecord[names[0]] = values.length === 1 ? values[0] : values;
|
19220 | }
|
19221 | }
|
19222 | }
|
19223 | mappedData.push(newRecord);
|
19224 | }
|
19225 |
|
19226 | return mappedData;
|
19227 | };
|
19228 |
|
19229 |
|
19230 |
|
19231 |
|
19232 | GeomBase.prototype._getAttrValues = function _getAttrValues(attr, record) {
|
19233 | var scales = attr.scales;
|
19234 | var params = [];
|
19235 | for (var i = 0; i < scales.length; i++) {
|
19236 | var scale = scales[i];
|
19237 | var field = scale.field;
|
19238 | if (scale.type === 'identity') {
|
19239 | params.push(scale.value);
|
19240 | } else {
|
19241 | params.push(record[field]);
|
19242 | }
|
19243 | }
|
19244 | var values = attr.mapping.apply(attr, params);
|
19245 | return values;
|
19246 | };
|
19247 |
|
19248 | GeomBase.prototype.getAttrValue = function getAttrValue(attrName, record) {
|
19249 | var attr = this.getAttr(attrName);
|
19250 | var rst = null;
|
19251 | if (attr) {
|
19252 | var values = this._getAttrValues(attr, record);
|
19253 | rst = values[0];
|
19254 | }
|
19255 | return rst;
|
19256 | };
|
19257 |
|
19258 | GeomBase.prototype.getDefaultValue = function getDefaultValue(attrName) {
|
19259 | var value = this.get(attrName);
|
19260 | var attr = this.getAttr(attrName);
|
19261 | if (attr) {
|
19262 | var scale = attr.getScale(attrName);
|
19263 | if (scale.type === 'identity') {
|
19264 | value = scale.value;
|
19265 | }
|
19266 | }
|
19267 | return value;
|
19268 | };
|
19269 |
|
19270 | |
19271 |
|
19272 |
|
19273 |
|
19274 |
|
19275 |
|
19276 |
|
19277 |
|
19278 |
|
19279 |
|
19280 | GeomBase.prototype.draw = function draw(data, container, shapeFactory, index) {
|
19281 | var self = this;
|
19282 | for (var i = 0; i < data.length; i++) {
|
19283 | var obj = data[i];
|
19284 | self.drawPoint(obj, container, shapeFactory, index + i);
|
19285 | }
|
19286 | };
|
19287 |
|
19288 | GeomBase.prototype.getCallbackCfg = function getCallbackCfg(fields, cfg, origin) {
|
19289 | if (!fields) {
|
19290 | return cfg;
|
19291 | }
|
19292 | var tmpCfg = {};
|
19293 | var params = fields.map(function (field) {
|
19294 | return origin[field];
|
19295 | });
|
19296 | Util.each(cfg, function (v, k) {
|
19297 | if (Util.isFunction(v)) {
|
19298 | tmpCfg[k] = v.apply(null, params);
|
19299 | } else {
|
19300 | tmpCfg[k] = v;
|
19301 | }
|
19302 | });
|
19303 | return tmpCfg;
|
19304 | };
|
19305 |
|
19306 | GeomBase.prototype._getShapeId = function _getShapeId(dataObj) {
|
19307 | var id = this.get('_id');
|
19308 | var keyFields = this.get('keyFields');
|
19309 | if (keyFields && keyFields.length > 0) {
|
19310 | Util.each(keyFields, function (key) {
|
19311 | id += '-' + dataObj[key];
|
19312 | });
|
19313 | } else {
|
19314 | var type = this.get('type');
|
19315 | var xScale = this.getXScale();
|
19316 | var yScale = this.getYScale();
|
19317 | var xField = xScale.field || 'x';
|
19318 | var yField = yScale.field || 'y';
|
19319 | var yVal = dataObj[yField];
|
19320 | var xVal = void 0;
|
19321 | if (xScale.isIdentity) {
|
19322 | xVal = xScale.value;
|
19323 | } else {
|
19324 | xVal = dataObj[xField];
|
19325 | }
|
19326 |
|
19327 | if (type === 'interval' || type === 'schema') {
|
19328 | id += '-' + xVal;
|
19329 | } else if (type === 'line' || type === 'area' || type === 'path') {
|
19330 | id += '-' + type;
|
19331 | } else {
|
19332 | id += '-' + xVal + '-' + yVal;
|
19333 | }
|
19334 |
|
19335 | var groupScales = this._getGroupScales();
|
19336 | if (!Util.isEmpty(groupScales)) {
|
19337 | Util.each(groupScales, function (groupScale) {
|
19338 | var field = groupScale.field;
|
19339 | if (groupScale.type !== 'identity') {
|
19340 | id += '-' + dataObj[field];
|
19341 | }
|
19342 | });
|
19343 | }
|
19344 | }
|
19345 |
|
19346 | return id;
|
19347 | };
|
19348 |
|
19349 | GeomBase.prototype.getDrawCfg = function getDrawCfg(obj) {
|
19350 | var self = this;
|
19351 | var cfg = {
|
19352 | origin: obj,
|
19353 | x: obj.x,
|
19354 | y: obj.y,
|
19355 | color: obj.color,
|
19356 | size: obj.size,
|
19357 | shape: obj.shape,
|
19358 | isInCircle: self.isInCircle(),
|
19359 | opacity: obj.opacity
|
19360 | };
|
19361 | var styleOptions = self.get('styleOptions');
|
19362 | if (styleOptions && styleOptions.style) {
|
19363 | cfg.style = self.getCallbackCfg(styleOptions.fields, styleOptions.style, obj[FIELD_ORIGIN]);
|
19364 | }
|
19365 | if (this.get('generatePoints')) {
|
19366 | cfg.points = obj.points;
|
19367 | cfg.nextPoints = obj.nextPoints;
|
19368 | }
|
19369 | if (this.get('animate')) {
|
19370 |
|
19371 | cfg._id = self._getShapeId(obj[FIELD_ORIGIN]);
|
19372 | }
|
19373 | return cfg;
|
19374 | };
|
19375 |
|
19376 | GeomBase.prototype.drawPoint = function drawPoint(obj, container, shapeFactory, index) {
|
19377 | var shape = obj.shape;
|
19378 | var cfg = this.getDrawCfg(obj);
|
19379 | var geomShape = shapeFactory.drawShape(shape, cfg, container);
|
19380 | geomShape.setSilent('index', index);
|
19381 | geomShape.setSilent('coord', this.get('coord'));
|
19382 |
|
19383 | if (this.get('animate') && this.get('animateCfg')) {
|
19384 | geomShape.setSilent('animateCfg', this.get('animateCfg'));
|
19385 | }
|
19386 | };
|
19387 |
|
19388 | |
19389 |
|
19390 |
|
19391 |
|
19392 |
|
19393 |
|
19394 |
|
19395 |
|
19396 | GeomBase.prototype.getAttr = function getAttr(name) {
|
19397 | return this.get('attrs')[name];
|
19398 | };
|
19399 |
|
19400 | |
19401 |
|
19402 |
|
19403 |
|
19404 |
|
19405 |
|
19406 | GeomBase.prototype.getXScale = function getXScale() {
|
19407 | return this.getAttr('position').scales[0];
|
19408 | };
|
19409 |
|
19410 | |
19411 |
|
19412 |
|
19413 |
|
19414 |
|
19415 |
|
19416 | GeomBase.prototype.getYScale = function getYScale() {
|
19417 | return this.getAttr('position').scales[1];
|
19418 | };
|
19419 |
|
19420 | GeomBase.prototype.getShapes = function getShapes() {
|
19421 | var result = [];
|
19422 | var shapeContainer = this.get('shapeContainer');
|
19423 | var children = shapeContainer.get('children');
|
19424 | Util.each(children, function (child) {
|
19425 | if (child.get('origin')) {
|
19426 |
|
19427 | result.push(child);
|
19428 | }
|
19429 | });
|
19430 | return result;
|
19431 | };
|
19432 |
|
19433 | GeomBase.prototype.getAttrsForLegend = function getAttrsForLegend() {
|
19434 | var attrs = this.get('attrs');
|
19435 | var rst = [];
|
19436 | Util.each(attrs, function (attr) {
|
19437 | if (GROUP_ATTRS.indexOf(attr.type) !== -1) {
|
19438 | rst.push(attr);
|
19439 | }
|
19440 | });
|
19441 | return rst;
|
19442 | };
|
19443 |
|
19444 | GeomBase.prototype.getFieldsForLegend = function getFieldsForLegend() {
|
19445 | var fields = [];
|
19446 | var attrOptions = this.get('attrOptions');
|
19447 | Util.each(GROUP_ATTRS, function (attrName) {
|
19448 | var attrCfg = attrOptions[attrName];
|
19449 | if (attrCfg && attrCfg.field && Util.isString(attrCfg.field)) {
|
19450 | fields = fields.concat(attrCfg.field.split('*'));
|
19451 | }
|
19452 | });
|
19453 | return Util.uniq(fields);
|
19454 | };
|
19455 |
|
19456 | GeomBase.prototype.changeVisible = function changeVisible(visible, stopDraw) {
|
19457 | var shapeContainer = this.get('shapeContainer');
|
19458 | shapeContainer.set('visible', visible);
|
19459 | var labelContainer = this.get('labelContainer');
|
19460 | if (labelContainer) {
|
19461 | labelContainer.set('visible', visible);
|
19462 | }
|
19463 | if (!stopDraw) {
|
19464 | var canvas = shapeContainer.get('canvas');
|
19465 | canvas.draw();
|
19466 | }
|
19467 | };
|
19468 |
|
19469 | GeomBase.prototype.reset = function reset() {
|
19470 | this.set('attrOptions', {});
|
19471 | this.clearInner();
|
19472 | };
|
19473 |
|
19474 | GeomBase.prototype.clearInner = function clearInner() {
|
19475 | this.clearActivedShapes();
|
19476 | this.clearSelected();
|
19477 | var shapeContainer = this.get('shapeContainer');
|
19478 | shapeContainer && shapeContainer.clear();
|
19479 |
|
19480 |
|
19481 | var labelContainer = this.get('labelContainer');
|
19482 | labelContainer && labelContainer.remove();
|
19483 | this.set('attrs', {});
|
19484 | this.set('groupScales', null);
|
19485 |
|
19486 |
|
19487 |
|
19488 | this.set('labelContainer', null);
|
19489 | this.set('xDistance', null);
|
19490 | this.set('isStacked', null);
|
19491 | };
|
19492 |
|
19493 | GeomBase.prototype.clear = function clear() {
|
19494 | this.clearInner();
|
19495 | this.set('scales', {});
|
19496 | };
|
19497 |
|
19498 | GeomBase.prototype.destroy = function destroy() {
|
19499 | this.clear();
|
19500 | var shapeContainer = this.get('shapeContainer');
|
19501 | shapeContainer && shapeContainer.remove();
|
19502 | this.offEvents();
|
19503 | _Base.prototype.destroy.call(this);
|
19504 | };
|
19505 |
|
19506 | GeomBase.prototype.bindEvents = function bindEvents() {
|
19507 | if (this.get('view')) {
|
19508 | this._bindActiveAction();
|
19509 | this._bindSelectedAction();
|
19510 | }
|
19511 | };
|
19512 |
|
19513 | GeomBase.prototype.offEvents = function offEvents() {
|
19514 | if (this.get('view')) {
|
19515 | this._offActiveAction();
|
19516 | this._offSelectedAction();
|
19517 | }
|
19518 | };
|
19519 |
|
19520 | return GeomBase;
|
19521 | }(Base);
|
19522 |
|
19523 | module.exports = GeomBase;
|
19524 |
|
19525 | }),
|
19526 |
|
19527 | (function(module, exports, __webpack_require__) {
|
19528 |
|
19529 |
|
19530 |
|
19531 |
|
19532 |
|
19533 |
|
19534 | var Util = __webpack_require__(0);
|
19535 | var PathUtil = __webpack_require__(14);
|
19536 | var GPath = __webpack_require__(2).PathUtil;
|
19537 | var Shape = {};
|
19538 |
|
19539 | var ShapeBase = {
|
19540 | _coord: null,
|
19541 | |
19542 |
|
19543 |
|
19544 |
|
19545 |
|
19546 |
|
19547 | draw: function draw(cfg, container) {
|
19548 | if (this.drawShape) {
|
19549 | return this.drawShape(cfg, container);
|
19550 | }
|
19551 | return null;
|
19552 | },
|
19553 |
|
19554 | |
19555 |
|
19556 |
|
19557 |
|
19558 |
|
19559 |
|
19560 |
|
19561 |
|
19562 | |
19563 |
|
19564 |
|
19565 |
|
19566 | setCoord: function setCoord(coord) {
|
19567 | this._coord = coord;
|
19568 | },
|
19569 |
|
19570 | |
19571 |
|
19572 |
|
19573 |
|
19574 |
|
19575 |
|
19576 | parsePath: function parsePath(path, islineToArc) {
|
19577 | var coord = this._coord;
|
19578 | path = GPath.parsePathString(path);
|
19579 | if (coord.isPolar && islineToArc !== false) {
|
19580 | path = PathUtil.convertPolarPath(coord, path);
|
19581 | } else {
|
19582 | path = PathUtil.convertNormalPath(coord, path);
|
19583 | }
|
19584 | return path;
|
19585 | },
|
19586 |
|
19587 | |
19588 |
|
19589 |
|
19590 |
|
19591 |
|
19592 | parsePoint: function parsePoint(point) {
|
19593 | var coord = this._coord;
|
19594 | return coord.convertPoint(point);
|
19595 | },
|
19596 |
|
19597 | |
19598 |
|
19599 |
|
19600 |
|
19601 |
|
19602 | parsePoints: function parsePoints(points) {
|
19603 | var coord = this._coord;
|
19604 | var rst = [];
|
19605 | Util.each(points, function (point) {
|
19606 | rst.push(coord.convertPoint(point));
|
19607 | });
|
19608 | return rst;
|
19609 | }
|
19610 | };
|
19611 |
|
19612 | var ShapeFactoryBase = {
|
19613 | defaultShapeType: null,
|
19614 | setCoord: function setCoord(coord) {
|
19615 | this._coord = coord;
|
19616 | },
|
19617 | getShape: function getShape(type) {
|
19618 | var self = this;
|
19619 | if (Util.isArray(type)) {
|
19620 | type = type[0];
|
19621 | }
|
19622 | var shape = self[type] || self[self.defaultShapeType];
|
19623 | shape._coord = self._coord;
|
19624 | return shape;
|
19625 | },
|
19626 | getShapePoints: function getShapePoints(type, cfg) {
|
19627 | var shape = this.getShape(type);
|
19628 | var fn = shape.getPoints || shape.getShapePoints || this.getDefaultPoints;
|
19629 | var points = fn(cfg);
|
19630 | return points;
|
19631 | },
|
19632 | getDefaultPoints: function getDefaultPoints() /* cfg */{
|
19633 | return [];
|
19634 | },
|
19635 | getMarkerCfg: function getMarkerCfg(type, cfg) {
|
19636 | var shape = this.getShape(type);
|
19637 | if (!shape.getMarkerCfg) {
|
19638 | var defaultShapeType = this.defaultShapeType;
|
19639 | shape = this.getShape(defaultShapeType);
|
19640 | }
|
19641 |
|
19642 | return shape.getMarkerCfg(cfg);
|
19643 | },
|
19644 | drawShape: function drawShape(type, cfg, container) {
|
19645 | var shape = this.getShape(type);
|
19646 | var gShape = shape.draw(cfg, container);
|
19647 | if (gShape) {
|
19648 | gShape.setSilent('origin', cfg.origin);
|
19649 | gShape._id = cfg.yIndex ? cfg._id + cfg.yIndex : cfg._id;
|
19650 | gShape.name = this.name;
|
19651 | }
|
19652 | return gShape;
|
19653 | }
|
19654 | };
|
19655 |
|
19656 |
|
19657 | Shape.registerFactory = function (factoryName, cfg) {
|
19658 | var className = Util.upperFirst(factoryName);
|
19659 | var geomObj = Util.assign({}, ShapeFactoryBase, cfg);
|
19660 | Shape[className] = geomObj;
|
19661 | geomObj.name = factoryName;
|
19662 | return geomObj;
|
19663 | };
|
19664 |
|
19665 |
|
19666 | Shape.registerShape = function (factoryName, shapeType, cfg) {
|
19667 | var className = Util.upperFirst(factoryName);
|
19668 | var factory = Shape[className];
|
19669 | var shapeObj = Util.assign({}, ShapeBase, cfg);
|
19670 | factory[shapeType] = shapeObj;
|
19671 | return shapeObj;
|
19672 | };
|
19673 |
|
19674 |
|
19675 | Shape.getShapeFactory = function (factoryName) {
|
19676 | var self = this;
|
19677 | factoryName = factoryName || 'point';
|
19678 | var className = Util.upperFirst(factoryName);
|
19679 | return self[className];
|
19680 | };
|
19681 |
|
19682 | module.exports = Shape;
|
19683 |
|
19684 | }),
|
19685 |
|
19686 | (function(module, exports, __webpack_require__) {
|
19687 |
|
19688 | var arrayLikeKeys = __webpack_require__(70),
|
19689 | baseKeys = __webpack_require__(74),
|
19690 | isArrayLike = __webpack_require__(8);
|
19691 |
|
19692 |
|
19693 |
|
19694 |
|
19695 |
|
19696 |
|
19697 |
|
19698 |
|
19699 |
|
19700 |
|
19701 |
|
19702 |
|
19703 |
|
19704 |
|
19705 |
|
19706 |
|
19707 |
|
19708 |
|
19709 |
|
19710 |
|
19711 |
|
19712 |
|
19713 |
|
19714 |
|
19715 |
|
19716 |
|
19717 |
|
19718 |
|
19719 |
|
19720 | function keys(object) {
|
19721 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
19722 | }
|
19723 |
|
19724 | module.exports = keys;
|
19725 |
|
19726 | }),
|
19727 |
|
19728 | (function(module, exports, __webpack_require__) {
|
19729 |
|
19730 | var root = __webpack_require__(4);
|
19731 |
|
19732 |
|
19733 | var _Symbol = root.Symbol;
|
19734 |
|
19735 | module.exports = _Symbol;
|
19736 |
|
19737 | }),
|
19738 |
|
19739 | (function(module, exports, __webpack_require__) {
|
19740 |
|
19741 | var baseIsNative = __webpack_require__(155),
|
19742 | getValue = __webpack_require__(158);
|
19743 |
|
19744 |
|
19745 |
|
19746 |
|
19747 |
|
19748 |
|
19749 |
|
19750 |
|
19751 |
|
19752 | function getNative(object, key) {
|
19753 | var value = getValue(object, key);
|
19754 | return baseIsNative(value) ? value : undefined;
|
19755 | }
|
19756 |
|
19757 | module.exports = getNative;
|
19758 |
|
19759 | }),
|
19760 |
|
19761 | (function(module, exports, __webpack_require__) {
|
19762 |
|
19763 |
|
19764 |
|
19765 |
|
19766 |
|
19767 | var Util = __webpack_require__(0);
|
19768 | var Spline = __webpack_require__(301);
|
19769 |
|
19770 | function points2path(points, isInCircle) {
|
19771 | if (!points.length) {
|
19772 | return [];
|
19773 | }
|
19774 | var path = [];
|
19775 |
|
19776 | for (var i = 0, length = points.length; i < length; i++) {
|
19777 | var item = points[i];
|
19778 | if (i === 0) {
|
19779 | path.push(['M', item.x, item.y]);
|
19780 | } else {
|
19781 | path.push(['L', item.x, item.y]);
|
19782 | }
|
19783 | }
|
19784 |
|
19785 | if (isInCircle) {
|
19786 | path.push(['Z']);
|
19787 | }
|
19788 | return path;
|
19789 | }
|
19790 |
|
19791 | function _getPointRadius(coord, point) {
|
19792 | var center = coord.getCenter();
|
19793 | var r = Math.sqrt(Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2));
|
19794 | return r;
|
19795 | }
|
19796 |
|
19797 | function convertArr(arr, coord) {
|
19798 | var len = arr.length;
|
19799 | var tmp = [arr[0]];
|
19800 | for (var i = 1; i < len; i = i + 2) {
|
19801 | var point = coord.convertPoint({
|
19802 | x: arr[i],
|
19803 | y: arr[i + 1]
|
19804 | });
|
19805 | tmp.push(point.x, point.y);
|
19806 | }
|
19807 | return tmp;
|
19808 | }
|
19809 |
|
19810 | function _convertPolarPath(pre, cur, coord) {
|
19811 |
|
19812 |
|
19813 |
|
19814 | var transposed = coord.isTransposed;
|
19815 | var startAngle = coord.startAngle;
|
19816 | var endAngle = coord.endAngle;
|
19817 |
|
19818 | var prePoint = {
|
19819 | x: pre[1],
|
19820 | y: pre[2]
|
19821 | };
|
19822 | var curPoint = {
|
19823 | x: cur[1],
|
19824 | y: cur[2]
|
19825 | };
|
19826 | var rst = [];
|
19827 |
|
19828 | var xDim = transposed ? 'y' : 'x';
|
19829 | var angleRange = Math.abs(curPoint[xDim] - prePoint[xDim]) * (endAngle - startAngle);
|
19830 | var direction = curPoint[xDim] >= prePoint[xDim] ? 1 : 0;
|
19831 | var flag = angleRange > Math.PI ? 1 : 0;
|
19832 | var convertPoint = coord.convertPoint(curPoint);
|
19833 | var r = _getPointRadius(coord, convertPoint);
|
19834 | if (r >= 0.5) {
|
19835 |
|
19836 | if (angleRange === Math.PI * 2) {
|
19837 | var middlePoint = {
|
19838 | x: (curPoint.x + prePoint.x) / 2,
|
19839 | y: (curPoint.y + prePoint.y) / 2
|
19840 | };
|
19841 | var middleConvertPoint = coord.convertPoint(middlePoint);
|
19842 | rst.push(['A', r, r, 0, flag, direction, middleConvertPoint.x, middleConvertPoint.y]);
|
19843 | rst.push(['A', r, r, 0, flag, direction, convertPoint.x, convertPoint.y]);
|
19844 | } else {
|
19845 | rst.push(['A', r, r, 0, flag, direction, convertPoint.x, convertPoint.y]);
|
19846 | }
|
19847 | }
|
19848 | return rst;
|
19849 | }
|
19850 |
|
19851 |
|
19852 | function filterFullCirleLine(path) {
|
19853 | Util.each(path, function (subPath, index) {
|
19854 | var cur = subPath;
|
19855 | if (cur[0].toLowerCase() === 'a') {
|
19856 | var pre = path[index - 1];
|
19857 | var next = path[index + 1];
|
19858 | if (next && next[0].toLowerCase() === 'a') {
|
19859 | if (pre && pre[0].toLowerCase() === 'l') {
|
19860 | pre[0] = 'M';
|
19861 | }
|
19862 | } else if (pre && pre[0].toLowerCase() === 'a') {
|
19863 | if (next && next[0].toLowerCase() === 'l') {
|
19864 | next[0] = 'M';
|
19865 | }
|
19866 | }
|
19867 | }
|
19868 | });
|
19869 | }
|
19870 |
|
19871 | var PathUtil = {
|
19872 |
|
19873 | getLinePath: function getLinePath(points, isInCircle) {
|
19874 | return points2path(points, isInCircle);
|
19875 | },
|
19876 |
|
19877 |
|
19878 | getSplinePath: function getSplinePath(points, isInCircle, constaint) {
|
19879 | var data = [];
|
19880 | var first = points[0];
|
19881 | var prePoint = null;
|
19882 | if (points.length <= 2) {
|
19883 | return PathUtil.getLinePath(points, isInCircle);
|
19884 | }
|
19885 | Util.each(points, function (point) {
|
19886 | if (!prePoint || !(prePoint.x === point.x && prePoint.y === point.y)) {
|
19887 | data.push(point.x);
|
19888 | data.push(point.y);
|
19889 | prePoint = point;
|
19890 | }
|
19891 | });
|
19892 | constaint = constaint || [
|
19893 | [0, 0], [1, 1]];
|
19894 | var splinePath = Spline.catmullRom2bezier(data, isInCircle, constaint);
|
19895 | splinePath.unshift(['M', first.x, first.y]);
|
19896 | return splinePath;
|
19897 | },
|
19898 | getPointRadius: function getPointRadius(coord, point) {
|
19899 | var result = _getPointRadius(coord, point);
|
19900 | return result;
|
19901 | },
|
19902 | getPointAngle: function getPointAngle(coord, point) {
|
19903 | var center = coord.getCenter();
|
19904 | var angle = Math.atan2(point.y - center.y, point.x - center.x);
|
19905 | return angle;
|
19906 | },
|
19907 | convertNormalPath: function convertNormalPath(coord, path) {
|
19908 | var tmp = [];
|
19909 | Util.each(path, function (subPath) {
|
19910 | var action = subPath[0];
|
19911 | switch (action.toLowerCase()) {
|
19912 | case 'm':
|
19913 | case 'l':
|
19914 | case 'c':
|
19915 | tmp.push(convertArr(subPath, coord));
|
19916 | break;
|
19917 | case 'z':
|
19918 | default:
|
19919 | tmp.push(subPath);
|
19920 | break;
|
19921 | }
|
19922 | });
|
19923 | return tmp;
|
19924 | },
|
19925 | convertPolarPath: function convertPolarPath(coord, path) {
|
19926 | var tmp = [];
|
19927 | var pre = void 0;
|
19928 | var cur = void 0;
|
19929 | var transposed = void 0;
|
19930 | var equals = void 0;
|
19931 | Util.each(path, function (subPath, index) {
|
19932 | var action = subPath[0];
|
19933 |
|
19934 | switch (action.toLowerCase()) {
|
19935 | case 'm':
|
19936 | case 'c':
|
19937 | case 'q':
|
19938 | tmp.push(convertArr(subPath, coord));
|
19939 | break;
|
19940 | case 'l':
|
19941 | pre = path[index - 1];
|
19942 | cur = subPath;
|
19943 | transposed = coord.isTransposed;
|
19944 |
|
19945 | equals = transposed ? pre[pre.length - 2] === cur[1] : pre[pre.length - 1] === cur[2];
|
19946 | if (equals) {
|
19947 | tmp = tmp.concat(_convertPolarPath(pre, cur, coord));
|
19948 | } else {
|
19949 |
|
19950 | tmp.push(convertArr(subPath, coord));
|
19951 | }
|
19952 | break;
|
19953 | case 'z':
|
19954 | default:
|
19955 | tmp.push(subPath);
|
19956 | break;
|
19957 | }
|
19958 | });
|
19959 | filterFullCirleLine(tmp);
|
19960 | return tmp;
|
19961 | }
|
19962 | };
|
19963 |
|
19964 | module.exports = PathUtil;
|
19965 |
|
19966 | }),
|
19967 |
|
19968 | (function(module, exports, __webpack_require__) {
|
19969 |
|
19970 | var baseToString = __webpack_require__(186);
|
19971 |
|
19972 |
|
19973 |
|
19974 |
|
19975 |
|
19976 |
|
19977 |
|
19978 |
|
19979 |
|
19980 |
|
19981 |
|
19982 |
|
19983 |
|
19984 |
|
19985 |
|
19986 |
|
19987 |
|
19988 |
|
19989 |
|
19990 |
|
19991 |
|
19992 |
|
19993 | function toString(value) {
|
19994 | return value == null ? '' : baseToString(value);
|
19995 | }
|
19996 |
|
19997 | module.exports = toString;
|
19998 |
|
19999 | }),
|
20000 |
|
20001 | (function(module, exports, __webpack_require__) {
|
20002 |
|
20003 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20004 |
|
20005 |
|
20006 |
|
20007 |
|
20008 |
|
20009 |
|
20010 | var Util = __webpack_require__(0);
|
20011 |
|
20012 | function toScaleString(scale, value) {
|
20013 | if (Util.isString(value)) {
|
20014 | return value;
|
20015 | }
|
20016 | return scale.invert(scale.scale(value));
|
20017 | }
|
20018 |
|
20019 |
|
20020 |
|
20021 |
|
20022 |
|
20023 | var AttributeBase = function () {
|
20024 | function AttributeBase(cfg) {
|
20025 | _classCallCheck(this, AttributeBase);
|
20026 |
|
20027 | |
20028 |
|
20029 |
|
20030 |
|
20031 | this.type = 'base';
|
20032 |
|
20033 | |
20034 |
|
20035 |
|
20036 |
|
20037 | this.name = null;
|
20038 |
|
20039 | |
20040 |
|
20041 |
|
20042 |
|
20043 | this.method = null;
|
20044 |
|
20045 | |
20046 |
|
20047 |
|
20048 |
|
20049 | this.values = [];
|
20050 |
|
20051 | |
20052 |
|
20053 |
|
20054 |
|
20055 | this.scales = [];
|
20056 |
|
20057 | |
20058 |
|
20059 |
|
20060 |
|
20061 | this.linear = null;
|
20062 |
|
20063 | Util.mix(this, cfg);
|
20064 | }
|
20065 |
|
20066 | AttributeBase.prototype.get = function get(name) {
|
20067 | return this[name];
|
20068 | };
|
20069 |
|
20070 | AttributeBase.prototype.set = function set(name, value) {
|
20071 | this[name] = value;
|
20072 | };
|
20073 |
|
20074 |
|
20075 |
|
20076 |
|
20077 | AttributeBase.prototype._getAttrValue = function _getAttrValue(scale, value) {
|
20078 | var values = this.values;
|
20079 | if (scale.isCategory && !this.linear) {
|
20080 | var index = scale.translate(value);
|
20081 | return values[index % values.length];
|
20082 | }
|
20083 | var percent = scale.scale(value);
|
20084 | return this.getLinearValue(percent);
|
20085 | };
|
20086 |
|
20087 | |
20088 |
|
20089 |
|
20090 |
|
20091 |
|
20092 |
|
20093 |
|
20094 |
|
20095 | AttributeBase.prototype.getLinearValue = function getLinearValue(percent) {
|
20096 | var values = this.values;
|
20097 | var steps = values.length - 1;
|
20098 | var step = Math.floor(steps * percent);
|
20099 | var leftPercent = steps * percent - step;
|
20100 | var start = values[step];
|
20101 | var end = step === steps ? start : values[step + 1];
|
20102 | var rstValue = start + (end - start) * leftPercent;
|
20103 | return rstValue;
|
20104 | };
|
20105 |
|
20106 | |
20107 |
|
20108 |
|
20109 |
|
20110 |
|
20111 |
|
20112 |
|
20113 |
|
20114 | AttributeBase.prototype.callback = function callback(value) {
|
20115 | var self = this;
|
20116 | var scale = self.scales[0];
|
20117 | var rstValue = null;
|
20118 | if (scale.type === 'identity') {
|
20119 | rstValue = scale.value;
|
20120 | } else {
|
20121 | rstValue = self._getAttrValue(scale, value);
|
20122 | }
|
20123 | return rstValue;
|
20124 | };
|
20125 |
|
20126 | |
20127 |
|
20128 |
|
20129 |
|
20130 |
|
20131 |
|
20132 | AttributeBase.prototype.getNames = function getNames() {
|
20133 | var scales = this.scales;
|
20134 | var names = this.names;
|
20135 | var length = Math.min(scales.length, names.length);
|
20136 | var rst = [];
|
20137 | for (var i = 0; i < length; i++) {
|
20138 | rst.push(names[i]);
|
20139 | }
|
20140 | return rst;
|
20141 | };
|
20142 |
|
20143 | |
20144 |
|
20145 |
|
20146 |
|
20147 |
|
20148 |
|
20149 | AttributeBase.prototype.getFields = function getFields() {
|
20150 | var scales = this.scales;
|
20151 | var rst = [];
|
20152 | Util.each(scales, function (scale) {
|
20153 | rst.push(scale.field);
|
20154 | });
|
20155 | return rst;
|
20156 | };
|
20157 |
|
20158 | |
20159 |
|
20160 |
|
20161 |
|
20162 |
|
20163 |
|
20164 |
|
20165 | AttributeBase.prototype.getScale = function getScale(name) {
|
20166 | var scales = this.scales;
|
20167 | var names = this.names;
|
20168 | var index = names.indexOf(name);
|
20169 | return scales[index];
|
20170 | };
|
20171 |
|
20172 | |
20173 |
|
20174 |
|
20175 |
|
20176 |
|
20177 |
|
20178 |
|
20179 | AttributeBase.prototype.mapping = function mapping() {
|
20180 | var scales = this.scales;
|
20181 | var callback = this.callback;
|
20182 |
|
20183 | for (var _len = arguments.length, params = Array(_len), _key = 0; _key < _len; _key++) {
|
20184 | params[_key] = arguments[_key];
|
20185 | }
|
20186 |
|
20187 | var values = params;
|
20188 | if (callback) {
|
20189 | for (var i = 0; i < params.length; i++) {
|
20190 | params[i] = this._toOriginParam(params[i], scales[i]);
|
20191 | }
|
20192 | values = callback.apply(this, params);
|
20193 | }
|
20194 | if (!Util.isArray(values)) {
|
20195 | values = [values];
|
20196 | }
|
20197 | return values;
|
20198 | };
|
20199 |
|
20200 |
|
20201 |
|
20202 |
|
20203 | AttributeBase.prototype._toOriginParam = function _toOriginParam(param, scale) {
|
20204 | var rst = param;
|
20205 | if (!scale.isLinear) {
|
20206 | if (Util.isArray(param)) {
|
20207 | rst = [];
|
20208 | for (var i = 0; i < param.length; i++) {
|
20209 | rst.push(toScaleString(scale, param[i]));
|
20210 | }
|
20211 | } else {
|
20212 | rst = toScaleString(scale, param);
|
20213 | }
|
20214 | }
|
20215 | return rst;
|
20216 | };
|
20217 |
|
20218 | return AttributeBase;
|
20219 | }();
|
20220 |
|
20221 | module.exports = AttributeBase;
|
20222 |
|
20223 | }),
|
20224 |
|
20225 | (function(module, exports, __webpack_require__) {
|
20226 |
|
20227 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20228 |
|
20229 |
|
20230 |
|
20231 |
|
20232 |
|
20233 | var Util = __webpack_require__(0);
|
20234 | var KEYWORDS = ['min', 'max', 'median'];
|
20235 |
|
20236 | function getFirstScale(scales) {
|
20237 | var firstScale = void 0;
|
20238 | Util.each(scales, function (scale) {
|
20239 | if (scale) {
|
20240 | firstScale = scale;
|
20241 | return false;
|
20242 | }
|
20243 | });
|
20244 | return firstScale;
|
20245 | }
|
20246 |
|
20247 | var Base = function () {
|
20248 | Base.prototype.getDefaultCfg = function getDefaultCfg() {
|
20249 | return {
|
20250 | zIndex: 1,
|
20251 | xScales: null,
|
20252 | yScales: null,
|
20253 | el: null
|
20254 | };
|
20255 | };
|
20256 |
|
20257 | function Base(cfg) {
|
20258 | _classCallCheck(this, Base);
|
20259 |
|
20260 | var defaultCfg = this.getDefaultCfg();
|
20261 | cfg = Util.deepMix({}, defaultCfg, cfg);
|
20262 | Util.mix(this, cfg);
|
20263 | }
|
20264 |
|
20265 | |
20266 |
|
20267 |
|
20268 |
|
20269 |
|
20270 |
|
20271 |
|
20272 |
|
20273 | Base.prototype._getNormalizedValue = function _getNormalizedValue(val, scale) {
|
20274 | var result = void 0;
|
20275 | if (Util.indexOf(KEYWORDS, val) !== -1) {
|
20276 |
|
20277 | var scaleValue = void 0;
|
20278 | if (val === 'median') {
|
20279 | scaleValue = scale.isCategory ? (scale.values.length - 1) / 2 : (scale.min + scale.max) / 2;
|
20280 | result = scale.scale(scaleValue);
|
20281 | } else {
|
20282 | if (scale.isCategory) {
|
20283 | scaleValue = val === 'min' ? 0 : scale.values.length - 1;
|
20284 | } else {
|
20285 | scaleValue = scale[val];
|
20286 | }
|
20287 | result = scale.scale(scaleValue);
|
20288 | }
|
20289 | } else {
|
20290 | result = scale.scale(val);
|
20291 | }
|
20292 |
|
20293 | return result;
|
20294 | };
|
20295 |
|
20296 | |
20297 |
|
20298 |
|
20299 |
|
20300 |
|
20301 |
|
20302 |
|
20303 |
|
20304 |
|
20305 | Base.prototype.parsePoint = function parsePoint(coord, position) {
|
20306 | var self = this;
|
20307 | var xScales = self.xScales;
|
20308 | var yScales = self.yScales;
|
20309 | if (Util.isFunction(position)) {
|
20310 | position = position(xScales, yScales);
|
20311 | }
|
20312 |
|
20313 | var x = void 0;
|
20314 | var y = void 0;
|
20315 |
|
20316 |
|
20317 | if (Util.isArray(position) && Util.isString(position[0]) && position[0].indexOf('%') !== -1) {
|
20318 | return this.parsePercentPoint(coord, position);
|
20319 | }
|
20320 |
|
20321 | if (Util.isArray(position)) {
|
20322 |
|
20323 | x = self._getNormalizedValue(position[0], getFirstScale(xScales));
|
20324 | y = self._getNormalizedValue(position[1], getFirstScale(yScales));
|
20325 | } else {
|
20326 | for (var field in position) {
|
20327 | var value = position[field];
|
20328 | if (xScales[field]) {
|
20329 | x = self._getNormalizedValue(value, xScales[field]);
|
20330 | }
|
20331 |
|
20332 | if (yScales[field]) {
|
20333 | y = self._getNormalizedValue(value, yScales[field]);
|
20334 | }
|
20335 | }
|
20336 | }
|
20337 |
|
20338 | if (!Util.isNil(x) && !Util.isNil(y)) {
|
20339 | return coord.convert({
|
20340 | x: x,
|
20341 | y: y
|
20342 | });
|
20343 | }
|
20344 | };
|
20345 |
|
20346 |
|
20347 |
|
20348 | Base.prototype.parsePercentPoint = function parsePercentPoint(coord, position) {
|
20349 | var xPercent = parseFloat(position[0]) / 100;
|
20350 | var yPercent = parseFloat(position[1]) / 100;
|
20351 | var start = coord.start;
|
20352 | var end = coord.end;
|
20353 | var topLeft = {
|
20354 | x: Math.min(start.x, end.x),
|
20355 | y: Math.min(start.y, end.y)
|
20356 | };
|
20357 | var x = coord.width * xPercent + topLeft.x;
|
20358 | var y = coord.height * yPercent + topLeft.y;
|
20359 | return {
|
20360 | x: x,
|
20361 | y: y
|
20362 | };
|
20363 | };
|
20364 |
|
20365 | |
20366 |
|
20367 |
|
20368 |
|
20369 |
|
20370 |
|
20371 | Base.prototype.setVisible = function setVisible(visible) {
|
20372 | var el = this.el;
|
20373 | if (el) {
|
20374 | if (el.set) {
|
20375 | el.set('visible', visible);
|
20376 | } else {
|
20377 | el.style.display = visible ? '' : 'none';
|
20378 | }
|
20379 | }
|
20380 | };
|
20381 |
|
20382 | |
20383 |
|
20384 |
|
20385 |
|
20386 |
|
20387 |
|
20388 | Base.prototype.render = function render() {};
|
20389 |
|
20390 | |
20391 |
|
20392 |
|
20393 |
|
20394 |
|
20395 | Base.prototype.remove = function remove() {
|
20396 | var self = this;
|
20397 | var el = self.el;
|
20398 | if (el) {
|
20399 | el.remove();
|
20400 | }
|
20401 | };
|
20402 |
|
20403 | return Base;
|
20404 | }();
|
20405 |
|
20406 | module.exports = Base;
|
20407 |
|
20408 | }),
|
20409 |
|
20410 | (function(module, exports) {
|
20411 |
|
20412 |
|
20413 | var objectProto = Object.prototype;
|
20414 |
|
20415 |
|
20416 |
|
20417 |
|
20418 |
|
20419 |
|
20420 |
|
20421 |
|
20422 | function isPrototype(value) {
|
20423 | var Ctor = value && value.constructor,
|
20424 | proto = typeof Ctor == 'function' && Ctor.prototype || objectProto;
|
20425 |
|
20426 | return value === proto;
|
20427 | }
|
20428 |
|
20429 | module.exports = isPrototype;
|
20430 |
|
20431 | }),
|
20432 |
|
20433 | (function(module, exports, __webpack_require__) {
|
20434 |
|
20435 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
20436 |
|
20437 | var baseMatches = __webpack_require__(143),
|
20438 | baseMatchesProperty = __webpack_require__(181),
|
20439 | identity = __webpack_require__(31),
|
20440 | isArray = __webpack_require__(3),
|
20441 | property = __webpack_require__(189);
|
20442 |
|
20443 |
|
20444 |
|
20445 |
|
20446 |
|
20447 |
|
20448 |
|
20449 |
|
20450 | function baseIteratee(value) {
|
20451 |
|
20452 |
|
20453 | if (typeof value == 'function') {
|
20454 | return value;
|
20455 | }
|
20456 | if (value == null) {
|
20457 | return identity;
|
20458 | }
|
20459 | if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object') {
|
20460 | return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
|
20461 | }
|
20462 | return property(value);
|
20463 | }
|
20464 |
|
20465 | module.exports = baseIteratee;
|
20466 |
|
20467 | }),
|
20468 |
|
20469 | (function(module, exports) {
|
20470 |
|
20471 |
|
20472 |
|
20473 |
|
20474 |
|
20475 |
|
20476 |
|
20477 |
|
20478 | function setToArray(set) {
|
20479 | var index = -1,
|
20480 | result = Array(set.size);
|
20481 |
|
20482 | set.forEach(function (value) {
|
20483 | result[++index] = value;
|
20484 | });
|
20485 | return result;
|
20486 | }
|
20487 |
|
20488 | module.exports = setToArray;
|
20489 |
|
20490 | }),
|
20491 |
|
20492 | (function(module, exports, __webpack_require__) {
|
20493 |
|
20494 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
20495 |
|
20496 | var baseGetTag = __webpack_require__(6),
|
20497 | isObjectLike = __webpack_require__(5);
|
20498 |
|
20499 |
|
20500 | var symbolTag = '[object Symbol]';
|
20501 |
|
20502 |
|
20503 |
|
20504 |
|
20505 |
|
20506 |
|
20507 |
|
20508 |
|
20509 |
|
20510 |
|
20511 |
|
20512 |
|
20513 |
|
20514 |
|
20515 |
|
20516 |
|
20517 |
|
20518 |
|
20519 | function isSymbol(value) {
|
20520 | return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
20521 | }
|
20522 |
|
20523 | module.exports = isSymbol;
|
20524 |
|
20525 | }),
|
20526 |
|
20527 | (function(module, exports, __webpack_require__) {
|
20528 |
|
20529 | var isSymbol = __webpack_require__(21);
|
20530 |
|
20531 |
|
20532 | var INFINITY = 1 / 0;
|
20533 |
|
20534 |
|
20535 |
|
20536 |
|
20537 |
|
20538 |
|
20539 |
|
20540 |
|
20541 | function toKey(value) {
|
20542 | if (typeof value == 'string' || isSymbol(value)) {
|
20543 | return value;
|
20544 | }
|
20545 | var result = value + '';
|
20546 | return result == '0' && 1 / value == -INFINITY ? '-0' : result;
|
20547 | }
|
20548 |
|
20549 | module.exports = toKey;
|
20550 |
|
20551 | }),
|
20552 |
|
20553 | (function(module, exports, __webpack_require__) {
|
20554 |
|
20555 | var assignValue = __webpack_require__(40),
|
20556 | baseAssignValue = __webpack_require__(61);
|
20557 |
|
20558 |
|
20559 |
|
20560 |
|
20561 |
|
20562 |
|
20563 |
|
20564 |
|
20565 |
|
20566 |
|
20567 |
|
20568 | function copyObject(source, props, object, customizer) {
|
20569 | var isNew = !object;
|
20570 | object || (object = {});
|
20571 |
|
20572 | var index = -1,
|
20573 | length = props.length;
|
20574 |
|
20575 | while (++index < length) {
|
20576 | var key = props[index];
|
20577 |
|
20578 | var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
|
20579 |
|
20580 | if (newValue === undefined) {
|
20581 | newValue = source[key];
|
20582 | }
|
20583 | if (isNew) {
|
20584 | baseAssignValue(object, key, newValue);
|
20585 | } else {
|
20586 | assignValue(object, key, newValue);
|
20587 | }
|
20588 | }
|
20589 | return object;
|
20590 | }
|
20591 |
|
20592 | module.exports = copyObject;
|
20593 |
|
20594 | }),
|
20595 |
|
20596 | (function(module, exports, __webpack_require__) {
|
20597 |
|
20598 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20599 |
|
20600 |
|
20601 |
|
20602 |
|
20603 |
|
20604 |
|
20605 | var Util = __webpack_require__(0);
|
20606 | var DEFAULT_Y = 0;
|
20607 |
|
20608 |
|
20609 |
|
20610 |
|
20611 |
|
20612 |
|
20613 | var Adjust = function () {
|
20614 | |
20615 |
|
20616 |
|
20617 |
|
20618 |
|
20619 | Adjust.prototype.getDefaultCfg = function getDefaultCfg() {
|
20620 | return {
|
20621 | |
20622 |
|
20623 |
|
20624 |
|
20625 | xField: null,
|
20626 | |
20627 |
|
20628 |
|
20629 |
|
20630 | yField: null,
|
20631 |
|
20632 | |
20633 |
|
20634 |
|
20635 |
|
20636 | adjustNames: ['x', 'y'],
|
20637 |
|
20638 | |
20639 |
|
20640 |
|
20641 |
|
20642 | groupFields: null
|
20643 | };
|
20644 | };
|
20645 |
|
20646 | function Adjust(cfg) {
|
20647 | _classCallCheck(this, Adjust);
|
20648 |
|
20649 | var defaultCfg = this.getDefaultCfg();
|
20650 | Util.assign(this, defaultCfg, cfg);
|
20651 | }
|
20652 |
|
20653 | |
20654 |
|
20655 |
|
20656 |
|
20657 |
|
20658 |
|
20659 |
|
20660 |
|
20661 | Adjust.prototype.isAdjust = function isAdjust(dimName) {
|
20662 | return this.adjustNames.indexOf(dimName) >= 0;
|
20663 | };
|
20664 |
|
20665 | |
20666 |
|
20667 |
|
20668 |
|
20669 |
|
20670 |
|
20671 |
|
20672 | Adjust.prototype.processAdjust = function processAdjust(dataArray) {
|
20673 | var self = this;
|
20674 | var mergeData = Util.Array.merge(dataArray);
|
20675 |
|
20676 | self.adjDataArray = dataArray;
|
20677 | self.mergeData = mergeData;
|
20678 | self.adjustData(dataArray, mergeData);
|
20679 | self.adjFrames = null;
|
20680 | self.mergeData = null;
|
20681 | };
|
20682 |
|
20683 | |
20684 |
|
20685 |
|
20686 |
|
20687 |
|
20688 |
|
20689 |
|
20690 |
|
20691 | Adjust.prototype._getDimValues = function _getDimValues(mergeData) {
|
20692 | var self = this;
|
20693 | var valuesMap = {};
|
20694 | var dims = [];
|
20695 | if (self.xField && self.isAdjust('x')) {
|
20696 | dims.push(self.xField);
|
20697 | }
|
20698 | if (self.yField && self.isAdjust('y')) {
|
20699 | dims.push(self.yField);
|
20700 | }
|
20701 | Util.each(dims, function (dim) {
|
20702 | var values = Util.Array.values(mergeData, dim);
|
20703 | values.sort(function (v1, v2) {
|
20704 | return v1 - v2;
|
20705 | });
|
20706 | valuesMap[dim] = values;
|
20707 | });
|
20708 | if (!self.yField && self.isAdjust('y')) {
|
20709 |
|
20710 | var dim = 'y';
|
20711 | var values = [DEFAULT_Y, 1];
|
20712 | valuesMap[dim] = values;
|
20713 | }
|
20714 | return valuesMap;
|
20715 | };
|
20716 |
|
20717 | Adjust.prototype.adjustData = function adjustData(dataArray, mergeData) {
|
20718 | var self = this;
|
20719 | var valuesMap = self._getDimValues(mergeData);
|
20720 | Util.each(dataArray, function (data, index) {
|
20721 |
|
20722 | Util.each(valuesMap, function (values, dim) {
|
20723 |
|
20724 | self.adjustDim(dim, values, data, dataArray.length, index);
|
20725 | });
|
20726 | });
|
20727 | };
|
20728 |
|
20729 | Adjust.prototype.adjustDim = function adjustDim() /* dim, values, data, length, index */{};
|
20730 |
|
20731 | Adjust.prototype.getAdjustRange = function getAdjustRange(dim, key, values) {
|
20732 | var self = this;
|
20733 | var index = values.indexOf(key);
|
20734 | var length = values.length;
|
20735 | var pre = void 0;
|
20736 | var next = void 0;
|
20737 | if (!self.yField && self.isAdjust('y')) {
|
20738 | pre = 0;
|
20739 | next = 1;
|
20740 | } else if (length > 1) {
|
20741 | pre = index === 0 ? values[0] : values[index - 1];
|
20742 | next = index === length - 1 ? values[length - 1] : values[index + 1];
|
20743 |
|
20744 | if (index !== 0) {
|
20745 | pre += (key - pre) / 2;
|
20746 | } else {
|
20747 | pre -= (next - key) / 2;
|
20748 | }
|
20749 | if (index !== length - 1) {
|
20750 | next -= (next - key) / 2;
|
20751 | } else {
|
20752 | next += (key - values[length - 2]) / 2;
|
20753 | }
|
20754 | } else {
|
20755 | pre = key === 0 ? 0 : key - 0.5;
|
20756 | next = key === 0 ? 1 : key + 0.5;
|
20757 | }
|
20758 |
|
20759 | return {
|
20760 | pre: pre,
|
20761 | next: next
|
20762 | };
|
20763 | };
|
20764 |
|
20765 | |
20766 |
|
20767 |
|
20768 |
|
20769 |
|
20770 |
|
20771 |
|
20772 |
|
20773 | Adjust.prototype.groupData = function groupData(data, dim) {
|
20774 | var groups = {};
|
20775 |
|
20776 | Util.each(data, function (record) {
|
20777 | var value = record[dim];
|
20778 | if (value === undefined) {
|
20779 | value = record[dim] = DEFAULT_Y;
|
20780 | }
|
20781 | if (!groups[value]) {
|
20782 | groups[value] = [];
|
20783 | }
|
20784 | groups[value].push(record);
|
20785 | });
|
20786 |
|
20787 | return groups;
|
20788 | };
|
20789 |
|
20790 | return Adjust;
|
20791 | }();
|
20792 |
|
20793 | module.exports = Adjust;
|
20794 |
|
20795 | }),
|
20796 |
|
20797 | (function(module, exports, __webpack_require__) {
|
20798 |
|
20799 |
|
20800 |
|
20801 |
|
20802 |
|
20803 | module.exports = {
|
20804 | Axis: __webpack_require__(335),
|
20805 | Guide: __webpack_require__(341),
|
20806 | Label: __webpack_require__(65),
|
20807 | Legend: __webpack_require__(348),
|
20808 | Plot: __webpack_require__(353),
|
20809 | Tooltip: __webpack_require__(354)
|
20810 | };
|
20811 |
|
20812 | }),
|
20813 |
|
20814 | (function(module, exports) {
|
20815 |
|
20816 | module.exports = function (module) {
|
20817 | if (!module.webpackPolyfill) {
|
20818 | module.deprecate = function () {};
|
20819 | module.paths = [];
|
20820 |
|
20821 | if (!module.children) module.children = [];
|
20822 | Object.defineProperty(module, "loaded", {
|
20823 | enumerable: true,
|
20824 | get: function get() {
|
20825 | return module.l;
|
20826 | }
|
20827 | });
|
20828 | Object.defineProperty(module, "id", {
|
20829 | enumerable: true,
|
20830 | get: function get() {
|
20831 | return module.i;
|
20832 | }
|
20833 | });
|
20834 | module.webpackPolyfill = 1;
|
20835 | }
|
20836 | return module;
|
20837 | };
|
20838 |
|
20839 | }),
|
20840 |
|
20841 | (function(module, exports, __webpack_require__) {
|
20842 |
|
20843 | var baseForOwn = __webpack_require__(129),
|
20844 | createBaseEach = __webpack_require__(140);
|
20845 |
|
20846 |
|
20847 |
|
20848 |
|
20849 |
|
20850 |
|
20851 |
|
20852 |
|
20853 |
|
20854 | var baseEach = createBaseEach(baseForOwn);
|
20855 |
|
20856 | module.exports = baseEach;
|
20857 |
|
20858 | }),
|
20859 |
|
20860 | (function(module, exports, __webpack_require__) {
|
20861 |
|
20862 | var baseIsArguments = __webpack_require__(133),
|
20863 | isObjectLike = __webpack_require__(5);
|
20864 |
|
20865 |
|
20866 | var objectProto = Object.prototype;
|
20867 |
|
20868 |
|
20869 | var hasOwnProperty = objectProto.hasOwnProperty;
|
20870 |
|
20871 |
|
20872 | var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
20873 |
|
20874 |
|
20875 |
|
20876 |
|
20877 |
|
20878 |
|
20879 |
|
20880 |
|
20881 |
|
20882 |
|
20883 |
|
20884 |
|
20885 |
|
20886 |
|
20887 |
|
20888 |
|
20889 |
|
20890 |
|
20891 |
|
20892 | var isArguments = baseIsArguments(function () {
|
20893 | return arguments;
|
20894 | }()) ? baseIsArguments : function (value) {
|
20895 | return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
|
20896 | };
|
20897 |
|
20898 | module.exports = isArguments;
|
20899 |
|
20900 | }),
|
20901 |
|
20902 | (function(module, exports, __webpack_require__) {
|
20903 |
|
20904 | (function(module) {var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
20905 |
|
20906 | var root = __webpack_require__(4),
|
20907 | stubFalse = __webpack_require__(137);
|
20908 |
|
20909 |
|
20910 | var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
|
20911 |
|
20912 |
|
20913 | var freeModule = freeExports && ( false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
|
20914 |
|
20915 |
|
20916 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
20917 |
|
20918 |
|
20919 | var Buffer = moduleExports ? root.Buffer : undefined;
|
20920 |
|
20921 |
|
20922 | var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
20923 |
|
20924 |
|
20925 |
|
20926 |
|
20927 |
|
20928 |
|
20929 |
|
20930 |
|
20931 |
|
20932 |
|
20933 |
|
20934 |
|
20935 |
|
20936 |
|
20937 |
|
20938 |
|
20939 |
|
20940 |
|
20941 | var isBuffer = nativeIsBuffer || stubFalse;
|
20942 |
|
20943 | module.exports = isBuffer;
|
20944 | }.call(exports, __webpack_require__(26)(module)))
|
20945 |
|
20946 | }),
|
20947 |
|
20948 | (function(module, exports) {
|
20949 |
|
20950 |
|
20951 | var MAX_SAFE_INTEGER = 9007199254740991;
|
20952 |
|
20953 |
|
20954 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
20955 |
|
20956 |
|
20957 |
|
20958 |
|
20959 |
|
20960 |
|
20961 |
|
20962 |
|
20963 |
|
20964 | function isIndex(value, length) {
|
20965 | length = length == null ? MAX_SAFE_INTEGER : length;
|
20966 | return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
|
20967 | }
|
20968 |
|
20969 | module.exports = isIndex;
|
20970 |
|
20971 | }),
|
20972 |
|
20973 | (function(module, exports) {
|
20974 |
|
20975 |
|
20976 |
|
20977 |
|
20978 |
|
20979 |
|
20980 |
|
20981 |
|
20982 |
|
20983 |
|
20984 |
|
20985 |
|
20986 |
|
20987 |
|
20988 |
|
20989 |
|
20990 |
|
20991 | function identity(value) {
|
20992 | return value;
|
20993 | }
|
20994 |
|
20995 | module.exports = identity;
|
20996 |
|
20997 | }),
|
20998 |
|
20999 | (function(module, exports, __webpack_require__) {
|
21000 |
|
21001 | var listCacheClear = __webpack_require__(145),
|
21002 | listCacheDelete = __webpack_require__(146),
|
21003 | listCacheGet = __webpack_require__(147),
|
21004 | listCacheHas = __webpack_require__(148),
|
21005 | listCacheSet = __webpack_require__(149);
|
21006 |
|
21007 |
|
21008 |
|
21009 |
|
21010 |
|
21011 |
|
21012 |
|
21013 |
|
21014 | function ListCache(entries) {
|
21015 | var index = -1,
|
21016 | length = entries == null ? 0 : entries.length;
|
21017 |
|
21018 | this.clear();
|
21019 | while (++index < length) {
|
21020 | var entry = entries[index];
|
21021 | this.set(entry[0], entry[1]);
|
21022 | }
|
21023 | }
|
21024 |
|
21025 |
|
21026 | ListCache.prototype.clear = listCacheClear;
|
21027 | ListCache.prototype['delete'] = listCacheDelete;
|
21028 | ListCache.prototype.get = listCacheGet;
|
21029 | ListCache.prototype.has = listCacheHas;
|
21030 | ListCache.prototype.set = listCacheSet;
|
21031 |
|
21032 | module.exports = ListCache;
|
21033 |
|
21034 | }),
|
21035 |
|
21036 | (function(module, exports, __webpack_require__) {
|
21037 |
|
21038 | var eq = __webpack_require__(34);
|
21039 |
|
21040 |
|
21041 |
|
21042 |
|
21043 |
|
21044 |
|
21045 |
|
21046 |
|
21047 |
|
21048 | function assocIndexOf(array, key) {
|
21049 | var length = array.length;
|
21050 | while (length--) {
|
21051 | if (eq(array[length][0], key)) {
|
21052 | return length;
|
21053 | }
|
21054 | }
|
21055 | return -1;
|
21056 | }
|
21057 |
|
21058 | module.exports = assocIndexOf;
|
21059 |
|
21060 | }),
|
21061 |
|
21062 | (function(module, exports) {
|
21063 |
|
21064 |
|
21065 |
|
21066 |
|
21067 |
|
21068 |
|
21069 |
|
21070 |
|
21071 |
|
21072 |
|
21073 |
|
21074 |
|
21075 |
|
21076 |
|
21077 |
|
21078 |
|
21079 |
|
21080 |
|
21081 |
|
21082 |
|
21083 |
|
21084 |
|
21085 |
|
21086 |
|
21087 |
|
21088 |
|
21089 |
|
21090 |
|
21091 |
|
21092 |
|
21093 |
|
21094 |
|
21095 |
|
21096 | function eq(value, other) {
|
21097 | return value === other || value !== value && other !== other;
|
21098 | }
|
21099 |
|
21100 | module.exports = eq;
|
21101 |
|
21102 | }),
|
21103 |
|
21104 | (function(module, exports, __webpack_require__) {
|
21105 |
|
21106 | var getNative = __webpack_require__(13);
|
21107 |
|
21108 |
|
21109 | var nativeCreate = getNative(Object, 'create');
|
21110 |
|
21111 | module.exports = nativeCreate;
|
21112 |
|
21113 | }),
|
21114 |
|
21115 | (function(module, exports, __webpack_require__) {
|
21116 |
|
21117 | var isKeyable = __webpack_require__(167);
|
21118 |
|
21119 |
|
21120 |
|
21121 |
|
21122 |
|
21123 |
|
21124 |
|
21125 |
|
21126 |
|
21127 | function getMapData(map, key) {
|
21128 | var data = map.__data__;
|
21129 | return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
|
21130 | }
|
21131 |
|
21132 | module.exports = getMapData;
|
21133 |
|
21134 | }),
|
21135 |
|
21136 | (function(module, exports, __webpack_require__) {
|
21137 |
|
21138 | var baseIsEqualDeep = __webpack_require__(171),
|
21139 | isObjectLike = __webpack_require__(5);
|
21140 |
|
21141 |
|
21142 |
|
21143 |
|
21144 |
|
21145 |
|
21146 |
|
21147 |
|
21148 |
|
21149 |
|
21150 |
|
21151 |
|
21152 |
|
21153 |
|
21154 |
|
21155 | function baseIsEqual(value, other, bitmask, customizer, stack) {
|
21156 | if (value === other) {
|
21157 | return true;
|
21158 | }
|
21159 | if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
21160 | return value !== value && other !== other;
|
21161 | }
|
21162 | return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
21163 | }
|
21164 |
|
21165 | module.exports = baseIsEqual;
|
21166 |
|
21167 | }),
|
21168 |
|
21169 | (function(module, exports, __webpack_require__) {
|
21170 |
|
21171 | var DataView = __webpack_require__(177),
|
21172 | Map = __webpack_require__(51),
|
21173 | Promise = __webpack_require__(178),
|
21174 | Set = __webpack_require__(85),
|
21175 | WeakMap = __webpack_require__(179),
|
21176 | baseGetTag = __webpack_require__(6),
|
21177 | toSource = __webpack_require__(76);
|
21178 |
|
21179 |
|
21180 | var mapTag = '[object Map]',
|
21181 | objectTag = '[object Object]',
|
21182 | promiseTag = '[object Promise]',
|
21183 | setTag = '[object Set]',
|
21184 | weakMapTag = '[object WeakMap]';
|
21185 |
|
21186 | var dataViewTag = '[object DataView]';
|
21187 |
|
21188 |
|
21189 | var dataViewCtorString = toSource(DataView),
|
21190 | mapCtorString = toSource(Map),
|
21191 | promiseCtorString = toSource(Promise),
|
21192 | setCtorString = toSource(Set),
|
21193 | weakMapCtorString = toSource(WeakMap);
|
21194 |
|
21195 |
|
21196 |
|
21197 |
|
21198 |
|
21199 |
|
21200 |
|
21201 |
|
21202 | var getTag = baseGetTag;
|
21203 |
|
21204 |
|
21205 | if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
21206 | getTag = function getTag(value) {
|
21207 | var result = baseGetTag(value),
|
21208 | Ctor = result == objectTag ? value.constructor : undefined,
|
21209 | ctorString = Ctor ? toSource(Ctor) : '';
|
21210 |
|
21211 | if (ctorString) {
|
21212 | switch (ctorString) {
|
21213 | case dataViewCtorString:
|
21214 | return dataViewTag;
|
21215 | case mapCtorString:
|
21216 | return mapTag;
|
21217 | case promiseCtorString:
|
21218 | return promiseTag;
|
21219 | case setCtorString:
|
21220 | return setTag;
|
21221 | case weakMapCtorString:
|
21222 | return weakMapTag;
|
21223 | }
|
21224 | }
|
21225 | return result;
|
21226 | };
|
21227 | }
|
21228 |
|
21229 | module.exports = getTag;
|
21230 |
|
21231 | }),
|
21232 |
|
21233 | (function(module, exports, __webpack_require__) {
|
21234 |
|
21235 | var isArray = __webpack_require__(3),
|
21236 | isKey = __webpack_require__(57),
|
21237 | stringToPath = __webpack_require__(183),
|
21238 | toString = __webpack_require__(15);
|
21239 |
|
21240 |
|
21241 |
|
21242 |
|
21243 |
|
21244 |
|
21245 |
|
21246 |
|
21247 |
|
21248 | function castPath(value, object) {
|
21249 | if (isArray(value)) {
|
21250 | return value;
|
21251 | }
|
21252 | return isKey(value, object) ? [value] : stringToPath(toString(value));
|
21253 | }
|
21254 |
|
21255 | module.exports = castPath;
|
21256 |
|
21257 | }),
|
21258 |
|
21259 | (function(module, exports, __webpack_require__) {
|
21260 |
|
21261 | var baseAssignValue = __webpack_require__(61),
|
21262 | eq = __webpack_require__(34);
|
21263 |
|
21264 |
|
21265 | var objectProto = Object.prototype;
|
21266 |
|
21267 |
|
21268 | var hasOwnProperty = objectProto.hasOwnProperty;
|
21269 |
|
21270 |
|
21271 |
|
21272 |
|
21273 |
|
21274 |
|
21275 |
|
21276 |
|
21277 |
|
21278 |
|
21279 |
|
21280 | function assignValue(object, key, value) {
|
21281 | var objValue = object[key];
|
21282 | if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
|
21283 | baseAssignValue(object, key, value);
|
21284 | }
|
21285 | }
|
21286 |
|
21287 | module.exports = assignValue;
|
21288 |
|
21289 | }),
|
21290 |
|
21291 | (function(module, exports, __webpack_require__) {
|
21292 |
|
21293 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
21294 |
|
21295 |
|
21296 |
|
21297 |
|
21298 |
|
21299 |
|
21300 | var Util = __webpack_require__(0);
|
21301 |
|
21302 |
|
21303 |
|
21304 |
|
21305 |
|
21306 |
|
21307 | var Scale = function () {
|
21308 |
|
21309 | |
21310 |
|
21311 |
|
21312 |
|
21313 |
|
21314 | Scale.prototype.getDefaultCfg = function getDefaultCfg() {
|
21315 | return {
|
21316 | |
21317 |
|
21318 |
|
21319 |
|
21320 | type: 'base',
|
21321 |
|
21322 | |
21323 |
|
21324 |
|
21325 |
|
21326 | formatter: null,
|
21327 |
|
21328 | |
21329 |
|
21330 |
|
21331 |
|
21332 | range: [0, 1],
|
21333 |
|
21334 | |
21335 |
|
21336 |
|
21337 |
|
21338 | ticks: null,
|
21339 |
|
21340 | |
21341 |
|
21342 |
|
21343 |
|
21344 | values: []
|
21345 | };
|
21346 | };
|
21347 |
|
21348 | function Scale(cfg) {
|
21349 | _classCallCheck(this, Scale);
|
21350 |
|
21351 | var defaultCfg = this.getDefaultCfg();
|
21352 | Util.mix(this, defaultCfg, cfg);
|
21353 | this.init();
|
21354 | }
|
21355 |
|
21356 | |
21357 |
|
21358 |
|
21359 |
|
21360 |
|
21361 |
|
21362 | Scale.prototype.init = function init() {};
|
21363 |
|
21364 | |
21365 |
|
21366 |
|
21367 |
|
21368 |
|
21369 |
|
21370 |
|
21371 |
|
21372 |
|
21373 |
|
21374 |
|
21375 |
|
21376 |
|
21377 |
|
21378 |
|
21379 |
|
21380 |
|
21381 |
|
21382 |
|
21383 | Scale.prototype.getTicks = function getTicks() {
|
21384 | var self = this;
|
21385 | var ticks = self.ticks;
|
21386 | var rst = [];
|
21387 | Util.each(ticks, function (tick) {
|
21388 | var obj = void 0;
|
21389 | if (Util.isObject(tick)) {
|
21390 | obj = tick;
|
21391 | } else {
|
21392 | obj = {
|
21393 | text: self.getText(tick),
|
21394 | tickValue: tick,
|
21395 | value: self.scale(tick)
|
21396 | };
|
21397 | }
|
21398 | rst.push(obj);
|
21399 | });
|
21400 | return rst;
|
21401 | };
|
21402 |
|
21403 | |
21404 |
|
21405 |
|
21406 |
|
21407 |
|
21408 |
|
21409 |
|
21410 | Scale.prototype.getText = function getText(value) {
|
21411 | var formatter = this.formatter;
|
21412 | value = formatter ? formatter(value) : value;
|
21413 | if (Util.isNil(value) || !value.toString) {
|
21414 | value = '';
|
21415 | }
|
21416 | return value.toString();
|
21417 | };
|
21418 | |
21419 |
|
21420 |
|
21421 |
|
21422 |
|
21423 |
|
21424 |
|
21425 | Scale.prototype.rangeMin = function rangeMin() {
|
21426 | return this.range[0];
|
21427 | };
|
21428 | |
21429 |
|
21430 |
|
21431 |
|
21432 |
|
21433 |
|
21434 |
|
21435 | Scale.prototype.rangeMax = function rangeMax() {
|
21436 | var range = this.range;
|
21437 | return range[range.length - 1];
|
21438 | };
|
21439 |
|
21440 | |
21441 |
|
21442 |
|
21443 |
|
21444 |
|
21445 |
|
21446 |
|
21447 | Scale.prototype.invert = function invert(value) {
|
21448 | return value;
|
21449 | };
|
21450 | |
21451 |
|
21452 |
|
21453 |
|
21454 |
|
21455 |
|
21456 |
|
21457 | Scale.prototype.translate = function translate(value) {
|
21458 | return value;
|
21459 | };
|
21460 | |
21461 |
|
21462 |
|
21463 |
|
21464 |
|
21465 |
|
21466 |
|
21467 | Scale.prototype.scale = function scale(value) {
|
21468 | return value;
|
21469 | };
|
21470 | |
21471 |
|
21472 |
|
21473 |
|
21474 |
|
21475 |
|
21476 | Scale.prototype.clone = function clone() {
|
21477 | var self = this;
|
21478 | var constr = self.constructor;
|
21479 | var cfg = {};
|
21480 | Util.each(self, function (v, k) {
|
21481 | cfg[k] = self[k];
|
21482 | });
|
21483 | return new constr(cfg);
|
21484 | };
|
21485 | |
21486 |
|
21487 |
|
21488 |
|
21489 |
|
21490 |
|
21491 |
|
21492 |
|
21493 | Scale.prototype.change = function change(info) {
|
21494 | this.ticks = null;
|
21495 | Util.mix(this, info);
|
21496 | this.init();
|
21497 | return this;
|
21498 | };
|
21499 |
|
21500 | return Scale;
|
21501 | }();
|
21502 |
|
21503 | module.exports = Scale;
|
21504 |
|
21505 | }),
|
21506 |
|
21507 | (function(module, exports, __webpack_require__) {
|
21508 |
|
21509 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
21510 |
|
21511 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
21512 |
|
21513 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
21514 |
|
21515 |
|
21516 |
|
21517 |
|
21518 |
|
21519 |
|
21520 | var Base = __webpack_require__(41);
|
21521 | var Util = __webpack_require__(0);
|
21522 | var numberAuto = __webpack_require__(322);
|
21523 |
|
21524 |
|
21525 |
|
21526 |
|
21527 |
|
21528 |
|
21529 | var Linear = function (_Base) {
|
21530 | _inherits(Linear, _Base);
|
21531 |
|
21532 | function Linear() {
|
21533 | _classCallCheck(this, Linear);
|
21534 |
|
21535 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
21536 | }
|
21537 |
|
21538 | |
21539 |
|
21540 |
|
21541 | Linear.prototype.getDefaultCfg = function getDefaultCfg() {
|
21542 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
21543 | return Util.mix({}, cfg, {
|
21544 | |
21545 |
|
21546 |
|
21547 |
|
21548 | type: 'linear',
|
21549 |
|
21550 | |
21551 |
|
21552 |
|
21553 |
|
21554 |
|
21555 |
|
21556 | isLinear: true,
|
21557 |
|
21558 | |
21559 |
|
21560 |
|
21561 |
|
21562 |
|
21563 | min: null,
|
21564 |
|
21565 | |
21566 |
|
21567 |
|
21568 |
|
21569 |
|
21570 | minLimit: null,
|
21571 |
|
21572 | |
21573 |
|
21574 |
|
21575 |
|
21576 |
|
21577 | max: null,
|
21578 |
|
21579 | |
21580 |
|
21581 |
|
21582 |
|
21583 |
|
21584 | maxLimit: null,
|
21585 |
|
21586 | |
21587 |
|
21588 |
|
21589 |
|
21590 |
|
21591 | nice: false,
|
21592 |
|
21593 | |
21594 |
|
21595 |
|
21596 |
|
21597 |
|
21598 | tickCount: null,
|
21599 |
|
21600 | |
21601 |
|
21602 |
|
21603 |
|
21604 |
|
21605 | tickInterval: null,
|
21606 |
|
21607 | |
21608 |
|
21609 |
|
21610 |
|
21611 | snapArray: null
|
21612 | });
|
21613 | };
|
21614 | |
21615 |
|
21616 |
|
21617 |
|
21618 |
|
21619 |
|
21620 | Linear.prototype.init = function init() {
|
21621 | var self = this;
|
21622 | if (!self.ticks) {
|
21623 | self.min = self.translate(self.min);
|
21624 | self.max = self.translate(self.max);
|
21625 | self.initTicks();
|
21626 | } else {
|
21627 | var ticks = self.ticks;
|
21628 | var firstValue = self.translate(ticks[0]);
|
21629 | var lastValue = self.translate(ticks[ticks.length - 1]);
|
21630 | if (Util.isNil(self.min) || self.min > firstValue) {
|
21631 | self.min = firstValue;
|
21632 | }
|
21633 | if (Util.isNil(self.max) || self.max < lastValue) {
|
21634 | self.max = lastValue;
|
21635 | }
|
21636 | }
|
21637 | };
|
21638 |
|
21639 | |
21640 |
|
21641 |
|
21642 |
|
21643 |
|
21644 |
|
21645 |
|
21646 | Linear.prototype.calculateTicks = function calculateTicks() {
|
21647 | var self = this;
|
21648 | var min = self.min;
|
21649 | var max = self.max;
|
21650 | var count = self.tickCount;
|
21651 | var interval = self.tickInterval;
|
21652 | if (max < min) {
|
21653 | throw new Error('max: ' + max + ' should not be less than min: ' + min);
|
21654 | }
|
21655 | var tmp = numberAuto({
|
21656 | min: min,
|
21657 | max: max,
|
21658 | minLimit: self.minLimit,
|
21659 | maxLimit: self.maxLimit,
|
21660 | minCount: count,
|
21661 | maxCount: count,
|
21662 | interval: interval,
|
21663 | snapArray: this.snapArray
|
21664 | });
|
21665 | return tmp.ticks;
|
21666 | };
|
21667 |
|
21668 |
|
21669 |
|
21670 |
|
21671 | Linear.prototype.initTicks = function initTicks() {
|
21672 | var self = this;
|
21673 | var calTicks = self.calculateTicks();
|
21674 | if (self.nice) {
|
21675 |
|
21676 | self.ticks = calTicks;
|
21677 | self.min = calTicks[0];
|
21678 | self.max = calTicks[calTicks.length - 1];
|
21679 | } else {
|
21680 | var ticks = [];
|
21681 | Util.each(calTicks, function (tick) {
|
21682 | if (tick >= self.min && tick <= self.max) {
|
21683 | ticks.push(tick);
|
21684 | }
|
21685 | });
|
21686 | self.ticks = ticks;
|
21687 | }
|
21688 | };
|
21689 |
|
21690 | |
21691 |
|
21692 |
|
21693 |
|
21694 |
|
21695 | Linear.prototype.scale = function scale(value) {
|
21696 | if (value === null || value === undefined) {
|
21697 | return NaN;
|
21698 | }
|
21699 | var max = this.max;
|
21700 | var min = this.min;
|
21701 | if (max === min) {
|
21702 | return 0;
|
21703 | }
|
21704 |
|
21705 | var percent = (value - min) / (max - min);
|
21706 | var rangeMin = this.rangeMin();
|
21707 | var rangeMax = this.rangeMax();
|
21708 | return rangeMin + percent * (rangeMax - rangeMin);
|
21709 | };
|
21710 |
|
21711 | |
21712 |
|
21713 |
|
21714 |
|
21715 |
|
21716 | Linear.prototype.invert = function invert(value) {
|
21717 | var percent = (value - this.rangeMin()) / (this.rangeMax() - this.rangeMin());
|
21718 | return this.min + percent * (this.max - this.min);
|
21719 | };
|
21720 |
|
21721 | return Linear;
|
21722 | }(Base);
|
21723 |
|
21724 | module.exports = Linear;
|
21725 |
|
21726 | }),
|
21727 |
|
21728 | (function(module, exports, __webpack_require__) {
|
21729 |
|
21730 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
21731 |
|
21732 |
|
21733 |
|
21734 |
|
21735 |
|
21736 | var Util = __webpack_require__(0);
|
21737 | var MatrixUtil = __webpack_require__(2).MatrixUtil;
|
21738 | var mat3 = MatrixUtil.mat3;
|
21739 | var vec3 = MatrixUtil.vec3;
|
21740 |
|
21741 | var Coord = function () {
|
21742 | |
21743 |
|
21744 |
|
21745 |
|
21746 |
|
21747 | Coord.prototype.getDefaultCfg = function getDefaultCfg() {
|
21748 | return {
|
21749 | |
21750 |
|
21751 |
|
21752 |
|
21753 | isTransposed: false,
|
21754 | |
21755 |
|
21756 |
|
21757 |
|
21758 | matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
|
21759 | };
|
21760 | };
|
21761 |
|
21762 | function Coord(cfg) {
|
21763 | _classCallCheck(this, Coord);
|
21764 |
|
21765 | var defaultCfg = this.getDefaultCfg();
|
21766 | Util.mix(this, defaultCfg, cfg);
|
21767 | this.init();
|
21768 | }
|
21769 |
|
21770 | Coord.prototype.init = function init() {
|
21771 | var start = this.start;
|
21772 | var end = this.end;
|
21773 | var center = {
|
21774 | x: (start.x + end.x) / 2,
|
21775 | y: (start.y + end.y) / 2
|
21776 | };
|
21777 |
|
21778 | this.center = center;
|
21779 | this.width = Math.abs(end.x - start.x);
|
21780 | this.height = Math.abs(end.y - start.y);
|
21781 | };
|
21782 |
|
21783 | Coord.prototype._swapDim = function _swapDim(dim) {
|
21784 | var dimRange = this[dim];
|
21785 | if (dimRange) {
|
21786 | var tmp = dimRange.start;
|
21787 | dimRange.start = dimRange.end;
|
21788 | dimRange.end = tmp;
|
21789 | }
|
21790 | };
|
21791 |
|
21792 | Coord.prototype.getCenter = function getCenter() {
|
21793 | return this.center;
|
21794 | };
|
21795 |
|
21796 | Coord.prototype.getWidth = function getWidth() {
|
21797 | return this.width;
|
21798 | };
|
21799 |
|
21800 | Coord.prototype.getHeight = function getHeight() {
|
21801 | return this.height;
|
21802 | };
|
21803 |
|
21804 | Coord.prototype.convertDim = function convertDim(percent, dim) {
|
21805 | var _dim = this[dim],
|
21806 | start = _dim.start,
|
21807 | end = _dim.end;
|
21808 |
|
21809 | return start + percent * (end - start);
|
21810 | };
|
21811 |
|
21812 | Coord.prototype.invertDim = function invertDim(value, dim) {
|
21813 | var _dim2 = this[dim],
|
21814 | start = _dim2.start,
|
21815 | end = _dim2.end;
|
21816 |
|
21817 | return (value - start) / (end - start);
|
21818 | };
|
21819 |
|
21820 | |
21821 |
|
21822 |
|
21823 |
|
21824 |
|
21825 |
|
21826 |
|
21827 |
|
21828 | Coord.prototype.convertPoint = function convertPoint(point) {
|
21829 | return point;
|
21830 | };
|
21831 |
|
21832 | |
21833 |
|
21834 |
|
21835 |
|
21836 |
|
21837 |
|
21838 |
|
21839 |
|
21840 | Coord.prototype.invertPoint = function invertPoint(point) {
|
21841 | return point;
|
21842 | };
|
21843 |
|
21844 | |
21845 |
|
21846 |
|
21847 |
|
21848 |
|
21849 |
|
21850 |
|
21851 |
|
21852 |
|
21853 | Coord.prototype.applyMatrix = function applyMatrix(x, y) {
|
21854 | var tag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
21855 |
|
21856 | var matrix = this.matrix;
|
21857 | var vector = [x, y, tag];
|
21858 | vec3.transformMat3(vector, vector, matrix);
|
21859 | return vector;
|
21860 | };
|
21861 |
|
21862 | |
21863 |
|
21864 |
|
21865 |
|
21866 |
|
21867 |
|
21868 |
|
21869 |
|
21870 |
|
21871 | Coord.prototype.invertMatrix = function invertMatrix(x, y) {
|
21872 | var tag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
21873 |
|
21874 | var matrix = this.matrix;
|
21875 | var inversedMatrix = mat3.invert([], matrix);
|
21876 | var vector = [x, y, tag];
|
21877 | vec3.transformMat3(vector, vector, inversedMatrix);
|
21878 | return vector;
|
21879 | };
|
21880 |
|
21881 | |
21882 |
|
21883 |
|
21884 |
|
21885 |
|
21886 |
|
21887 |
|
21888 | Coord.prototype.convert = function convert(point) {
|
21889 | var _convertPoint = this.convertPoint(point),
|
21890 | x = _convertPoint.x,
|
21891 | y = _convertPoint.y;
|
21892 |
|
21893 | var vector = this.applyMatrix(x, y, 1);
|
21894 | return {
|
21895 | x: vector[0],
|
21896 | y: vector[1]
|
21897 | };
|
21898 | };
|
21899 |
|
21900 | |
21901 |
|
21902 |
|
21903 |
|
21904 |
|
21905 |
|
21906 |
|
21907 | Coord.prototype.invert = function invert(point) {
|
21908 | var vector = this.invertMatrix(point.x, point.y, 1);
|
21909 | return this.invertPoint({
|
21910 | x: vector[0],
|
21911 | y: vector[1]
|
21912 | });
|
21913 | };
|
21914 |
|
21915 | |
21916 |
|
21917 |
|
21918 |
|
21919 |
|
21920 |
|
21921 |
|
21922 | Coord.prototype.rotate = function rotate(radian) {
|
21923 | var matrix = this.matrix;
|
21924 | var center = this.center;
|
21925 | mat3.translate(matrix, matrix, [-center.x, -center.y]);
|
21926 | mat3.rotate(matrix, matrix, radian);
|
21927 | mat3.translate(matrix, matrix, [center.x, center.y]);
|
21928 | return this;
|
21929 | };
|
21930 |
|
21931 | |
21932 |
|
21933 |
|
21934 |
|
21935 |
|
21936 |
|
21937 |
|
21938 | Coord.prototype.reflect = function reflect(dim) {
|
21939 | switch (dim) {
|
21940 | case 'x':
|
21941 | this._swapDim('x');
|
21942 | break;
|
21943 | case 'y':
|
21944 | this._swapDim('y');
|
21945 | break;
|
21946 | default:
|
21947 | this._swapDim('y');
|
21948 | }
|
21949 | return this;
|
21950 | };
|
21951 |
|
21952 | |
21953 |
|
21954 |
|
21955 |
|
21956 |
|
21957 |
|
21958 |
|
21959 |
|
21960 | Coord.prototype.scale = function scale(s1, s2) {
|
21961 | var matrix = this.matrix;
|
21962 | var center = this.center;
|
21963 | mat3.translate(matrix, matrix, [-center.x, -center.y]);
|
21964 | mat3.scale(matrix, matrix, [s1, s2]);
|
21965 | mat3.translate(matrix, matrix, [center.x, center.y]);
|
21966 | return this;
|
21967 | };
|
21968 |
|
21969 | |
21970 |
|
21971 |
|
21972 |
|
21973 |
|
21974 |
|
21975 |
|
21976 |
|
21977 | Coord.prototype.translate = function translate(x, y) {
|
21978 | var matrix = this.matrix;
|
21979 | mat3.translate(matrix, matrix, [x, y]);
|
21980 | return this;
|
21981 | };
|
21982 |
|
21983 | |
21984 |
|
21985 |
|
21986 |
|
21987 |
|
21988 |
|
21989 | Coord.prototype.transpose = function transpose() {
|
21990 | this.isTransposed = !this.isTransposed;
|
21991 | return this;
|
21992 | };
|
21993 |
|
21994 | return Coord;
|
21995 | }();
|
21996 |
|
21997 | module.exports = Coord;
|
21998 |
|
21999 | }),
|
22000 |
|
22001 | (function(module, exports, __webpack_require__) {
|
22002 |
|
22003 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22004 |
|
22005 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
22006 |
|
22007 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
22008 |
|
22009 |
|
22010 |
|
22011 |
|
22012 |
|
22013 | var Util = __webpack_require__(0);
|
22014 |
|
22015 | var _require = __webpack_require__(65),
|
22016 | LabelsRenderer = _require.LabelsRenderer;
|
22017 |
|
22018 | var _require2 = __webpack_require__(2),
|
22019 | Group = _require2.Group;
|
22020 |
|
22021 | var Grid = __webpack_require__(337);
|
22022 | var Global = __webpack_require__(1);
|
22023 |
|
22024 | var Base = function (_Group) {
|
22025 | _inherits(Base, _Group);
|
22026 |
|
22027 | function Base() {
|
22028 | _classCallCheck(this, Base);
|
22029 |
|
22030 | return _possibleConstructorReturn(this, _Group.apply(this, arguments));
|
22031 | }
|
22032 |
|
22033 | Base.prototype.getDefaultCfg = function getDefaultCfg() {
|
22034 | return {
|
22035 | |
22036 |
|
22037 |
|
22038 |
|
22039 | _id: null,
|
22040 | zIndex: 4,
|
22041 | |
22042 |
|
22043 |
|
22044 |
|
22045 | ticks: null,
|
22046 | |
22047 |
|
22048 |
|
22049 |
|
22050 | line: null,
|
22051 | |
22052 |
|
22053 |
|
22054 |
|
22055 | tickLine: null,
|
22056 | |
22057 |
|
22058 |
|
22059 |
|
22060 | subTickCount: 0,
|
22061 | |
22062 |
|
22063 |
|
22064 |
|
22065 | subTickLine: null,
|
22066 | |
22067 |
|
22068 |
|
22069 |
|
22070 | grid: null,
|
22071 | |
22072 |
|
22073 |
|
22074 |
|
22075 | label: {
|
22076 | textStyle: {},
|
22077 | autoRotate: true,
|
22078 | formatter: null
|
22079 | },
|
22080 | |
22081 |
|
22082 |
|
22083 |
|
22084 | title: {
|
22085 | autoRotate: true,
|
22086 | textStyle: {}
|
22087 | },
|
22088 | autoPaint: true
|
22089 | };
|
22090 | };
|
22091 |
|
22092 | Base.prototype._beforeRenderUI = function _beforeRenderUI() {
|
22093 | var title = this.get('title');
|
22094 | var label = this.get('label');
|
22095 | var grid = this.get('grid');
|
22096 | if (title) {
|
22097 | this.setSilent('title', Util.deepMix({
|
22098 | autoRotate: true,
|
22099 | textStyle: {
|
22100 | fontSize: 12,
|
22101 | fill: '#ccc',
|
22102 | textBaseline: 'middle',
|
22103 | fontFamily: Global.fontFamily,
|
22104 | textAlign: 'center'
|
22105 | },
|
22106 | offset: 48
|
22107 | }, title));
|
22108 | }
|
22109 | if (label) {
|
22110 | this.setSilent('label', Util.deepMix({
|
22111 | autoRotate: true,
|
22112 | textStyle: {
|
22113 | fontSize: 12,
|
22114 | fill: '#ccc',
|
22115 | textBaseline: 'middle',
|
22116 | fontFamily: Global.fontFamily
|
22117 | },
|
22118 | offset: 10
|
22119 | }, label));
|
22120 | }
|
22121 | if (grid) {
|
22122 | this.setSilent('grid', Util.deepMix({
|
22123 | lineStyle: {
|
22124 | lineWidth: 1,
|
22125 | stroke: '#C0D0E0'
|
22126 | }
|
22127 | }, grid));
|
22128 | }
|
22129 | };
|
22130 |
|
22131 | Base.prototype._renderUI = function _renderUI() {
|
22132 | var labelCfg = this.get('label');
|
22133 | if (labelCfg) {
|
22134 | this.renderLabels();
|
22135 | }
|
22136 | if (this.get('autoPaint')) {
|
22137 | this.paint();
|
22138 | }
|
22139 | if (!Util.isNil(this.get('title'))) {
|
22140 | this.renderTitle();
|
22141 | }
|
22142 | this.sort();
|
22143 | };
|
22144 |
|
22145 | Base.prototype._parseTicks = function _parseTicks(ticks) {
|
22146 | ticks = ticks || [];
|
22147 | var ticksLength = ticks.length;
|
22148 | for (var i = 0; i < ticksLength; i++) {
|
22149 | var item = ticks[i];
|
22150 | if (!Util.isObject(item)) {
|
22151 | ticks[i] = this.parseTick(item, i, ticksLength);
|
22152 | }
|
22153 | }
|
22154 | this.set('ticks', ticks);
|
22155 | return ticks;
|
22156 | };
|
22157 |
|
22158 | Base.prototype._addTickItem = function _addTickItem(index, point, length) {
|
22159 | var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
22160 |
|
22161 | var tickItems = this.get('tickItems');
|
22162 | var subTickItems = this.get('subTickItems');
|
22163 | var end = this.getTickEnd(point, length, index);
|
22164 |
|
22165 | var cfg = {
|
22166 | x1: point.x,
|
22167 | y1: point.y,
|
22168 | x2: end.x,
|
22169 | y2: end.y
|
22170 | };
|
22171 |
|
22172 | if (!tickItems) {
|
22173 | tickItems = [];
|
22174 | }
|
22175 |
|
22176 | if (!subTickItems) {
|
22177 | subTickItems = [];
|
22178 | }
|
22179 |
|
22180 | if (type === 'sub') {
|
22181 | subTickItems.push(cfg);
|
22182 | } else {
|
22183 | tickItems.push(cfg);
|
22184 | }
|
22185 |
|
22186 | this.set('tickItems', tickItems);
|
22187 | this.set('subTickItems', subTickItems);
|
22188 | };
|
22189 |
|
22190 | Base.prototype._renderLine = function _renderLine() {
|
22191 | var lineCfg = this.get('line');
|
22192 | var path = void 0;
|
22193 | if (lineCfg) {
|
22194 | path = this.getLinePath();
|
22195 | lineCfg = Util.mix({
|
22196 | path: path
|
22197 | }, lineCfg);
|
22198 | var lineShape = this.addShape('path', {
|
22199 | attrs: lineCfg
|
22200 | });
|
22201 | lineShape.name = 'axis-line';
|
22202 | this.get('appendInfo') && lineShape.setSilent('appendInfo', this.get('appendInfo'));
|
22203 | this.set('lineShape', lineShape);
|
22204 | }
|
22205 | };
|
22206 |
|
22207 | Base.prototype._processTicks = function _processTicks() {
|
22208 | var self = this;
|
22209 | var labelCfg = self.get('label');
|
22210 | var subTickCount = self.get('subTickCount');
|
22211 | var tickLineCfg = self.get('tickLine');
|
22212 | var ticks = self.get('ticks');
|
22213 | ticks = self._parseTicks(ticks);
|
22214 |
|
22215 | Util.each(ticks, function (tick, index) {
|
22216 | var tickPoint = self.getTickPoint(tick.value, index);
|
22217 | if (tickLineCfg) {
|
22218 | self._addTickItem(index, tickPoint, tickLineCfg.length);
|
22219 | }
|
22220 | if (labelCfg) {
|
22221 | self.addLabel(tick, tickPoint, index);
|
22222 | }
|
22223 | });
|
22224 |
|
22225 | if (subTickCount) {
|
22226 |
|
22227 | var subTickLineCfg = self.get('subTickLine');
|
22228 | Util.each(ticks, function (tick, index) {
|
22229 | if (index > 0) {
|
22230 | var diff = tick.value - ticks[index - 1].value;
|
22231 | diff = diff / (self.get('subTickCount') + 1);
|
22232 |
|
22233 | for (var i = 1; i <= subTickCount; i++) {
|
22234 | var subTick = {
|
22235 | text: '',
|
22236 | value: index ? ticks[index - 1].value + i * diff : i * diff
|
22237 | };
|
22238 |
|
22239 | var tickPoint = self.getTickPoint(subTick.value);
|
22240 | var subTickLength = void 0;
|
22241 | if (subTickLineCfg && subTickLineCfg.length) {
|
22242 | subTickLength = subTickLineCfg.length;
|
22243 | } else {
|
22244 | subTickLength = parseInt(tickLineCfg.length * (3 / 5), 10);
|
22245 | }
|
22246 | self._addTickItem(i - 1, tickPoint, subTickLength, 'sub');
|
22247 | }
|
22248 | }
|
22249 | });
|
22250 | }
|
22251 | };
|
22252 |
|
22253 | Base.prototype._addTickLine = function _addTickLine(ticks, lineCfg) {
|
22254 | var self = this;
|
22255 | var cfg = Util.mix({}, lineCfg);
|
22256 | var path = [];
|
22257 | Util.each(ticks, function (item) {
|
22258 | path.push(['M', item.x1, item.y1]);
|
22259 | path.push(['L', item.x2, item.y2]);
|
22260 | });
|
22261 | delete cfg.length;
|
22262 | cfg.path = path;
|
22263 | var tickShape = self.addShape('path', {
|
22264 | attrs: cfg
|
22265 | });
|
22266 | tickShape.name = 'axis-ticks';
|
22267 | tickShape._id = self.get('_id') + '-ticks';
|
22268 | tickShape.set('coord', self.get('coord'));
|
22269 | self.get('appendInfo') && tickShape.setSilent('appendInfo', self.get('appendInfo'));
|
22270 | };
|
22271 |
|
22272 | Base.prototype._renderTicks = function _renderTicks() {
|
22273 | var self = this;
|
22274 | var tickItems = self.get('tickItems');
|
22275 | var subTickItems = self.get('subTickItems');
|
22276 |
|
22277 | if (!Util.isEmpty(tickItems)) {
|
22278 | var tickLineCfg = self.get('tickLine');
|
22279 | self._addTickLine(tickItems, tickLineCfg);
|
22280 | }
|
22281 |
|
22282 | if (!Util.isEmpty(subTickItems)) {
|
22283 | var subTickLineCfg = self.get('subTickLine') || self.get('tickLine');
|
22284 | self._addTickLine(subTickItems, subTickLineCfg);
|
22285 | }
|
22286 | };
|
22287 |
|
22288 | Base.prototype._renderGrid = function _renderGrid() {
|
22289 | var grid = this.get('grid');
|
22290 | if (!grid) {
|
22291 | return;
|
22292 | }
|
22293 | grid.coord = this.get('coord');
|
22294 | grid.appendInfo = this.get('appendInfo');
|
22295 | this.set('gridGroup', this.addGroup(Grid, grid));
|
22296 | };
|
22297 |
|
22298 | Base.prototype.paint = function paint() {
|
22299 | this._renderLine();
|
22300 | this._processTicks();
|
22301 | this._renderTicks();
|
22302 | this._renderGrid();
|
22303 | var labelCfg = this.get('label');
|
22304 | if (labelCfg && labelCfg.autoRotate) {
|
22305 | this.autoRotateLabels();
|
22306 | }
|
22307 | };
|
22308 |
|
22309 | Base.prototype.parseTick = function parseTick(tick, index, length) {
|
22310 | return {
|
22311 | text: tick,
|
22312 | value: index / (length - 1)
|
22313 | };
|
22314 | };
|
22315 |
|
22316 | Base.prototype.getTextAnchor = function getTextAnchor(vector) {
|
22317 | var ratio = Math.abs(vector[1] / vector[0]);
|
22318 | var align = void 0;
|
22319 | if (ratio >= 1) {
|
22320 |
|
22321 | align = 'center';
|
22322 | } else {
|
22323 | if (vector[0] > 0) {
|
22324 |
|
22325 | align = 'start';
|
22326 | } else {
|
22327 |
|
22328 | align = 'end';
|
22329 | }
|
22330 | }
|
22331 | return align;
|
22332 | };
|
22333 |
|
22334 | Base.prototype.getMaxLabelWidth = function getMaxLabelWidth(labelsGroup) {
|
22335 | var labels = labelsGroup.get('children');
|
22336 | var max = 0;
|
22337 | Util.each(labels, function (label) {
|
22338 | var bbox = label.getBBox();
|
22339 | var width = bbox.width;
|
22340 | if (max < width) {
|
22341 | max = width;
|
22342 | }
|
22343 | });
|
22344 | return max;
|
22345 | };
|
22346 |
|
22347 | Base.prototype.remove = function remove() {
|
22348 | _Group.prototype.remove.call(this);
|
22349 | var gridGroup = this.get('gridGroup');
|
22350 | gridGroup && gridGroup.remove();
|
22351 | this.removeLabels();
|
22352 | };
|
22353 |
|
22354 | |
22355 |
|
22356 |
|
22357 |
|
22358 |
|
22359 |
|
22360 |
|
22361 | Base.prototype.autoRotateLabels = function autoRotateLabels() {};
|
22362 |
|
22363 | |
22364 |
|
22365 |
|
22366 |
|
22367 |
|
22368 |
|
22369 |
|
22370 | Base.prototype.renderTitle = function renderTitle() {};
|
22371 |
|
22372 | |
22373 |
|
22374 |
|
22375 |
|
22376 |
|
22377 |
|
22378 |
|
22379 | Base.prototype.getLinePath = function getLinePath() {};
|
22380 |
|
22381 | |
22382 |
|
22383 |
|
22384 |
|
22385 |
|
22386 |
|
22387 |
|
22388 | Base.prototype.getTickPoint = function getTickPoint() {};
|
22389 |
|
22390 | |
22391 |
|
22392 |
|
22393 |
|
22394 |
|
22395 |
|
22396 |
|
22397 | Base.prototype.getTickEnd = function getTickEnd() {};
|
22398 |
|
22399 | |
22400 |
|
22401 |
|
22402 |
|
22403 |
|
22404 |
|
22405 |
|
22406 | Base.prototype.getSideVector = function getSideVector() {};
|
22407 |
|
22408 | return Base;
|
22409 | }(Group);
|
22410 |
|
22411 | Util.assign(Base.prototype, LabelsRenderer, {
|
22412 | addLabel: function addLabel(tick, point, index) {
|
22413 | var labelsGroup = this.get('labelsGroup');
|
22414 | var label = {};
|
22415 | var rst = void 0;
|
22416 |
|
22417 | if (labelsGroup) {
|
22418 | var offset = this.get('_labelOffset');
|
22419 | if (!Util.isNil(this.get('label').offset)) {
|
22420 | offset = this.get('label').offset;
|
22421 | }
|
22422 | var vector = this.getSideVector(offset, point, index);
|
22423 | point = {
|
22424 | x: point.x + vector[0],
|
22425 | y: point.y + vector[1]
|
22426 | };
|
22427 | label.text = tick.text;
|
22428 | label.x = point.x;
|
22429 | label.y = point.y;
|
22430 | label.textAlign = this.getTextAnchor(vector);
|
22431 | rst = labelsGroup.addLabel(label);
|
22432 | if (rst) {
|
22433 | rst.name = 'axis-label';
|
22434 | rst._id = this.get('_id') + '-' + tick.tickValue;
|
22435 | rst.set('coord', this.get('coord'));
|
22436 | this.get('appendInfo') && rst.setSilent('appendInfo', this.get('appendInfo'));
|
22437 | }
|
22438 | }
|
22439 | return rst;
|
22440 | }
|
22441 | });
|
22442 |
|
22443 | module.exports = Base;
|
22444 |
|
22445 | }),
|
22446 |
|
22447 | (function(module, exports, __webpack_require__) {
|
22448 |
|
22449 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22450 |
|
22451 |
|
22452 |
|
22453 |
|
22454 |
|
22455 |
|
22456 | var assign = __webpack_require__(60);
|
22457 | var isNil = __webpack_require__(93);
|
22458 | var isArray = __webpack_require__(3);
|
22459 | var cloneDeep = __webpack_require__(102);
|
22460 | var Global = __webpack_require__(1);
|
22461 |
|
22462 |
|
22463 | function wrapBehavior(obj, action) {
|
22464 | if (obj['_wrap_' + action]) {
|
22465 | return obj['_wrap_' + action];
|
22466 | }
|
22467 | var method = function method(e) {
|
22468 | obj[action](e);
|
22469 | };
|
22470 | obj['_wrap_' + action] = method;
|
22471 | return method;
|
22472 | }
|
22473 |
|
22474 |
|
22475 | function getWrapBehavior(obj, action) {
|
22476 | return obj['_wrap_' + action];
|
22477 | }
|
22478 |
|
22479 | var Base = function () {
|
22480 | Base.prototype.getDefaultCfg = function getDefaultCfg() {
|
22481 | return {
|
22482 | chart: null,
|
22483 | group: null,
|
22484 |
|
22485 | |
22486 |
|
22487 |
|
22488 |
|
22489 | showTitle: true,
|
22490 |
|
22491 | |
22492 |
|
22493 |
|
22494 |
|
22495 | autoSetAxis: true,
|
22496 |
|
22497 | |
22498 |
|
22499 |
|
22500 |
|
22501 | padding: 10,
|
22502 |
|
22503 | |
22504 |
|
22505 |
|
22506 |
|
22507 | eachView: null,
|
22508 |
|
22509 | |
22510 |
|
22511 |
|
22512 |
|
22513 | fields: [],
|
22514 |
|
22515 | |
22516 |
|
22517 |
|
22518 |
|
22519 | colTitle: {
|
22520 | offsetY: -15,
|
22521 | style: {
|
22522 | fontSize: 14,
|
22523 | textAlign: 'center',
|
22524 | fill: '#444',
|
22525 | fontFamily: Global.fontFamily
|
22526 | }
|
22527 | },
|
22528 | rowTitle: {
|
22529 | offsetX: 15,
|
22530 | style: {
|
22531 | fontSize: 14,
|
22532 | textAlign: 'center',
|
22533 | rotate: 90,
|
22534 | fill: '#444',
|
22535 | fontFamily: Global.fontFamily
|
22536 | }
|
22537 | }
|
22538 | };
|
22539 | };
|
22540 |
|
22541 | function Base(cfg) {
|
22542 | _classCallCheck(this, Base);
|
22543 |
|
22544 | var defaultCfg = this.getDefaultCfg();
|
22545 | assign(this, defaultCfg, cfg);
|
22546 | this.init();
|
22547 | }
|
22548 |
|
22549 | Base.prototype.init = function init() {
|
22550 | if (!this.chart) {
|
22551 | throw new Error('Facets Error: please specify the chart!');
|
22552 | }
|
22553 | this._bindEvent();
|
22554 | this.initContainer();
|
22555 | if (this.chart.get('data')) {
|
22556 | this.initViews();
|
22557 | }
|
22558 | };
|
22559 |
|
22560 | Base.prototype.initContainer = function initContainer() {
|
22561 | var chart = this.chart;
|
22562 | var frontPlot = chart.get('frontPlot');
|
22563 | var group = frontPlot.addGroup();
|
22564 | this.group = group;
|
22565 | };
|
22566 |
|
22567 | Base.prototype.initViews = function initViews() {
|
22568 | var chart = this.chart;
|
22569 | var data = chart.get('data');
|
22570 | var eachView = this.eachView;
|
22571 | var facets = this.generateFacets(data);
|
22572 | for (var i = 0; i < facets.length; i++) {
|
22573 | var facet = facets[i];
|
22574 | var region = facet.region;
|
22575 | var view = chart.view({
|
22576 | start: region.start,
|
22577 | end: region.end,
|
22578 | padding: this.padding
|
22579 | });
|
22580 | view.source(facet.data);
|
22581 | this.beforeProcessView(view, facet);
|
22582 | if (eachView) {
|
22583 | eachView(view, facet);
|
22584 | }
|
22585 | this.afterProcessView(view, facet);
|
22586 | facet.view = view;
|
22587 | }
|
22588 | this.facets = facets;
|
22589 | };
|
22590 |
|
22591 | |
22592 |
|
22593 |
|
22594 |
|
22595 |
|
22596 |
|
22597 | Base.prototype.beforeProcessView = function beforeProcessView() /* view, facet */{};
|
22598 |
|
22599 | |
22600 |
|
22601 |
|
22602 |
|
22603 |
|
22604 |
|
22605 |
|
22606 |
|
22607 | Base.prototype.afterProcessView = function afterProcessView(view, facet) {
|
22608 | if (this.autoSetAxis) {
|
22609 | this.processAxis(view, facet);
|
22610 | }
|
22611 | };
|
22612 |
|
22613 | Base.prototype.processAxis = function processAxis(view, facet) {
|
22614 | var viewOptions = view.get('options');
|
22615 | var geoms = view.get('geoms');
|
22616 | if ((!viewOptions.coord.type || viewOptions.coord.type === 'rect') && geoms.length) {
|
22617 | var field = geoms[0].get('attrOptions').position.field;
|
22618 | var fields = isArray(field) ? field : field.split('*').map(function (str) {
|
22619 | return str.trim();
|
22620 | });
|
22621 | var xField = fields[0];
|
22622 | var yField = fields[1];
|
22623 | if (isNil(viewOptions.axes)) {
|
22624 | viewOptions.axes = {};
|
22625 | }
|
22626 | var axes = viewOptions.axes;
|
22627 | if (axes !== false) {
|
22628 | if (xField && axes[xField] !== false) {
|
22629 | axes[xField] = axes[xField] || {};
|
22630 | this.setXAxis(xField, axes, facet);
|
22631 | }
|
22632 | if (yField && axes[yField] !== false) {
|
22633 | axes[yField] = axes[yField] || {};
|
22634 | this.setYAxis(yField, axes, facet);
|
22635 | }
|
22636 | }
|
22637 | }
|
22638 | };
|
22639 |
|
22640 | Base.prototype.setXAxis = function setXAxis() /* xField, axes, facet */{};
|
22641 |
|
22642 | Base.prototype.setYAxis = function setYAxis() /* yField, axes, facet */{};
|
22643 |
|
22644 |
|
22645 |
|
22646 |
|
22647 | Base.prototype.renderTitle = function renderTitle(view, facet) {
|
22648 | this.drawColTitle(view, facet);
|
22649 | };
|
22650 |
|
22651 | Base.prototype.getScaleText = function getScaleText(field, value, view) {
|
22652 | var rst = void 0;
|
22653 | if (field) {
|
22654 | var scales = view.get('scales');
|
22655 | var scale = scales[field];
|
22656 | if (!scale) {
|
22657 | scale = view.createScale(field);
|
22658 | }
|
22659 | rst = scale.getText(value);
|
22660 | } else {
|
22661 | rst = value;
|
22662 | }
|
22663 | return rst;
|
22664 | };
|
22665 |
|
22666 | Base.prototype.drawColTitle = function drawColTitle(view, facet) {
|
22667 | var text = this.getScaleText(facet.colField, facet.colValue, view);
|
22668 | var colTextCfg = assign({
|
22669 | position: ['50%', '0%'],
|
22670 | content: text
|
22671 | }, this.colTitle);
|
22672 | view.guide().text(colTextCfg);
|
22673 | };
|
22674 |
|
22675 | Base.prototype.drawRowTitle = function drawRowTitle(view, facet) {
|
22676 | var text = this.getScaleText(facet.rowField, facet.rowValue, view);
|
22677 | var rowTextCfg = assign({
|
22678 | position: ['100%', '50%'],
|
22679 | content: text
|
22680 | }, cloneDeep(this.rowTitle));
|
22681 |
|
22682 | view.guide().text(rowTextCfg);
|
22683 | };
|
22684 |
|
22685 | |
22686 |
|
22687 |
|
22688 |
|
22689 |
|
22690 |
|
22691 |
|
22692 |
|
22693 | Base.prototype.getFilter = function getFilter(conditions) {
|
22694 | var filter = function filter(obj) {
|
22695 | var filtered = true;
|
22696 | conditions.forEach(function (cond) {
|
22697 | var field = cond.field;
|
22698 | var value = cond.value;
|
22699 |
|
22700 | var tmp = true;
|
22701 | if (!isNil(value) && field) {
|
22702 | tmp = obj[field] === value;
|
22703 | }
|
22704 | filtered = filtered && tmp;
|
22705 | });
|
22706 | return filtered;
|
22707 | };
|
22708 | return filter;
|
22709 | };
|
22710 |
|
22711 | |
22712 |
|
22713 |
|
22714 |
|
22715 |
|
22716 |
|
22717 |
|
22718 |
|
22719 |
|
22720 | Base.prototype.getFieldValues = function getFieldValues(field, data) {
|
22721 | var rst = [];
|
22722 | var tmpMap = {};
|
22723 | for (var i = 0; i < data.length; i++) {
|
22724 | var obj = data[i];
|
22725 | var value = obj[field];
|
22726 | if (!isNil(value) && !tmpMap[value]) {
|
22727 | rst.push(value);
|
22728 | tmpMap[value] = true;
|
22729 | }
|
22730 | }
|
22731 | return rst;
|
22732 | };
|
22733 |
|
22734 | Base.prototype.getRegion = function getRegion(rows, cols, xIndex, yIndex) {
|
22735 | var xWidth = 1 / cols;
|
22736 | var yWidth = 1 / rows;
|
22737 |
|
22738 | var start = {
|
22739 | x: xWidth * xIndex,
|
22740 | y: yWidth * yIndex
|
22741 | };
|
22742 |
|
22743 | var end = {
|
22744 | x: start.x + xWidth,
|
22745 | y: start.y + yWidth
|
22746 | };
|
22747 |
|
22748 | return {
|
22749 | start: start,
|
22750 | end: end
|
22751 | };
|
22752 | };
|
22753 |
|
22754 | |
22755 |
|
22756 |
|
22757 |
|
22758 |
|
22759 |
|
22760 |
|
22761 | Base.prototype.generateFacets = function generateFacets() /* data */{
|
22762 | return [];
|
22763 | };
|
22764 |
|
22765 | Base.prototype._bindEvent = function _bindEvent() {
|
22766 | var chart = this.chart;
|
22767 | chart.on('afterchangedata', wrapBehavior(this, 'onDataChange'));
|
22768 | chart.on('beforeclear', wrapBehavior(this, 'onClear'));
|
22769 | chart.on('beforedestroy', wrapBehavior(this, 'destroy'));
|
22770 | chart.on('beforepaint', wrapBehavior(this, 'onPaint'));
|
22771 | chart.on('setdata', wrapBehavior(this, 'onDataChange'));
|
22772 | };
|
22773 |
|
22774 | Base.prototype._clearEvent = function _clearEvent() {
|
22775 | var chart = this.chart;
|
22776 | if (chart) {
|
22777 | chart.off('afterchangedata', getWrapBehavior(this, 'onDataChange'));
|
22778 | chart.off('beforeclear', getWrapBehavior(this, 'onClear'));
|
22779 | chart.off('beforedestroy', getWrapBehavior(this, 'destroy'));
|
22780 | chart.off('beforepaint', getWrapBehavior(this, 'onPaint'));
|
22781 | chart.off('setdata', getWrapBehavior(this, 'onDataChange'));
|
22782 | }
|
22783 | };
|
22784 |
|
22785 | Base.prototype._clearFacets = function _clearFacets() {
|
22786 | var facets = this.facets;
|
22787 | var chart = this.chart;
|
22788 | if (facets) {
|
22789 | for (var i = 0; i < facets.length; i++) {
|
22790 | var facet = facets[i];
|
22791 | chart.removeView(facet.view);
|
22792 | }
|
22793 | }
|
22794 | this.facets = null;
|
22795 | };
|
22796 |
|
22797 | Base.prototype.onClear = function onClear() {
|
22798 | this.onRemove();
|
22799 | };
|
22800 |
|
22801 | Base.prototype.onPaint = function onPaint() {
|
22802 | if (this.showTitle) {
|
22803 | var facets = this.facets;
|
22804 | for (var i = 0; i < facets.length; i++) {
|
22805 | var facet = facets[i];
|
22806 | var view = facet.view;
|
22807 | this.renderTitle(view, facet);
|
22808 | }
|
22809 | }
|
22810 | };
|
22811 |
|
22812 | Base.prototype.onDataChange = function onDataChange() {
|
22813 | this._clearFacets();
|
22814 | this.initViews();
|
22815 | };
|
22816 |
|
22817 | Base.prototype.onRemove = function onRemove() {
|
22818 | this._clearFacets();
|
22819 | this._clearEvent();
|
22820 | this.group && this.group.remove();
|
22821 | this.chart = null;
|
22822 | this.facets = null;
|
22823 | this.group = null;
|
22824 | };
|
22825 |
|
22826 | Base.prototype.destroy = function destroy() {
|
22827 | this.onRemove();
|
22828 | this.destroyed = true;
|
22829 | };
|
22830 |
|
22831 | return Base;
|
22832 | }();
|
22833 |
|
22834 | module.exports = Base;
|
22835 |
|
22836 | }),
|
22837 |
|
22838 | (function(module, exports, __webpack_require__) {
|
22839 |
|
22840 | var baseIsTypedArray = __webpack_require__(138),
|
22841 | baseUnary = __webpack_require__(72),
|
22842 | nodeUtil = __webpack_require__(73);
|
22843 |
|
22844 |
|
22845 | var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
22846 |
|
22847 |
|
22848 |
|
22849 |
|
22850 |
|
22851 |
|
22852 |
|
22853 |
|
22854 |
|
22855 |
|
22856 |
|
22857 |
|
22858 |
|
22859 |
|
22860 |
|
22861 |
|
22862 |
|
22863 |
|
22864 | var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
22865 |
|
22866 | module.exports = isTypedArray;
|
22867 |
|
22868 | }),
|
22869 |
|
22870 | (function(module, exports) {
|
22871 |
|
22872 |
|
22873 | var MAX_SAFE_INTEGER = 9007199254740991;
|
22874 |
|
22875 |
|
22876 |
|
22877 |
|
22878 |
|
22879 |
|
22880 |
|
22881 |
|
22882 |
|
22883 |
|
22884 |
|
22885 |
|
22886 |
|
22887 |
|
22888 |
|
22889 |
|
22890 |
|
22891 |
|
22892 |
|
22893 |
|
22894 |
|
22895 |
|
22896 |
|
22897 |
|
22898 |
|
22899 |
|
22900 |
|
22901 | function isLength(value) {
|
22902 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
22903 | }
|
22904 |
|
22905 | module.exports = isLength;
|
22906 |
|
22907 | }),
|
22908 |
|
22909 | (function(module, exports, __webpack_require__) {
|
22910 |
|
22911 | var baseGetTag = __webpack_require__(6),
|
22912 | isObject = __webpack_require__(7);
|
22913 |
|
22914 |
|
22915 | var asyncTag = '[object AsyncFunction]',
|
22916 | funcTag = '[object Function]',
|
22917 | genTag = '[object GeneratorFunction]',
|
22918 | proxyTag = '[object Proxy]';
|
22919 |
|
22920 |
|
22921 |
|
22922 |
|
22923 |
|
22924 |
|
22925 |
|
22926 |
|
22927 |
|
22928 |
|
22929 |
|
22930 |
|
22931 |
|
22932 |
|
22933 |
|
22934 |
|
22935 |
|
22936 |
|
22937 | function isFunction(value) {
|
22938 | if (!isObject(value)) {
|
22939 | return false;
|
22940 | }
|
22941 |
|
22942 |
|
22943 | var tag = baseGetTag(value);
|
22944 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
22945 | }
|
22946 |
|
22947 | module.exports = isFunction;
|
22948 |
|
22949 | }),
|
22950 |
|
22951 | (function(module, exports) {
|
22952 |
|
22953 |
|
22954 |
|
22955 |
|
22956 |
|
22957 |
|
22958 |
|
22959 |
|
22960 |
|
22961 |
|
22962 | function arrayMap(array, iteratee) {
|
22963 | var index = -1,
|
22964 | length = array == null ? 0 : array.length,
|
22965 | result = Array(length);
|
22966 |
|
22967 | while (++index < length) {
|
22968 | result[index] = iteratee(array[index], index, array);
|
22969 | }
|
22970 | return result;
|
22971 | }
|
22972 |
|
22973 | module.exports = arrayMap;
|
22974 |
|
22975 | }),
|
22976 |
|
22977 | (function(module, exports, __webpack_require__) {
|
22978 |
|
22979 | var ListCache = __webpack_require__(32),
|
22980 | stackClear = __webpack_require__(150),
|
22981 | stackDelete = __webpack_require__(151),
|
22982 | stackGet = __webpack_require__(152),
|
22983 | stackHas = __webpack_require__(153),
|
22984 | stackSet = __webpack_require__(154);
|
22985 |
|
22986 |
|
22987 |
|
22988 |
|
22989 |
|
22990 |
|
22991 |
|
22992 |
|
22993 | function Stack(entries) {
|
22994 | var data = this.__data__ = new ListCache(entries);
|
22995 | this.size = data.size;
|
22996 | }
|
22997 |
|
22998 |
|
22999 | Stack.prototype.clear = stackClear;
|
23000 | Stack.prototype['delete'] = stackDelete;
|
23001 | Stack.prototype.get = stackGet;
|
23002 | Stack.prototype.has = stackHas;
|
23003 | Stack.prototype.set = stackSet;
|
23004 |
|
23005 | module.exports = Stack;
|
23006 |
|
23007 | }),
|
23008 |
|
23009 | (function(module, exports, __webpack_require__) {
|
23010 |
|
23011 | var getNative = __webpack_require__(13),
|
23012 | root = __webpack_require__(4);
|
23013 |
|
23014 |
|
23015 | var Map = getNative(root, 'Map');
|
23016 |
|
23017 | module.exports = Map;
|
23018 |
|
23019 | }),
|
23020 |
|
23021 | (function(module, exports, __webpack_require__) {
|
23022 |
|
23023 | var mapCacheClear = __webpack_require__(159),
|
23024 | mapCacheDelete = __webpack_require__(166),
|
23025 | mapCacheGet = __webpack_require__(168),
|
23026 | mapCacheHas = __webpack_require__(169),
|
23027 | mapCacheSet = __webpack_require__(170);
|
23028 |
|
23029 |
|
23030 |
|
23031 |
|
23032 |
|
23033 |
|
23034 |
|
23035 |
|
23036 | function MapCache(entries) {
|
23037 | var index = -1,
|
23038 | length = entries == null ? 0 : entries.length;
|
23039 |
|
23040 | this.clear();
|
23041 | while (++index < length) {
|
23042 | var entry = entries[index];
|
23043 | this.set(entry[0], entry[1]);
|
23044 | }
|
23045 | }
|
23046 |
|
23047 |
|
23048 | MapCache.prototype.clear = mapCacheClear;
|
23049 | MapCache.prototype['delete'] = mapCacheDelete;
|
23050 | MapCache.prototype.get = mapCacheGet;
|
23051 | MapCache.prototype.has = mapCacheHas;
|
23052 | MapCache.prototype.set = mapCacheSet;
|
23053 |
|
23054 | module.exports = MapCache;
|
23055 |
|
23056 | }),
|
23057 |
|
23058 | (function(module, exports) {
|
23059 |
|
23060 |
|
23061 |
|
23062 |
|
23063 |
|
23064 |
|
23065 |
|
23066 |
|
23067 | function mapToArray(map) {
|
23068 | var index = -1,
|
23069 | result = Array(map.size);
|
23070 |
|
23071 | map.forEach(function (value, key) {
|
23072 | result[++index] = [key, value];
|
23073 | });
|
23074 | return result;
|
23075 | }
|
23076 |
|
23077 | module.exports = mapToArray;
|
23078 |
|
23079 | }),
|
23080 |
|
23081 | (function(module, exports) {
|
23082 |
|
23083 |
|
23084 |
|
23085 |
|
23086 |
|
23087 |
|
23088 |
|
23089 |
|
23090 |
|
23091 | function arrayPush(array, values) {
|
23092 | var index = -1,
|
23093 | length = values.length,
|
23094 | offset = array.length;
|
23095 |
|
23096 | while (++index < length) {
|
23097 | array[offset + index] = values[index];
|
23098 | }
|
23099 | return array;
|
23100 | }
|
23101 |
|
23102 | module.exports = arrayPush;
|
23103 |
|
23104 | }),
|
23105 |
|
23106 | (function(module, exports, __webpack_require__) {
|
23107 |
|
23108 | var arrayFilter = __webpack_require__(83),
|
23109 | stubArray = __webpack_require__(84);
|
23110 |
|
23111 |
|
23112 | var objectProto = Object.prototype;
|
23113 |
|
23114 |
|
23115 | var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
23116 |
|
23117 |
|
23118 | var nativeGetSymbols = Object.getOwnPropertySymbols;
|
23119 |
|
23120 |
|
23121 |
|
23122 |
|
23123 |
|
23124 |
|
23125 |
|
23126 |
|
23127 | var getSymbols = !nativeGetSymbols ? stubArray : function (object) {
|
23128 | if (object == null) {
|
23129 | return [];
|
23130 | }
|
23131 | object = Object(object);
|
23132 | return arrayFilter(nativeGetSymbols(object), function (symbol) {
|
23133 | return propertyIsEnumerable.call(object, symbol);
|
23134 | });
|
23135 | };
|
23136 |
|
23137 | module.exports = getSymbols;
|
23138 |
|
23139 | }),
|
23140 |
|
23141 | (function(module, exports, __webpack_require__) {
|
23142 |
|
23143 | var castPath = __webpack_require__(39),
|
23144 | toKey = __webpack_require__(22);
|
23145 |
|
23146 |
|
23147 |
|
23148 |
|
23149 |
|
23150 |
|
23151 |
|
23152 |
|
23153 |
|
23154 | function baseGet(object, path) {
|
23155 | path = castPath(path, object);
|
23156 |
|
23157 | var index = 0,
|
23158 | length = path.length;
|
23159 |
|
23160 | while (object != null && index < length) {
|
23161 | object = object[toKey(path[index++])];
|
23162 | }
|
23163 | return index && index == length ? object : undefined;
|
23164 | }
|
23165 |
|
23166 | module.exports = baseGet;
|
23167 |
|
23168 | }),
|
23169 |
|
23170 | (function(module, exports, __webpack_require__) {
|
23171 |
|
23172 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
23173 |
|
23174 | var isArray = __webpack_require__(3),
|
23175 | isSymbol = __webpack_require__(21);
|
23176 |
|
23177 |
|
23178 | var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
23179 | reIsPlainProp = /^\w*$/;
|
23180 |
|
23181 |
|
23182 |
|
23183 |
|
23184 |
|
23185 |
|
23186 |
|
23187 |
|
23188 |
|
23189 | function isKey(value, object) {
|
23190 | if (isArray(value)) {
|
23191 | return false;
|
23192 | }
|
23193 | var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
23194 | if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) {
|
23195 | return true;
|
23196 | }
|
23197 | return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
|
23198 | }
|
23199 |
|
23200 | module.exports = isKey;
|
23201 |
|
23202 | }),
|
23203 |
|
23204 | (function(module, exports) {
|
23205 |
|
23206 |
|
23207 |
|
23208 |
|
23209 |
|
23210 |
|
23211 |
|
23212 |
|
23213 |
|
23214 |
|
23215 |
|
23216 |
|
23217 |
|
23218 | function arrayReduce(array, iteratee, accumulator, initAccum) {
|
23219 | var index = -1,
|
23220 | length = array == null ? 0 : array.length;
|
23221 |
|
23222 | if (initAccum && length) {
|
23223 | accumulator = array[++index];
|
23224 | }
|
23225 | while (++index < length) {
|
23226 | accumulator = iteratee(accumulator, array[index], index, array);
|
23227 | }
|
23228 | return accumulator;
|
23229 | }
|
23230 |
|
23231 | module.exports = arrayReduce;
|
23232 |
|
23233 | }),
|
23234 |
|
23235 | (function(module, exports, __webpack_require__) {
|
23236 |
|
23237 | var overArg = __webpack_require__(75);
|
23238 |
|
23239 |
|
23240 | var getPrototype = overArg(Object.getPrototypeOf, Object);
|
23241 |
|
23242 | module.exports = getPrototype;
|
23243 |
|
23244 | }),
|
23245 |
|
23246 | (function(module, exports, __webpack_require__) {
|
23247 |
|
23248 | var assignValue = __webpack_require__(40),
|
23249 | copyObject = __webpack_require__(23),
|
23250 | createAssigner = __webpack_require__(225),
|
23251 | isArrayLike = __webpack_require__(8),
|
23252 | isPrototype = __webpack_require__(18),
|
23253 | keys = __webpack_require__(11);
|
23254 |
|
23255 |
|
23256 | var objectProto = Object.prototype;
|
23257 |
|
23258 |
|
23259 | var hasOwnProperty = objectProto.hasOwnProperty;
|
23260 |
|
23261 |
|
23262 |
|
23263 |
|
23264 |
|
23265 |
|
23266 |
|
23267 |
|
23268 |
|
23269 |
|
23270 |
|
23271 |
|
23272 |
|
23273 |
|
23274 |
|
23275 |
|
23276 |
|
23277 |
|
23278 |
|
23279 |
|
23280 |
|
23281 |
|
23282 |
|
23283 |
|
23284 |
|
23285 |
|
23286 |
|
23287 |
|
23288 |
|
23289 |
|
23290 |
|
23291 |
|
23292 |
|
23293 | var assign = createAssigner(function (object, source) {
|
23294 | if (isPrototype(source) || isArrayLike(source)) {
|
23295 | copyObject(source, keys(source), object);
|
23296 | return;
|
23297 | }
|
23298 | for (var key in source) {
|
23299 | if (hasOwnProperty.call(source, key)) {
|
23300 | assignValue(object, key, source[key]);
|
23301 | }
|
23302 | }
|
23303 | });
|
23304 |
|
23305 | module.exports = assign;
|
23306 |
|
23307 | }),
|
23308 |
|
23309 | (function(module, exports, __webpack_require__) {
|
23310 |
|
23311 | var defineProperty = __webpack_require__(98);
|
23312 |
|
23313 |
|
23314 |
|
23315 |
|
23316 |
|
23317 |
|
23318 |
|
23319 |
|
23320 |
|
23321 |
|
23322 | function baseAssignValue(object, key, value) {
|
23323 | if (key == '__proto__' && defineProperty) {
|
23324 | defineProperty(object, key, {
|
23325 | 'configurable': true,
|
23326 | 'enumerable': true,
|
23327 | 'value': value,
|
23328 | 'writable': true
|
23329 | });
|
23330 | } else {
|
23331 | object[key] = value;
|
23332 | }
|
23333 | }
|
23334 |
|
23335 | module.exports = baseAssignValue;
|
23336 |
|
23337 | }),
|
23338 |
|
23339 | (function(module, exports, __webpack_require__) {
|
23340 |
|
23341 | var Uint8Array = __webpack_require__(80);
|
23342 |
|
23343 |
|
23344 |
|
23345 |
|
23346 |
|
23347 |
|
23348 |
|
23349 |
|
23350 | function cloneArrayBuffer(arrayBuffer) {
|
23351 | var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
23352 | new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
23353 | return result;
|
23354 | }
|
23355 |
|
23356 | module.exports = cloneArrayBuffer;
|
23357 |
|
23358 | }),
|
23359 |
|
23360 | (function(module, exports, __webpack_require__) {
|
23361 |
|
23362 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
23363 |
|
23364 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
23365 |
|
23366 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
23367 |
|
23368 |
|
23369 |
|
23370 |
|
23371 |
|
23372 |
|
23373 | var EventEmitter = __webpack_require__(284);
|
23374 | var Util = __webpack_require__(0);
|
23375 |
|
23376 | var Base = function (_EventEmitter) {
|
23377 | _inherits(Base, _EventEmitter);
|
23378 |
|
23379 | Base.prototype.getDefaultCfg = function getDefaultCfg() {
|
23380 | return {};
|
23381 | };
|
23382 |
|
23383 | function Base(cfg) {
|
23384 | _classCallCheck(this, Base);
|
23385 |
|
23386 | var _this = _possibleConstructorReturn(this, _EventEmitter.call(this));
|
23387 |
|
23388 | var attrs = {
|
23389 | visible: true
|
23390 | };
|
23391 | var defaultCfg = _this.getDefaultCfg();
|
23392 | _this._attrs = attrs;
|
23393 | Util.assign(attrs, defaultCfg, cfg);
|
23394 | return _this;
|
23395 | }
|
23396 |
|
23397 | Base.prototype.get = function get(name) {
|
23398 | return this._attrs[name];
|
23399 | };
|
23400 |
|
23401 | Base.prototype.set = function set(name, value) {
|
23402 | this._attrs[name] = value;
|
23403 | };
|
23404 |
|
23405 | Base.prototype.show = function show() {
|
23406 | var visible = this.get('visible');
|
23407 | if (!visible) {
|
23408 | this.set('visible', true);
|
23409 | this.changeVisible(true);
|
23410 | }
|
23411 | };
|
23412 |
|
23413 | Base.prototype.hide = function hide() {
|
23414 | var visible = this.get('visible');
|
23415 | if (visible) {
|
23416 | this.set('visible', false);
|
23417 | this.changeVisible(false);
|
23418 | }
|
23419 | };
|
23420 |
|
23421 | |
23422 |
|
23423 |
|
23424 |
|
23425 |
|
23426 |
|
23427 |
|
23428 | Base.prototype.changeVisible = function changeVisible() /* visible */{};
|
23429 |
|
23430 | Base.prototype.destroy = function destroy() {
|
23431 | this._attrs = {};
|
23432 | this.removeAllListeners();
|
23433 | this.destroyed = true;
|
23434 | };
|
23435 |
|
23436 | return Base;
|
23437 | }(EventEmitter);
|
23438 |
|
23439 | module.exports = Base;
|
23440 |
|
23441 | }),
|
23442 |
|
23443 | (function(module, exports, __webpack_require__) {
|
23444 |
|
23445 |
|
23446 |
|
23447 |
|
23448 |
|
23449 |
|
23450 | var Util = __webpack_require__(0);
|
23451 | var RGB_REG = /rgb\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/;
|
23452 |
|
23453 |
|
23454 | function createTmp() {
|
23455 | var i = document.createElement('i');
|
23456 | i.title = 'Web Colour Picker';
|
23457 | i.style.display = 'none';
|
23458 | document.body.appendChild(i);
|
23459 | return i;
|
23460 | }
|
23461 |
|
23462 |
|
23463 | function getValue(start, end, percent, index) {
|
23464 | var value = start[index] + (end[index] - start[index]) * percent;
|
23465 | return value;
|
23466 | }
|
23467 |
|
23468 |
|
23469 | function arr2rgb(arr) {
|
23470 | return '#' + toHex(arr[0]) + toHex(arr[1]) + toHex(arr[2]);
|
23471 | }
|
23472 |
|
23473 |
|
23474 | function toHex(value) {
|
23475 | value = Math.round(value);
|
23476 | value = value.toString(16);
|
23477 | if (value.length === 1) {
|
23478 | value = '0' + value;
|
23479 | }
|
23480 | return value;
|
23481 | }
|
23482 |
|
23483 | function calColor(colors, percent) {
|
23484 | var steps = colors.length - 1;
|
23485 | var step = Math.floor(steps * percent);
|
23486 | var left = steps * percent - step;
|
23487 | var start = colors[step];
|
23488 | var end = step === steps ? start : colors[step + 1];
|
23489 | var rgb = arr2rgb([getValue(start, end, left, 0), getValue(start, end, left, 1), getValue(start, end, left, 2)]);
|
23490 | return rgb;
|
23491 | }
|
23492 |
|
23493 |
|
23494 | function rgb2arr(str) {
|
23495 | var arr = [];
|
23496 | arr.push(parseInt(str.substr(1, 2), 16));
|
23497 | arr.push(parseInt(str.substr(3, 2), 16));
|
23498 | arr.push(parseInt(str.substr(5, 2), 16));
|
23499 | return arr;
|
23500 | }
|
23501 |
|
23502 | var colorCache = {};
|
23503 | var iEl = null;
|
23504 | var ColorUtil = {
|
23505 | |
23506 |
|
23507 |
|
23508 |
|
23509 |
|
23510 | toRGB: function toRGB(color) {
|
23511 |
|
23512 | if (color[0] === '#' && color.length === 7) {
|
23513 | return color;
|
23514 | }
|
23515 | if (!iEl) {
|
23516 |
|
23517 | iEl = createTmp();
|
23518 | }
|
23519 | var rst = void 0;
|
23520 | if (colorCache[color]) {
|
23521 | rst = colorCache[color];
|
23522 | } else {
|
23523 | iEl.style.color = color;
|
23524 | rst = document.defaultView.getComputedStyle(iEl, '').getPropertyValue('color');
|
23525 | var cArray = RGB_REG.exec(rst);
|
23526 | cArray.shift();
|
23527 | rst = arr2rgb(cArray);
|
23528 | colorCache[color] = rst;
|
23529 | }
|
23530 | return rst;
|
23531 | },
|
23532 |
|
23533 |
|
23534 | rgb2arr: rgb2arr,
|
23535 |
|
23536 | |
23537 |
|
23538 |
|
23539 |
|
23540 |
|
23541 | gradient: function gradient(colors) {
|
23542 | var points = [];
|
23543 | if (Util.isString(colors)) {
|
23544 | colors = colors.split('-');
|
23545 | }
|
23546 | Util.each(colors, function (color) {
|
23547 | if (color.indexOf('#') === -1) {
|
23548 | color = ColorUtil.toRGB(color);
|
23549 | }
|
23550 | points.push(rgb2arr(color));
|
23551 | });
|
23552 | return function (percent) {
|
23553 | return calColor(points, percent);
|
23554 | };
|
23555 | }
|
23556 | };
|
23557 |
|
23558 | module.exports = ColorUtil;
|
23559 |
|
23560 | }),
|
23561 |
|
23562 | (function(module, exports, __webpack_require__) {
|
23563 |
|
23564 |
|
23565 |
|
23566 |
|
23567 |
|
23568 | var Labels = __webpack_require__(110);
|
23569 | Labels.LabelsRenderer = __webpack_require__(300);
|
23570 |
|
23571 | module.exports = Labels;
|
23572 |
|
23573 | }),
|
23574 |
|
23575 | (function(module, exports, __webpack_require__) {
|
23576 |
|
23577 | var Shape = __webpack_require__(10);
|
23578 |
|
23579 | __webpack_require__(303);
|
23580 | __webpack_require__(304);
|
23581 | __webpack_require__(305);
|
23582 | __webpack_require__(306);
|
23583 | __webpack_require__(307);
|
23584 | __webpack_require__(308);
|
23585 | __webpack_require__(309);
|
23586 |
|
23587 | module.exports = Shape;
|
23588 |
|
23589 | }),
|
23590 |
|
23591 | (function(module, exports, __webpack_require__) {
|
23592 |
|
23593 |
|
23594 |
|
23595 |
|
23596 |
|
23597 | var Util = __webpack_require__(0);
|
23598 |
|
23599 | var ShapeUtil = {
|
23600 | splitPoints: function splitPoints(obj) {
|
23601 | var points = [];
|
23602 | var x = obj.x;
|
23603 | var y = obj.y;
|
23604 | y = Util.isArray(y) ? y : [y];
|
23605 | Util.each(y, function (yItem, index) {
|
23606 | var point = {
|
23607 | x: Util.isArray(x) ? x[index] : x,
|
23608 | y: yItem
|
23609 | };
|
23610 | points.push(point);
|
23611 | });
|
23612 | return points;
|
23613 | }
|
23614 | };
|
23615 |
|
23616 | module.exports = ShapeUtil;
|
23617 |
|
23618 | }),
|
23619 |
|
23620 | (function(module, exports, __webpack_require__) {
|
23621 |
|
23622 |
|
23623 |
|
23624 |
|
23625 |
|
23626 | var Util = __webpack_require__(0);
|
23627 | var Action = __webpack_require__(281);
|
23628 |
|
23629 | var defaultAnimationCfg = {
|
23630 | appear: {
|
23631 | duration: 450,
|
23632 | easing: 'easeQuadOut'
|
23633 | },
|
23634 | update: {
|
23635 | duration: 450,
|
23636 | easing: 'easeQuadInOut'
|
23637 | },
|
23638 | enter: {
|
23639 | duration: 400,
|
23640 | easing: 'easeQuadInOut',
|
23641 | delay: 100
|
23642 | },
|
23643 | leave: {
|
23644 | duration: 350,
|
23645 | easing: 'easeQuadIn'
|
23646 | } };
|
23647 |
|
23648 | var Animate = {
|
23649 | line: {
|
23650 | appear: function appear() {
|
23651 | return Action.appear.clipIn;
|
23652 | },
|
23653 | enter: function enter() {
|
23654 | return Action.enter.clipIn;
|
23655 | },
|
23656 | leave: function leave() {
|
23657 | return Action.leave.lineWidthOut;
|
23658 | }
|
23659 | },
|
23660 | path: {
|
23661 | appear: function appear() {
|
23662 | return Action.appear.clipIn;
|
23663 | },
|
23664 | enter: function enter() {
|
23665 | return Action.enter.clipIn;
|
23666 | },
|
23667 | leave: function leave() {
|
23668 | return Action.leave.lineWidthOut;
|
23669 | }
|
23670 | },
|
23671 | area: {
|
23672 | appear: function appear() {
|
23673 | return Action.appear.clipIn;
|
23674 | },
|
23675 | enter: function enter() {
|
23676 | return Action.enter.fadeIn;
|
23677 | },
|
23678 | leave: function leave() {
|
23679 | return Action.leave.fadeOut;
|
23680 | },
|
23681 |
|
23682 | cfg: {
|
23683 | appear: {
|
23684 | duration: 500,
|
23685 | easing: 'easeQuadOut'
|
23686 | },
|
23687 | update: {
|
23688 | duration: 450,
|
23689 | easing: 'easeQuadInOut'
|
23690 | },
|
23691 | enter: {
|
23692 | duration: 600,
|
23693 | delay: 150,
|
23694 | easing: 'easeQuadInOut'
|
23695 | },
|
23696 | leave: {
|
23697 | easing: 'easeQuadOut',
|
23698 | duration: 350
|
23699 | }
|
23700 | }
|
23701 | },
|
23702 | polygon: {
|
23703 | appear: function appear() {
|
23704 | return Action.appear.zoomIn;
|
23705 | },
|
23706 | enter: function enter() {
|
23707 | return Action.enter.zoomIn;
|
23708 | },
|
23709 | leave: function leave() {
|
23710 | return Action.leave.zoomOut;
|
23711 | }
|
23712 | },
|
23713 | edge: {
|
23714 | appear: function appear() {
|
23715 | return Action.appear.pathIn;
|
23716 | },
|
23717 | enter: function enter() {
|
23718 | return Action.enter.pathIn;
|
23719 | },
|
23720 | leave: function leave() {
|
23721 | return Action.leave.pathOut;
|
23722 | }
|
23723 | },
|
23724 | interval: {
|
23725 | appear: function appear(coord) {
|
23726 | var result = void 0;
|
23727 | if (coord.isPolar) {
|
23728 | result = Action.appear.zoomIn;
|
23729 | if (coord.isTransposed || coord.type === 'theta') {
|
23730 | result = Action.appear.fanIn;
|
23731 | }
|
23732 | } else if (coord.isRect) {
|
23733 | result = coord.isTransposed ? Action.appear.scaleInX : Action.appear.scaleInY;
|
23734 | } else {
|
23735 | result = Action.appear.zoomIn;
|
23736 | }
|
23737 | return result;
|
23738 | },
|
23739 | enter: function enter(coord) {
|
23740 | if (coord.isRect || coord.isTransposed || coord.type === 'theta') {
|
23741 | return Action.enter.fadeIn;
|
23742 | }
|
23743 | return Action.enter.zoomIn;
|
23744 | },
|
23745 | leave: function leave() {
|
23746 | return Action.leave.fadeOut;
|
23747 | },
|
23748 | update: function update(coord) {
|
23749 | if (coord.type === 'theta') {
|
23750 | return Action.update.fanIn;
|
23751 | }
|
23752 | }
|
23753 | },
|
23754 | point: {
|
23755 | appear: function appear() {
|
23756 | return Action.appear.zoomIn;
|
23757 | },
|
23758 | enter: function enter() {
|
23759 | return Action.enter.zoomIn;
|
23760 | },
|
23761 | leave: function leave() {
|
23762 | return Action.leave.zoomOut;
|
23763 | }
|
23764 | },
|
23765 | schema: {
|
23766 | appear: function appear() {
|
23767 | return Action.appear.clipIn;
|
23768 | },
|
23769 | enter: function enter() {
|
23770 | return Action.enter.clipIn;
|
23771 | },
|
23772 | leave: function leave() {
|
23773 | return Action.leave.lineWidthOut;
|
23774 | }
|
23775 | },
|
23776 | contour: null,
|
23777 | heatmap: null,
|
23778 | label: {
|
23779 | appear: function appear() {
|
23780 | return Action.appear.fadeIn;
|
23781 | },
|
23782 | enter: function enter() {
|
23783 | return Action.enter.fadeIn;
|
23784 | },
|
23785 | leave: function leave() {
|
23786 | return Action.leave.fadeOut;
|
23787 | },
|
23788 |
|
23789 | cfg: {
|
23790 | appear: {
|
23791 | duration: 900
|
23792 | }
|
23793 | }
|
23794 | },
|
23795 | 'axis-label': {
|
23796 | enter: function enter() {
|
23797 | return Action.appear.fadeIn;
|
23798 | },
|
23799 | leave: function leave() {
|
23800 | return Action.leave.fadeOut;
|
23801 | },
|
23802 | update: function update(coord) {
|
23803 | if (coord.isPolar) {
|
23804 | return Action.appear.fadeIn;
|
23805 | }
|
23806 | }
|
23807 | },
|
23808 | 'axis-ticks': {
|
23809 | enter: function enter() {
|
23810 | return Action.appear.fadeIn;
|
23811 | },
|
23812 | leave: function leave() {
|
23813 | return Action.leave.fadeOut;
|
23814 | },
|
23815 | update: function update(coord) {
|
23816 | if (coord.isPolar) {
|
23817 | return Action.appear.fadeIn;
|
23818 | }
|
23819 | }
|
23820 | },
|
23821 | 'axis-grid': {
|
23822 | enter: function enter() {
|
23823 | return Action.appear.fadeIn;
|
23824 | },
|
23825 | leave: function leave() {
|
23826 | return Action.leave.fadeOut;
|
23827 | },
|
23828 | update: function update(coord) {
|
23829 | if (coord.isPolar) {
|
23830 | return Action.appear.fadeIn;
|
23831 | }
|
23832 | }
|
23833 | },
|
23834 | 'axis-grid-rect': {
|
23835 | enter: function enter() {
|
23836 | return Action.appear.fadeIn;
|
23837 | },
|
23838 | leave: function leave() {
|
23839 | return Action.leave.fadeOut;
|
23840 | },
|
23841 | update: function update() {
|
23842 | return Action.leave.fadeIn;
|
23843 | }
|
23844 | },
|
23845 | labelLine: {
|
23846 | appear: function appear() {
|
23847 | return Action.appear.pathIn;
|
23848 | },
|
23849 | enter: function enter() {
|
23850 | return Action.enter.pathIn;
|
23851 | },
|
23852 | leave: function leave() {
|
23853 | return Action.leave.pathOut;
|
23854 | }
|
23855 | }
|
23856 | };
|
23857 |
|
23858 | Animate.Action = Action;
|
23859 | Animate.defaultCfg = defaultAnimationCfg;
|
23860 |
|
23861 |
|
23862 | Animate.getAnimation = function (geomType, coord, animationType) {
|
23863 | var geomAnimateCfg = this[geomType];
|
23864 | if (geomAnimateCfg) {
|
23865 | var animation = geomAnimateCfg[animationType];
|
23866 | if (Util.isFunction(animation)) {
|
23867 | return animation(coord);
|
23868 | }
|
23869 | }
|
23870 | return false;
|
23871 | };
|
23872 |
|
23873 |
|
23874 | Animate.getAnimateCfg = function (geomType, animationType) {
|
23875 | var defaultCfg = defaultAnimationCfg[animationType];
|
23876 | if (this[geomType] && this[geomType].cfg && this[geomType].cfg[animationType]) {
|
23877 | return Util.deepMix({}, defaultCfg, this[geomType].cfg[animationType]);
|
23878 | }
|
23879 | return defaultCfg;
|
23880 | };
|
23881 |
|
23882 |
|
23883 | Animate.registerAnimation = function (animationType, animationName, animationFun) {
|
23884 | if (!this.Action[animationType]) {
|
23885 | this.Action[animationType] = {};
|
23886 | }
|
23887 | this.Action[animationType][animationName] = animationFun;
|
23888 | };
|
23889 |
|
23890 | module.exports = Animate;
|
23891 |
|
23892 | }),
|
23893 |
|
23894 | (function(module, exports) {
|
23895 |
|
23896 |
|
23897 |
|
23898 |
|
23899 |
|
23900 |
|
23901 |
|
23902 |
|
23903 |
|
23904 |
|
23905 | function arrayEach(array, iteratee) {
|
23906 | var index = -1,
|
23907 | length = array == null ? 0 : array.length;
|
23908 |
|
23909 | while (++index < length) {
|
23910 | if (iteratee(array[index], index, array) === false) {
|
23911 | break;
|
23912 | }
|
23913 | }
|
23914 | return array;
|
23915 | }
|
23916 |
|
23917 | module.exports = arrayEach;
|
23918 |
|
23919 | }),
|
23920 |
|
23921 | (function(module, exports, __webpack_require__) {
|
23922 |
|
23923 | var baseTimes = __webpack_require__(132),
|
23924 | isArguments = __webpack_require__(28),
|
23925 | isArray = __webpack_require__(3),
|
23926 | isBuffer = __webpack_require__(29),
|
23927 | isIndex = __webpack_require__(30),
|
23928 | isTypedArray = __webpack_require__(46);
|
23929 |
|
23930 |
|
23931 | var objectProto = Object.prototype;
|
23932 |
|
23933 |
|
23934 | var hasOwnProperty = objectProto.hasOwnProperty;
|
23935 |
|
23936 |
|
23937 |
|
23938 |
|
23939 |
|
23940 |
|
23941 |
|
23942 |
|
23943 |
|
23944 | function arrayLikeKeys(value, inherited) {
|
23945 | var isArr = isArray(value),
|
23946 | isArg = !isArr && isArguments(value),
|
23947 | isBuff = !isArr && !isArg && isBuffer(value),
|
23948 | isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
23949 | skipIndexes = isArr || isArg || isBuff || isType,
|
23950 | result = skipIndexes ? baseTimes(value.length, String) : [],
|
23951 | length = result.length;
|
23952 |
|
23953 | for (var key in value) {
|
23954 | if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (
|
23955 |
|
23956 | key == 'length' ||
|
23957 |
|
23958 | isBuff && (key == 'offset' || key == 'parent') ||
|
23959 |
|
23960 | isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') ||
|
23961 |
|
23962 | isIndex(key, length)))) {
|
23963 | result.push(key);
|
23964 | }
|
23965 | }
|
23966 | return result;
|
23967 | }
|
23968 |
|
23969 | module.exports = arrayLikeKeys;
|
23970 |
|
23971 | }),
|
23972 |
|
23973 | (function(module, exports, __webpack_require__) {
|
23974 |
|
23975 | (function(global) {var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
23976 |
|
23977 |
|
23978 | var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global && global.Object === Object && global;
|
23979 |
|
23980 | module.exports = freeGlobal;
|
23981 | }.call(exports, __webpack_require__(134)))
|
23982 |
|
23983 | }),
|
23984 |
|
23985 | (function(module, exports) {
|
23986 |
|
23987 |
|
23988 |
|
23989 |
|
23990 |
|
23991 |
|
23992 |
|
23993 |
|
23994 | function baseUnary(func) {
|
23995 | return function (value) {
|
23996 | return func(value);
|
23997 | };
|
23998 | }
|
23999 |
|
24000 | module.exports = baseUnary;
|
24001 |
|
24002 | }),
|
24003 |
|
24004 | (function(module, exports, __webpack_require__) {
|
24005 |
|
24006 | (function(module) {var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
24007 |
|
24008 | var freeGlobal = __webpack_require__(71);
|
24009 |
|
24010 |
|
24011 | var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
|
24012 |
|
24013 |
|
24014 | var freeModule = freeExports && ( false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
|
24015 |
|
24016 |
|
24017 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
24018 |
|
24019 |
|
24020 | var freeProcess = moduleExports && freeGlobal.process;
|
24021 |
|
24022 |
|
24023 | var nodeUtil = function () {
|
24024 | try {
|
24025 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
24026 | } catch (e) {}
|
24027 | }();
|
24028 |
|
24029 | module.exports = nodeUtil;
|
24030 | }.call(exports, __webpack_require__(26)(module)))
|
24031 |
|
24032 | }),
|
24033 |
|
24034 | (function(module, exports, __webpack_require__) {
|
24035 |
|
24036 | var isPrototype = __webpack_require__(18),
|
24037 | nativeKeys = __webpack_require__(139);
|
24038 |
|
24039 |
|
24040 | var objectProto = Object.prototype;
|
24041 |
|
24042 |
|
24043 | var hasOwnProperty = objectProto.hasOwnProperty;
|
24044 |
|
24045 |
|
24046 |
|
24047 |
|
24048 |
|
24049 |
|
24050 |
|
24051 |
|
24052 | function baseKeys(object) {
|
24053 | if (!isPrototype(object)) {
|
24054 | return nativeKeys(object);
|
24055 | }
|
24056 | var result = [];
|
24057 | for (var key in Object(object)) {
|
24058 | if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
24059 | result.push(key);
|
24060 | }
|
24061 | }
|
24062 | return result;
|
24063 | }
|
24064 |
|
24065 | module.exports = baseKeys;
|
24066 |
|
24067 | }),
|
24068 |
|
24069 | (function(module, exports) {
|
24070 |
|
24071 |
|
24072 |
|
24073 |
|
24074 |
|
24075 |
|
24076 |
|
24077 |
|
24078 |
|
24079 | function overArg(func, transform) {
|
24080 | return function (arg) {
|
24081 | return func(transform(arg));
|
24082 | };
|
24083 | }
|
24084 |
|
24085 | module.exports = overArg;
|
24086 |
|
24087 | }),
|
24088 |
|
24089 | (function(module, exports) {
|
24090 |
|
24091 |
|
24092 | var funcProto = Function.prototype;
|
24093 |
|
24094 |
|
24095 | var funcToString = funcProto.toString;
|
24096 |
|
24097 |
|
24098 |
|
24099 |
|
24100 |
|
24101 |
|
24102 |
|
24103 |
|
24104 | function toSource(func) {
|
24105 | if (func != null) {
|
24106 | try {
|
24107 | return funcToString.call(func);
|
24108 | } catch (e) {}
|
24109 | try {
|
24110 | return func + '';
|
24111 | } catch (e) {}
|
24112 | }
|
24113 | return '';
|
24114 | }
|
24115 |
|
24116 | module.exports = toSource;
|
24117 |
|
24118 | }),
|
24119 |
|
24120 | (function(module, exports, __webpack_require__) {
|
24121 |
|
24122 | var SetCache = __webpack_require__(78),
|
24123 | arraySome = __webpack_require__(174),
|
24124 | cacheHas = __webpack_require__(79);
|
24125 |
|
24126 |
|
24127 | var COMPARE_PARTIAL_FLAG = 1,
|
24128 | COMPARE_UNORDERED_FLAG = 2;
|
24129 |
|
24130 |
|
24131 |
|
24132 |
|
24133 |
|
24134 |
|
24135 |
|
24136 |
|
24137 |
|
24138 |
|
24139 |
|
24140 |
|
24141 |
|
24142 |
|
24143 | function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
24144 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
24145 | arrLength = array.length,
|
24146 | othLength = other.length;
|
24147 |
|
24148 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
24149 | return false;
|
24150 | }
|
24151 |
|
24152 | var stacked = stack.get(array);
|
24153 | if (stacked && stack.get(other)) {
|
24154 | return stacked == other;
|
24155 | }
|
24156 | var index = -1,
|
24157 | result = true,
|
24158 | seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined;
|
24159 |
|
24160 | stack.set(array, other);
|
24161 | stack.set(other, array);
|
24162 |
|
24163 |
|
24164 | while (++index < arrLength) {
|
24165 | var arrValue = array[index],
|
24166 | othValue = other[index];
|
24167 |
|
24168 | if (customizer) {
|
24169 | var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
|
24170 | }
|
24171 | if (compared !== undefined) {
|
24172 | if (compared) {
|
24173 | continue;
|
24174 | }
|
24175 | result = false;
|
24176 | break;
|
24177 | }
|
24178 |
|
24179 | if (seen) {
|
24180 | if (!arraySome(other, function (othValue, othIndex) {
|
24181 | if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
24182 | return seen.push(othIndex);
|
24183 | }
|
24184 | })) {
|
24185 | result = false;
|
24186 | break;
|
24187 | }
|
24188 | } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
24189 | result = false;
|
24190 | break;
|
24191 | }
|
24192 | }
|
24193 | stack['delete'](array);
|
24194 | stack['delete'](other);
|
24195 | return result;
|
24196 | }
|
24197 |
|
24198 | module.exports = equalArrays;
|
24199 |
|
24200 | }),
|
24201 |
|
24202 | (function(module, exports, __webpack_require__) {
|
24203 |
|
24204 | var MapCache = __webpack_require__(52),
|
24205 | setCacheAdd = __webpack_require__(172),
|
24206 | setCacheHas = __webpack_require__(173);
|
24207 |
|
24208 |
|
24209 |
|
24210 |
|
24211 |
|
24212 |
|
24213 |
|
24214 |
|
24215 |
|
24216 | function SetCache(values) {
|
24217 | var index = -1,
|
24218 | length = values == null ? 0 : values.length;
|
24219 |
|
24220 | this.__data__ = new MapCache();
|
24221 | while (++index < length) {
|
24222 | this.add(values[index]);
|
24223 | }
|
24224 | }
|
24225 |
|
24226 |
|
24227 | SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
24228 | SetCache.prototype.has = setCacheHas;
|
24229 |
|
24230 | module.exports = SetCache;
|
24231 |
|
24232 | }),
|
24233 |
|
24234 | (function(module, exports) {
|
24235 |
|
24236 |
|
24237 |
|
24238 |
|
24239 |
|
24240 |
|
24241 |
|
24242 |
|
24243 |
|
24244 | function cacheHas(cache, key) {
|
24245 | return cache.has(key);
|
24246 | }
|
24247 |
|
24248 | module.exports = cacheHas;
|
24249 |
|
24250 | }),
|
24251 |
|
24252 | (function(module, exports, __webpack_require__) {
|
24253 |
|
24254 | var root = __webpack_require__(4);
|
24255 |
|
24256 |
|
24257 | var Uint8Array = root.Uint8Array;
|
24258 |
|
24259 | module.exports = Uint8Array;
|
24260 |
|
24261 | }),
|
24262 |
|
24263 | (function(module, exports, __webpack_require__) {
|
24264 |
|
24265 | var baseGetAllKeys = __webpack_require__(82),
|
24266 | getSymbols = __webpack_require__(55),
|
24267 | keys = __webpack_require__(11);
|
24268 |
|
24269 |
|
24270 |
|
24271 |
|
24272 |
|
24273 |
|
24274 |
|
24275 |
|
24276 | function getAllKeys(object) {
|
24277 | return baseGetAllKeys(object, keys, getSymbols);
|
24278 | }
|
24279 |
|
24280 | module.exports = getAllKeys;
|
24281 |
|
24282 | }),
|
24283 |
|
24284 | (function(module, exports, __webpack_require__) {
|
24285 |
|
24286 | var arrayPush = __webpack_require__(54),
|
24287 | isArray = __webpack_require__(3);
|
24288 |
|
24289 |
|
24290 |
|
24291 |
|
24292 |
|
24293 |
|
24294 |
|
24295 |
|
24296 |
|
24297 |
|
24298 |
|
24299 |
|
24300 | function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
24301 | var result = keysFunc(object);
|
24302 | return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
24303 | }
|
24304 |
|
24305 | module.exports = baseGetAllKeys;
|
24306 |
|
24307 | }),
|
24308 |
|
24309 | (function(module, exports) {
|
24310 |
|
24311 |
|
24312 |
|
24313 |
|
24314 |
|
24315 |
|
24316 |
|
24317 |
|
24318 |
|
24319 |
|
24320 | function arrayFilter(array, predicate) {
|
24321 | var index = -1,
|
24322 | length = array == null ? 0 : array.length,
|
24323 | resIndex = 0,
|
24324 | result = [];
|
24325 |
|
24326 | while (++index < length) {
|
24327 | var value = array[index];
|
24328 | if (predicate(value, index, array)) {
|
24329 | result[resIndex++] = value;
|
24330 | }
|
24331 | }
|
24332 | return result;
|
24333 | }
|
24334 |
|
24335 | module.exports = arrayFilter;
|
24336 |
|
24337 | }),
|
24338 |
|
24339 | (function(module, exports) {
|
24340 |
|
24341 |
|
24342 |
|
24343 |
|
24344 |
|
24345 |
|
24346 |
|
24347 |
|
24348 |
|
24349 |
|
24350 |
|
24351 |
|
24352 |
|
24353 |
|
24354 |
|
24355 |
|
24356 |
|
24357 |
|
24358 |
|
24359 | function stubArray() {
|
24360 | return [];
|
24361 | }
|
24362 |
|
24363 | module.exports = stubArray;
|
24364 |
|
24365 | }),
|
24366 |
|
24367 | (function(module, exports, __webpack_require__) {
|
24368 |
|
24369 | var getNative = __webpack_require__(13),
|
24370 | root = __webpack_require__(4);
|
24371 |
|
24372 |
|
24373 | var Set = getNative(root, 'Set');
|
24374 |
|
24375 | module.exports = Set;
|
24376 |
|
24377 | }),
|
24378 |
|
24379 | (function(module, exports, __webpack_require__) {
|
24380 |
|
24381 | var isObject = __webpack_require__(7);
|
24382 |
|
24383 |
|
24384 |
|
24385 |
|
24386 |
|
24387 |
|
24388 |
|
24389 |
|
24390 |
|
24391 | function isStrictComparable(value) {
|
24392 | return value === value && !isObject(value);
|
24393 | }
|
24394 |
|
24395 | module.exports = isStrictComparable;
|
24396 |
|
24397 | }),
|
24398 |
|
24399 | (function(module, exports) {
|
24400 |
|
24401 |
|
24402 |
|
24403 |
|
24404 |
|
24405 |
|
24406 |
|
24407 |
|
24408 |
|
24409 |
|
24410 | function matchesStrictComparable(key, srcValue) {
|
24411 | return function (object) {
|
24412 | if (object == null) {
|
24413 | return false;
|
24414 | }
|
24415 | return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
|
24416 | };
|
24417 | }
|
24418 |
|
24419 | module.exports = matchesStrictComparable;
|
24420 |
|
24421 | }),
|
24422 |
|
24423 | (function(module, exports, __webpack_require__) {
|
24424 |
|
24425 | var baseHasIn = __webpack_require__(187),
|
24426 | hasPath = __webpack_require__(188);
|
24427 |
|
24428 |
|
24429 |
|
24430 |
|
24431 |
|
24432 |
|
24433 |
|
24434 |
|
24435 |
|
24436 |
|
24437 |
|
24438 |
|
24439 |
|
24440 |
|
24441 |
|
24442 |
|
24443 |
|
24444 |
|
24445 |
|
24446 |
|
24447 |
|
24448 |
|
24449 |
|
24450 |
|
24451 |
|
24452 |
|
24453 |
|
24454 | function hasIn(object, path) {
|
24455 | return object != null && hasPath(object, path, baseHasIn);
|
24456 | }
|
24457 |
|
24458 | module.exports = hasIn;
|
24459 |
|
24460 | }),
|
24461 |
|
24462 | (function(module, exports, __webpack_require__) {
|
24463 |
|
24464 | var baseGetTag = __webpack_require__(6),
|
24465 | isArray = __webpack_require__(3),
|
24466 | isObjectLike = __webpack_require__(5);
|
24467 |
|
24468 |
|
24469 | var stringTag = '[object String]';
|
24470 |
|
24471 |
|
24472 |
|
24473 |
|
24474 |
|
24475 |
|
24476 |
|
24477 |
|
24478 |
|
24479 |
|
24480 |
|
24481 |
|
24482 |
|
24483 |
|
24484 |
|
24485 |
|
24486 |
|
24487 |
|
24488 | function isString(value) {
|
24489 | return typeof value == 'string' || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
|
24490 | }
|
24491 |
|
24492 | module.exports = isString;
|
24493 |
|
24494 | }),
|
24495 |
|
24496 | (function(module, exports, __webpack_require__) {
|
24497 |
|
24498 | var castSlice = __webpack_require__(198),
|
24499 | hasUnicode = __webpack_require__(91),
|
24500 | stringToArray = __webpack_require__(92),
|
24501 | toString = __webpack_require__(15);
|
24502 |
|
24503 |
|
24504 |
|
24505 |
|
24506 |
|
24507 |
|
24508 |
|
24509 |
|
24510 | function createCaseFirst(methodName) {
|
24511 | return function (string) {
|
24512 | string = toString(string);
|
24513 |
|
24514 | var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined;
|
24515 |
|
24516 | var chr = strSymbols ? strSymbols[0] : string.charAt(0);
|
24517 |
|
24518 | var trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1);
|
24519 |
|
24520 | return chr[methodName]() + trailing;
|
24521 | };
|
24522 | }
|
24523 |
|
24524 | module.exports = createCaseFirst;
|
24525 |
|
24526 | }),
|
24527 |
|
24528 | (function(module, exports) {
|
24529 |
|
24530 |
|
24531 | var rsAstralRange = '\\ud800-\\udfff',
|
24532 | rsComboMarksRange = '\\u0300-\\u036f',
|
24533 | reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
24534 | rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
24535 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
24536 | rsVarRange = '\\ufe0e\\ufe0f';
|
24537 |
|
24538 |
|
24539 | var rsZWJ = '\\u200d';
|
24540 |
|
24541 |
|
24542 | var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
|
24543 |
|
24544 |
|
24545 |
|
24546 |
|
24547 |
|
24548 |
|
24549 |
|
24550 |
|
24551 | function hasUnicode(string) {
|
24552 | return reHasUnicode.test(string);
|
24553 | }
|
24554 |
|
24555 | module.exports = hasUnicode;
|
24556 |
|
24557 | }),
|
24558 |
|
24559 | (function(module, exports, __webpack_require__) {
|
24560 |
|
24561 | var asciiToArray = __webpack_require__(200),
|
24562 | hasUnicode = __webpack_require__(91),
|
24563 | unicodeToArray = __webpack_require__(201);
|
24564 |
|
24565 |
|
24566 |
|
24567 |
|
24568 |
|
24569 |
|
24570 |
|
24571 |
|
24572 | function stringToArray(string) {
|
24573 | return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
|
24574 | }
|
24575 |
|
24576 | module.exports = stringToArray;
|
24577 |
|
24578 | }),
|
24579 |
|
24580 | (function(module, exports) {
|
24581 |
|
24582 |
|
24583 |
|
24584 |
|
24585 |
|
24586 |
|
24587 |
|
24588 |
|
24589 |
|
24590 |
|
24591 |
|
24592 |
|
24593 |
|
24594 |
|
24595 |
|
24596 |
|
24597 |
|
24598 |
|
24599 |
|
24600 |
|
24601 |
|
24602 | function isNil(value) {
|
24603 | return value == null;
|
24604 | }
|
24605 |
|
24606 | module.exports = isNil;
|
24607 |
|
24608 | }),
|
24609 |
|
24610 | (function(module, exports) {
|
24611 |
|
24612 |
|
24613 |
|
24614 |
|
24615 |
|
24616 |
|
24617 |
|
24618 |
|
24619 |
|
24620 | function copyArray(source, array) {
|
24621 | var index = -1,
|
24622 | length = source.length;
|
24623 |
|
24624 | array || (array = Array(length));
|
24625 | while (++index < length) {
|
24626 | array[index] = source[index];
|
24627 | }
|
24628 | return array;
|
24629 | }
|
24630 |
|
24631 | module.exports = copyArray;
|
24632 |
|
24633 | }),
|
24634 |
|
24635 | (function(module, exports, __webpack_require__) {
|
24636 |
|
24637 | var baseFindIndex = __webpack_require__(221),
|
24638 | baseIsNaN = __webpack_require__(222),
|
24639 | strictIndexOf = __webpack_require__(223);
|
24640 |
|
24641 |
|
24642 |
|
24643 |
|
24644 |
|
24645 |
|
24646 |
|
24647 |
|
24648 |
|
24649 |
|
24650 | function baseIndexOf(array, value, fromIndex) {
|
24651 | return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
|
24652 | }
|
24653 |
|
24654 | module.exports = baseIndexOf;
|
24655 |
|
24656 | }),
|
24657 |
|
24658 | (function(module, exports, __webpack_require__) {
|
24659 |
|
24660 | var toFinite = __webpack_require__(224);
|
24661 |
|
24662 |
|
24663 |
|
24664 |
|
24665 |
|
24666 |
|
24667 |
|
24668 |
|
24669 |
|
24670 |
|
24671 |
|
24672 |
|
24673 |
|
24674 |
|
24675 |
|
24676 |
|
24677 |
|
24678 |
|
24679 |
|
24680 |
|
24681 |
|
24682 |
|
24683 |
|
24684 |
|
24685 |
|
24686 |
|
24687 |
|
24688 | function toInteger(value) {
|
24689 | var result = toFinite(value),
|
24690 | remainder = result % 1;
|
24691 |
|
24692 | return result === result ? remainder ? result - remainder : result : 0;
|
24693 | }
|
24694 |
|
24695 | module.exports = toInteger;
|
24696 |
|
24697 | }),
|
24698 |
|
24699 | (function(module, exports, __webpack_require__) {
|
24700 |
|
24701 | var isObject = __webpack_require__(7),
|
24702 | isSymbol = __webpack_require__(21);
|
24703 |
|
24704 |
|
24705 | var NAN = 0 / 0;
|
24706 |
|
24707 |
|
24708 | var reTrim = /^\s+|\s+$/g;
|
24709 |
|
24710 |
|
24711 | var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
24712 |
|
24713 |
|
24714 | var reIsBinary = /^0b[01]+$/i;
|
24715 |
|
24716 |
|
24717 | var reIsOctal = /^0o[0-7]+$/i;
|
24718 |
|
24719 |
|
24720 | var freeParseInt = parseInt;
|
24721 |
|
24722 |
|
24723 |
|
24724 |
|
24725 |
|
24726 |
|
24727 |
|
24728 |
|
24729 |
|
24730 |
|
24731 |
|
24732 |
|
24733 |
|
24734 |
|
24735 |
|
24736 |
|
24737 |
|
24738 |
|
24739 |
|
24740 |
|
24741 |
|
24742 |
|
24743 |
|
24744 |
|
24745 | function toNumber(value) {
|
24746 | if (typeof value == 'number') {
|
24747 | return value;
|
24748 | }
|
24749 | if (isSymbol(value)) {
|
24750 | return NAN;
|
24751 | }
|
24752 | if (isObject(value)) {
|
24753 | var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
24754 | value = isObject(other) ? other + '' : other;
|
24755 | }
|
24756 | if (typeof value != 'string') {
|
24757 | return value === 0 ? value : +value;
|
24758 | }
|
24759 | value = value.replace(reTrim, '');
|
24760 | var isBinary = reIsBinary.test(value);
|
24761 | return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
24762 | }
|
24763 |
|
24764 | module.exports = toNumber;
|
24765 |
|
24766 | }),
|
24767 |
|
24768 | (function(module, exports, __webpack_require__) {
|
24769 |
|
24770 | var getNative = __webpack_require__(13);
|
24771 |
|
24772 | var defineProperty = function () {
|
24773 | try {
|
24774 | var func = getNative(Object, 'defineProperty');
|
24775 | func({}, '', {});
|
24776 | return func;
|
24777 | } catch (e) {}
|
24778 | }();
|
24779 |
|
24780 | module.exports = defineProperty;
|
24781 |
|
24782 | }),
|
24783 |
|
24784 | (function(module, exports, __webpack_require__) {
|
24785 |
|
24786 | var identity = __webpack_require__(31),
|
24787 | overRest = __webpack_require__(100),
|
24788 | setToString = __webpack_require__(101);
|
24789 |
|
24790 |
|
24791 |
|
24792 |
|
24793 |
|
24794 |
|
24795 |
|
24796 |
|
24797 |
|
24798 | function baseRest(func, start) {
|
24799 | return setToString(overRest(func, start, identity), func + '');
|
24800 | }
|
24801 |
|
24802 | module.exports = baseRest;
|
24803 |
|
24804 | }),
|
24805 |
|
24806 | (function(module, exports, __webpack_require__) {
|
24807 |
|
24808 | var apply = __webpack_require__(226);
|
24809 |
|
24810 |
|
24811 | var nativeMax = Math.max;
|
24812 |
|
24813 |
|
24814 |
|
24815 |
|
24816 |
|
24817 |
|
24818 |
|
24819 |
|
24820 |
|
24821 |
|
24822 | function overRest(func, start, transform) {
|
24823 | start = nativeMax(start === undefined ? func.length - 1 : start, 0);
|
24824 | return function () {
|
24825 | var args = arguments,
|
24826 | index = -1,
|
24827 | length = nativeMax(args.length - start, 0),
|
24828 | array = Array(length);
|
24829 |
|
24830 | while (++index < length) {
|
24831 | array[index] = args[start + index];
|
24832 | }
|
24833 | index = -1;
|
24834 | var otherArgs = Array(start + 1);
|
24835 | while (++index < start) {
|
24836 | otherArgs[index] = args[index];
|
24837 | }
|
24838 | otherArgs[start] = transform(array);
|
24839 | return apply(func, this, otherArgs);
|
24840 | };
|
24841 | }
|
24842 |
|
24843 | module.exports = overRest;
|
24844 |
|
24845 | }),
|
24846 |
|
24847 | (function(module, exports, __webpack_require__) {
|
24848 |
|
24849 | var baseSetToString = __webpack_require__(227),
|
24850 | shortOut = __webpack_require__(229);
|
24851 |
|
24852 |
|
24853 |
|
24854 |
|
24855 |
|
24856 |
|
24857 |
|
24858 |
|
24859 |
|
24860 | var setToString = shortOut(baseSetToString);
|
24861 |
|
24862 | module.exports = setToString;
|
24863 |
|
24864 | }),
|
24865 |
|
24866 | (function(module, exports, __webpack_require__) {
|
24867 |
|
24868 | var baseClone = __webpack_require__(235);
|
24869 |
|
24870 |
|
24871 | var CLONE_DEEP_FLAG = 1,
|
24872 | CLONE_SYMBOLS_FLAG = 4;
|
24873 |
|
24874 |
|
24875 |
|
24876 |
|
24877 |
|
24878 |
|
24879 |
|
24880 |
|
24881 |
|
24882 |
|
24883 |
|
24884 |
|
24885 |
|
24886 |
|
24887 |
|
24888 |
|
24889 |
|
24890 |
|
24891 |
|
24892 | function cloneDeep(value) {
|
24893 | return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
24894 | }
|
24895 |
|
24896 | module.exports = cloneDeep;
|
24897 |
|
24898 | }),
|
24899 |
|
24900 | (function(module, exports, __webpack_require__) {
|
24901 |
|
24902 | var arrayLikeKeys = __webpack_require__(70),
|
24903 | baseKeysIn = __webpack_require__(238),
|
24904 | isArrayLike = __webpack_require__(8);
|
24905 |
|
24906 |
|
24907 |
|
24908 |
|
24909 |
|
24910 |
|
24911 |
|
24912 |
|
24913 |
|
24914 |
|
24915 |
|
24916 |
|
24917 |
|
24918 |
|
24919 |
|
24920 |
|
24921 |
|
24922 |
|
24923 |
|
24924 |
|
24925 |
|
24926 |
|
24927 |
|
24928 |
|
24929 | function keysIn(object) {
|
24930 | return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
24931 | }
|
24932 |
|
24933 | module.exports = keysIn;
|
24934 |
|
24935 | }),
|
24936 |
|
24937 | (function(module, exports, __webpack_require__) {
|
24938 |
|
24939 | var arrayPush = __webpack_require__(54),
|
24940 | getPrototype = __webpack_require__(59),
|
24941 | getSymbols = __webpack_require__(55),
|
24942 | stubArray = __webpack_require__(84);
|
24943 |
|
24944 |
|
24945 | var nativeGetSymbols = Object.getOwnPropertySymbols;
|
24946 |
|
24947 |
|
24948 |
|
24949 |
|
24950 |
|
24951 |
|
24952 |
|
24953 |
|
24954 | var getSymbolsIn = !nativeGetSymbols ? stubArray : function (object) {
|
24955 | var result = [];
|
24956 | while (object) {
|
24957 | arrayPush(result, getSymbols(object));
|
24958 | object = getPrototype(object);
|
24959 | }
|
24960 | return result;
|
24961 | };
|
24962 |
|
24963 | module.exports = getSymbolsIn;
|
24964 |
|
24965 | }),
|
24966 |
|
24967 | (function(module, exports, __webpack_require__) {
|
24968 |
|
24969 | var isSymbol = __webpack_require__(21);
|
24970 |
|
24971 |
|
24972 |
|
24973 |
|
24974 |
|
24975 |
|
24976 |
|
24977 |
|
24978 |
|
24979 |
|
24980 |
|
24981 | function baseExtremum(array, iteratee, comparator) {
|
24982 | var index = -1,
|
24983 | length = array.length;
|
24984 |
|
24985 | while (++index < length) {
|
24986 | var value = array[index],
|
24987 | current = iteratee(value);
|
24988 |
|
24989 | if (current != null && (computed === undefined ? current === current && !isSymbol(current) : comparator(current, computed))) {
|
24990 | var computed = current,
|
24991 | result = value;
|
24992 | }
|
24993 | }
|
24994 | return result;
|
24995 | }
|
24996 |
|
24997 | module.exports = baseExtremum;
|
24998 |
|
24999 | }),
|
25000 |
|
25001 | (function(module, exports, __webpack_require__) {
|
25002 |
|
25003 | var arrayPush = __webpack_require__(54),
|
25004 | isFlattenable = __webpack_require__(268);
|
25005 |
|
25006 |
|
25007 |
|
25008 |
|
25009 |
|
25010 |
|
25011 |
|
25012 |
|
25013 |
|
25014 |
|
25015 |
|
25016 |
|
25017 | function baseFlatten(array, depth, predicate, isStrict, result) {
|
25018 | var index = -1,
|
25019 | length = array.length;
|
25020 |
|
25021 | predicate || (predicate = isFlattenable);
|
25022 | result || (result = []);
|
25023 |
|
25024 | while (++index < length) {
|
25025 | var value = array[index];
|
25026 | if (depth > 0 && predicate(value)) {
|
25027 | if (depth > 1) {
|
25028 |
|
25029 | baseFlatten(value, depth - 1, predicate, isStrict, result);
|
25030 | } else {
|
25031 | arrayPush(result, value);
|
25032 | }
|
25033 | } else if (!isStrict) {
|
25034 | result[result.length] = value;
|
25035 | }
|
25036 | }
|
25037 | return result;
|
25038 | }
|
25039 |
|
25040 | module.exports = baseFlatten;
|
25041 |
|
25042 | }),
|
25043 |
|
25044 | (function(module, exports, __webpack_require__) {
|
25045 |
|
25046 | var SetCache = __webpack_require__(78),
|
25047 | arrayIncludes = __webpack_require__(269),
|
25048 | arrayIncludesWith = __webpack_require__(270),
|
25049 | cacheHas = __webpack_require__(79),
|
25050 | createSet = __webpack_require__(271),
|
25051 | setToArray = __webpack_require__(20);
|
25052 |
|
25053 |
|
25054 | var LARGE_ARRAY_SIZE = 200;
|
25055 |
|
25056 |
|
25057 |
|
25058 |
|
25059 |
|
25060 |
|
25061 |
|
25062 |
|
25063 |
|
25064 |
|
25065 | function baseUniq(array, iteratee, comparator) {
|
25066 | var index = -1,
|
25067 | includes = arrayIncludes,
|
25068 | length = array.length,
|
25069 | isCommon = true,
|
25070 | result = [],
|
25071 | seen = result;
|
25072 |
|
25073 | if (comparator) {
|
25074 | isCommon = false;
|
25075 | includes = arrayIncludesWith;
|
25076 | } else if (length >= LARGE_ARRAY_SIZE) {
|
25077 | var set = iteratee ? null : createSet(array);
|
25078 | if (set) {
|
25079 | return setToArray(set);
|
25080 | }
|
25081 | isCommon = false;
|
25082 | includes = cacheHas;
|
25083 | seen = new SetCache();
|
25084 | } else {
|
25085 | seen = iteratee ? [] : result;
|
25086 | }
|
25087 | outer: while (++index < length) {
|
25088 | var value = array[index],
|
25089 | computed = iteratee ? iteratee(value) : value;
|
25090 |
|
25091 | value = comparator || value !== 0 ? value : 0;
|
25092 | if (isCommon && computed === computed) {
|
25093 | var seenIndex = seen.length;
|
25094 | while (seenIndex--) {
|
25095 | if (seen[seenIndex] === computed) {
|
25096 | continue outer;
|
25097 | }
|
25098 | }
|
25099 | if (iteratee) {
|
25100 | seen.push(computed);
|
25101 | }
|
25102 | result.push(value);
|
25103 | } else if (!includes(seen, computed, comparator)) {
|
25104 | if (seen !== result) {
|
25105 | seen.push(computed);
|
25106 | }
|
25107 | result.push(value);
|
25108 | }
|
25109 | }
|
25110 | return result;
|
25111 | }
|
25112 |
|
25113 | module.exports = baseUniq;
|
25114 |
|
25115 | }),
|
25116 |
|
25117 | (function(module, exports) {
|
25118 |
|
25119 | var _html, _tooltip;
|
25120 |
|
25121 |
|
25122 |
|
25123 |
|
25124 |
|
25125 | var DEFAULT_COLOR = '#1890FF';
|
25126 | var COLOR_PLATE_8 = ['#1890FF', '#2FC25B', '#FACC14', '#223273', '#8543E0', '#13C2C2', '#3436C7', '#F04864'];
|
25127 | var COLOR_PLATE_16 = ['#1890FF', '#41D9C7', '#2FC25B', '#FACC14', '#E6965C', '#223273', '#7564CC', '#8543E0', '#5C8EE6', '#13C2C2', '#5CA3E6', '#3436C7', '#B381E6', '#F04864', '#D598D9'];
|
25128 | var COLOR_PLATE_24 = ['#1890FF', '#66B5FF', '#41D9C7', '#2FC25B', '#6EDB8F', '#9AE65C', '#FACC14', '#E6965C', '#57AD71', '#223273', '#738AE6', '#7564CC', '#8543E0', '#A877ED', '#5C8EE6', '#13C2C2', '#70E0E0', '#5CA3E6', '#3436C7', '#8082FF', '#DD81E6', '#F04864', '#FA7D92', '#D598D9'];
|
25129 | var COLOR_PIE = ['#1890FF', '#13C2C2', '#2FC25B', '#FACC14', '#F04864', '#8543E0', '#3436C7', '#223273'];
|
25130 | var COLOR_PIE_16 = ['#1890FF', '#73C9E6', '#13C2C2', '#6CD9B3', '#2FC25B', '#9DD96C', '#FACC14', '#E6965C', '#F04864', '#D66BCA', '#8543E0', '#8E77ED', '#3436C7', '#737EE6', '#223273', '#7EA2E6'];
|
25131 |
|
25132 | var FONT_FAMILY = '"-apple-system", BlinkMacSystemFont, "Segoe UI", Roboto,"Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",SimSun, "sans-serif"';
|
25133 |
|
25134 | var TOOLTIP_CONTAINER_CLASS = 'g2-tooltip';
|
25135 | var TOOLTIP_TITLE_CLASS = 'g2-tooltip-title';
|
25136 | var TOOLTIP_LIST_CLASS = 'g2-tooltip-list';
|
25137 | var TOOLTIP_LIST_ITEM_CLASS = 'g2-tooltip-list-item';
|
25138 | var TOOLTIP_MARKER_CLASS = 'g2-tooltip-marker';
|
25139 |
|
25140 |
|
25141 | var LEGEND_CONTAINER_CLASS = 'g2-legend';
|
25142 | var LEGEND_TITLE_CLASS = 'g2-legend-title';
|
25143 | var LEGEND_LIST_CLASS = 'g2-legend-list';
|
25144 | var LEGEND_LIST_ITEM_CLASS = 'g2-legend-list-item';
|
25145 | var LEGEND_MARKER_CLASS = 'g2-legend-marker';
|
25146 |
|
25147 | var Theme = {
|
25148 | defaultColor: DEFAULT_COLOR,
|
25149 | plotCfg: {
|
25150 | padding: [20, 20, 95, 80]
|
25151 | },
|
25152 | fontFamily: FONT_FAMILY,
|
25153 | defaultLegendPosition: 'bottom',
|
25154 | colors: COLOR_PLATE_8,
|
25155 | colors_16: COLOR_PLATE_16,
|
25156 | colors_24: COLOR_PLATE_24,
|
25157 | colors_pie: COLOR_PIE,
|
25158 | colors_pie_16: COLOR_PIE_16,
|
25159 | shapes: {
|
25160 | point: ['hollowCircle', 'hollowSquare', 'hollowDiamond', 'hollowBowtie', 'hollowTriangle', 'hollowHexagon', 'cross', 'tick', 'plus', 'hyphen', 'line'],
|
25161 | line: ['line', 'dash', 'dot'],
|
25162 | area: ['area']
|
25163 | },
|
25164 | sizes: [1, 10],
|
25165 | opacities: [0.1, 0.9],
|
25166 | axis: {
|
25167 | top: {
|
25168 |
|
25169 | position: 'top',
|
25170 | title: null,
|
25171 | label: {
|
25172 | offset: 14,
|
25173 | textStyle: {
|
25174 | fill: '#545454',
|
25175 | fontSize: 12,
|
25176 | lineHeight: 20,
|
25177 | textBaseline: 'middle',
|
25178 | fontFamily: FONT_FAMILY
|
25179 | },
|
25180 | autoRotate: true
|
25181 | },
|
25182 | line: {
|
25183 | lineWidth: 1,
|
25184 | stroke: '#BFBFBF'
|
25185 | },
|
25186 | tickLine: {
|
25187 | lineWidth: 1,
|
25188 | stroke: '#BFBFBF',
|
25189 | length: 4
|
25190 | }
|
25191 | },
|
25192 | bottom: {
|
25193 | position: 'bottom',
|
25194 | title: null,
|
25195 | label: {
|
25196 | offset: 22,
|
25197 | autoRotate: true,
|
25198 | textStyle: {
|
25199 | fill: '#545454',
|
25200 | fontSize: 12,
|
25201 | lineHeight: 20,
|
25202 | textBaseline: 'middle',
|
25203 | fontFamily: FONT_FAMILY
|
25204 | }
|
25205 | },
|
25206 | line: {
|
25207 | lineWidth: 1,
|
25208 | stroke: '#BFBFBF'
|
25209 | },
|
25210 | tickLine: {
|
25211 | lineWidth: 1,
|
25212 | stroke: '#BFBFBF',
|
25213 | length: 4
|
25214 | }
|
25215 | },
|
25216 | left: {
|
25217 | position: 'left',
|
25218 | title: null,
|
25219 | label: {
|
25220 | offset: 12,
|
25221 | autoRotate: true,
|
25222 | textStyle: {
|
25223 | fill: '#545454',
|
25224 | fontSize: 12,
|
25225 | lineHeight: 20,
|
25226 | textBaseline: 'middle',
|
25227 | fontFamily: FONT_FAMILY
|
25228 | }
|
25229 | },
|
25230 | line: null,
|
25231 | tickLine: null,
|
25232 | grid: {
|
25233 | lineStyle: {
|
25234 | stroke: '#E9E9E9',
|
25235 | lineWidth: 1,
|
25236 | lineDash: [3, 3]
|
25237 | },
|
25238 | hideFirstLine: true
|
25239 | }
|
25240 | },
|
25241 | right: {
|
25242 | position: 'right',
|
25243 | title: null,
|
25244 | label: {
|
25245 | offset: 12,
|
25246 | autoRotate: true,
|
25247 | textStyle: {
|
25248 | fill: '#545454',
|
25249 | fontSize: 12,
|
25250 | lineHeight: 20,
|
25251 | textBaseline: 'middle',
|
25252 | fontFamily: FONT_FAMILY
|
25253 | }
|
25254 | },
|
25255 | line: null,
|
25256 | tickLine: null,
|
25257 | grid: {
|
25258 | lineStyle: {
|
25259 | stroke: '#E9E9E9',
|
25260 | lineWidth: 1,
|
25261 | lineDash: [3, 3]
|
25262 | },
|
25263 | hideFirstLine: true
|
25264 | }
|
25265 | },
|
25266 | circle: {
|
25267 | zIndex: 1,
|
25268 | title: null,
|
25269 | label: {
|
25270 | offset: 12,
|
25271 | textStyle: {
|
25272 | fill: '#545454',
|
25273 | fontSize: 12,
|
25274 | lineHeight: 20,
|
25275 | fontFamily: FONT_FAMILY
|
25276 | }
|
25277 | },
|
25278 | line: {
|
25279 | lineWidth: 1,
|
25280 | stroke: '#BFBFBF'
|
25281 | },
|
25282 | tickLine: {
|
25283 | lineWidth: 1,
|
25284 | stroke: '#BFBFBF',
|
25285 | length: 4
|
25286 | },
|
25287 | grid: {
|
25288 | lineStyle: {
|
25289 | stroke: '#E9E9E9',
|
25290 | lineWidth: 1,
|
25291 | lineDash: [3, 3]
|
25292 | },
|
25293 | hideFirstLine: true
|
25294 | }
|
25295 | },
|
25296 | radius: {
|
25297 | zIndex: 0,
|
25298 | label: {
|
25299 | offset: 12,
|
25300 | textStyle: {
|
25301 | fill: '#545454',
|
25302 | fontSize: 12,
|
25303 | textBaseline: 'middle',
|
25304 | lineHeight: 20,
|
25305 | fontFamily: FONT_FAMILY
|
25306 | }
|
25307 | },
|
25308 | line: {
|
25309 | lineWidth: 1,
|
25310 | stroke: '#BFBFBF'
|
25311 | },
|
25312 | tickLine: {
|
25313 | lineWidth: 1,
|
25314 | stroke: '#BFBFBF',
|
25315 | length: 4
|
25316 | },
|
25317 | grid: {
|
25318 | lineStyle: {
|
25319 | stroke: '#E9E9E9',
|
25320 | lineWidth: 1,
|
25321 | lineDash: [3, 3]
|
25322 | },
|
25323 | type: 'circle'
|
25324 | }
|
25325 | },
|
25326 | helix: {
|
25327 | grid: null,
|
25328 | label: null,
|
25329 | title: null,
|
25330 | line: {
|
25331 | lineWidth: 1,
|
25332 | stroke: '#BFBFBF'
|
25333 | },
|
25334 | tickLine: {
|
25335 | lineWidth: 1,
|
25336 | length: 4,
|
25337 | stroke: '#BFBFBF'
|
25338 | }
|
25339 | }
|
25340 | },
|
25341 | label: {
|
25342 | offset: 20,
|
25343 | textStyle: {
|
25344 | fill: '#545454',
|
25345 | fontSize: 12,
|
25346 | textBaseline: 'middle',
|
25347 | fontFamily: FONT_FAMILY
|
25348 | }
|
25349 | },
|
25350 | treemapLabels: {
|
25351 | offset: 10,
|
25352 | textStyle: {
|
25353 | fill: '#fff',
|
25354 | fontSize: 12,
|
25355 | textBaseline: 'top',
|
25356 | fontStyle: 'bold',
|
25357 | fontFamily: FONT_FAMILY
|
25358 | }
|
25359 | },
|
25360 | innerLabels: {
|
25361 | textStyle: {
|
25362 | fill: '#fff',
|
25363 | fontSize: 12,
|
25364 | textBaseline: 'middle',
|
25365 | fontFamily: FONT_FAMILY
|
25366 | }
|
25367 | },
|
25368 |
|
25369 | thetaLabels: {
|
25370 | labelLine: {
|
25371 | lineWidth: 1
|
25372 | },
|
25373 | labelHeight: 14,
|
25374 | offset: 30
|
25375 |
|
25376 | },
|
25377 | legend: {
|
25378 | right: {
|
25379 | position: 'right',
|
25380 | layout: 'vertical',
|
25381 | itemMarginBottom: 8,
|
25382 | width: 16,
|
25383 | height: 156,
|
25384 | title: null,
|
25385 | textStyle: {
|
25386 | fill: '#8C8C8C',
|
25387 | fontSize: 12,
|
25388 | textAlign: 'start',
|
25389 | textBaseline: 'middle',
|
25390 | lineHeight: 20,
|
25391 | fontFamily: FONT_FAMILY
|
25392 | },
|
25393 | unCheckColor: '#bfbfbf'
|
25394 | },
|
25395 | left: {
|
25396 | position: 'left',
|
25397 | layout: 'vertical',
|
25398 | itemMarginBottom: 8,
|
25399 | width: 16,
|
25400 | height: 156,
|
25401 | title: null,
|
25402 | textStyle: {
|
25403 | fill: '#8C8C8C',
|
25404 | fontSize: 12,
|
25405 | textAlign: 'start',
|
25406 | textBaseline: 'middle',
|
25407 | lineHeight: 20,
|
25408 | fontFamily: FONT_FAMILY
|
25409 | },
|
25410 | unCheckColor: '#bfbfbf'
|
25411 | },
|
25412 | top: {
|
25413 | position: 'top',
|
25414 | offset: 6,
|
25415 | layout: 'horizontal',
|
25416 | title: null,
|
25417 | itemGap: 10,
|
25418 | width: 156,
|
25419 | height: 16,
|
25420 | textStyle: {
|
25421 | fill: '#8C8C8C',
|
25422 | fontSize: 12,
|
25423 | textAlign: 'start',
|
25424 | textBaseline: 'middle',
|
25425 | lineHeight: 20,
|
25426 | fontFamily: FONT_FAMILY
|
25427 | },
|
25428 | unCheckColor: '#bfbfbf'
|
25429 | },
|
25430 | bottom: {
|
25431 | position: 'bottom',
|
25432 | offset: 58,
|
25433 | layout: 'horizontal',
|
25434 | title: null,
|
25435 | itemGap: 24,
|
25436 | width: 156,
|
25437 | height: 16,
|
25438 | textStyle: {
|
25439 | fill: '#8C8C8C',
|
25440 | fontSize: 12,
|
25441 | textAlign: 'start',
|
25442 | textBaseline: 'middle',
|
25443 | lineHeight: 20,
|
25444 | fontFamily: FONT_FAMILY
|
25445 | },
|
25446 | unCheckColor: '#bfbfbf'
|
25447 | },
|
25448 |
|
25449 | html: (_html = {}, _html['' + LEGEND_CONTAINER_CLASS] = {
|
25450 | height: 'auto',
|
25451 | width: 'auto',
|
25452 | position: 'absolute',
|
25453 | overflow: 'scroll',
|
25454 | fontSize: '12px',
|
25455 | fontFamily: FONT_FAMILY,
|
25456 | lineHeight: '20px',
|
25457 | color: '#8C8C8C'
|
25458 | }, _html['' + LEGEND_TITLE_CLASS] = {
|
25459 | marginBottom: '4px'
|
25460 | }, _html['' + LEGEND_LIST_CLASS] = {
|
25461 | listStyleType: 'none',
|
25462 | margin: 0,
|
25463 | padding: 0
|
25464 | }, _html['' + LEGEND_LIST_ITEM_CLASS] = {
|
25465 | cursor: 'pointer',
|
25466 | marginBottom: '5px',
|
25467 | marginRight: '24px'
|
25468 | }, _html['' + LEGEND_MARKER_CLASS] = {
|
25469 | width: '9px',
|
25470 | height: '9px',
|
25471 | borderRadius: '50%',
|
25472 | display: 'inline-block',
|
25473 | marginRight: '8px',
|
25474 | verticalAlign: 'middle'
|
25475 | }, _html),
|
25476 |
|
25477 | gradient: {
|
25478 | textStyle: {
|
25479 | fill: '#8C8C8C',
|
25480 | fontSize: 12,
|
25481 | textAlign: 'center',
|
25482 | textBaseline: 'middle',
|
25483 | lineHeight: 20,
|
25484 | fontFamily: FONT_FAMILY
|
25485 | },
|
25486 | lineStyle: {
|
25487 | lineWidth: 1,
|
25488 | stroke: '#fff'
|
25489 | },
|
25490 | unCheckColor: '#bfbfbf'
|
25491 | }
|
25492 | },
|
25493 | tooltip: (_tooltip = {
|
25494 | crosshairs: false,
|
25495 | offset: 15
|
25496 | }, _tooltip['' + TOOLTIP_CONTAINER_CLASS] = {
|
25497 | position: 'absolute',
|
25498 | visibility: 'hidden',
|
25499 | whiteSpace: 'nowrap',
|
25500 | zIndex: 999,
|
25501 | transition: 'visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)',
|
25502 | backgroundColor: 'rgba(0, 0, 0, 0.65)',
|
25503 | borderRadius: '4px',
|
25504 | color: 'rgb(255, 255, 255)',
|
25505 | fontSize: '12px',
|
25506 | fontFamily: FONT_FAMILY,
|
25507 | lineHeight: '20px',
|
25508 | padding: '10px 10px 6px 10px'
|
25509 | }, _tooltip['' + TOOLTIP_TITLE_CLASS] = {
|
25510 | marginBottom: '4px'
|
25511 | }, _tooltip['' + TOOLTIP_LIST_CLASS] = {
|
25512 | margin: 0,
|
25513 | listStyleType: 'none',
|
25514 | padding: 0
|
25515 | }, _tooltip['' + TOOLTIP_LIST_ITEM_CLASS] = {
|
25516 | marginBottom: '4px'
|
25517 | }, _tooltip['' + TOOLTIP_MARKER_CLASS] = {
|
25518 | width: '7px',
|
25519 | height: '7px',
|
25520 | borderRadius: '50%',
|
25521 | border: '1px solid #fff',
|
25522 | display: 'inline-block',
|
25523 | marginRight: '8px'
|
25524 | }, _tooltip),
|
25525 | tooltipMarker: {
|
25526 | symbol: function symbol(x, y, r, ctx, marker) {
|
25527 | var color = marker.get('color');
|
25528 | ctx.fillStyle = color;
|
25529 | ctx.lineWidth = 1;
|
25530 | ctx.strokeStyle = '#fff';
|
25531 | ctx.beginPath();
|
25532 | ctx.arc(x, y, r, 0, Math.PI * 2, false);
|
25533 | ctx.fill();
|
25534 | ctx.stroke();
|
25535 |
|
25536 | ctx.save();
|
25537 | ctx.beginPath();
|
25538 | ctx.fillStyle = '#fff';
|
25539 | ctx.strokeStyle = color;
|
25540 | ctx.globalAlpha = 0.2;
|
25541 | ctx.lineWidth = 3;
|
25542 | ctx.arc(x, y, 6, 0, Math.PI * 2, false);
|
25543 | ctx.stroke();
|
25544 | ctx.restore();
|
25545 | },
|
25546 | radius: 4
|
25547 | },
|
25548 | tooltipCrosshairsRect: {
|
25549 | type: 'rect',
|
25550 | style: {
|
25551 | fill: '#CCD6EC',
|
25552 | opacity: 0.3
|
25553 | }
|
25554 | },
|
25555 | tooltipCrosshairsLine: {
|
25556 | style: {
|
25557 | stroke: 'rgba(0, 0, 0, 0.25)',
|
25558 | lineWidth: 1
|
25559 | }
|
25560 | },
|
25561 | shape: {
|
25562 | point: {
|
25563 | lineWidth: 1,
|
25564 | fill: DEFAULT_COLOR,
|
25565 | radius: 4
|
25566 | },
|
25567 | hollowPoint: {
|
25568 | fill: '#fff',
|
25569 | lineWidth: 1,
|
25570 | stroke: DEFAULT_COLOR,
|
25571 | radius: 3
|
25572 | },
|
25573 | interval: {
|
25574 | lineWidth: 0,
|
25575 | fill: DEFAULT_COLOR,
|
25576 | fillOpacity: 0.85
|
25577 | },
|
25578 | hollowInterval: {
|
25579 | fill: '#fff',
|
25580 | stroke: DEFAULT_COLOR,
|
25581 | fillOpacity: 0,
|
25582 | lineWidth: 2
|
25583 | },
|
25584 | area: {
|
25585 | lineWidth: 0,
|
25586 | fill: DEFAULT_COLOR,
|
25587 | fillOpacity: 0.3
|
25588 | },
|
25589 | polygon: {
|
25590 | lineWidth: 0,
|
25591 | fill: DEFAULT_COLOR,
|
25592 | fillOpacity: 1
|
25593 | },
|
25594 | hollowPolygon: {
|
25595 | fill: '#fff',
|
25596 | stroke: DEFAULT_COLOR,
|
25597 | fillOpacity: 0,
|
25598 | lineWidth: 2
|
25599 | },
|
25600 | hollowArea: {
|
25601 | fill: '#fff',
|
25602 | stroke: DEFAULT_COLOR,
|
25603 | fillOpacity: 0,
|
25604 | lineWidth: 2
|
25605 | },
|
25606 | line: {
|
25607 | stroke: DEFAULT_COLOR,
|
25608 | lineWidth: 2,
|
25609 | fill: null
|
25610 | },
|
25611 | edge: {
|
25612 | stroke: DEFAULT_COLOR,
|
25613 | lineWidth: 1,
|
25614 | fill: null
|
25615 | },
|
25616 | schema: {
|
25617 | stroke: DEFAULT_COLOR,
|
25618 | lineWidth: 1,
|
25619 | fill: null
|
25620 | }
|
25621 | },
|
25622 | guide: {
|
25623 | line: {
|
25624 | lineStyle: {
|
25625 | stroke: DEFAULT_COLOR,
|
25626 | lineDash: [0, 2, 2],
|
25627 | lineWidth: 1
|
25628 | },
|
25629 | text: {
|
25630 | position: 'end',
|
25631 | autoRotate: true,
|
25632 | style: {
|
25633 | fill: '#545454',
|
25634 | fontSize: 12,
|
25635 | textAlign: 'center',
|
25636 | fontFamily: FONT_FAMILY
|
25637 | }
|
25638 | }
|
25639 | },
|
25640 | text: {
|
25641 | style: {
|
25642 | fill: '#545454',
|
25643 | fontSize: 12,
|
25644 | textBaseline: 'middle',
|
25645 | textAlign: 'start',
|
25646 | fontFamily: FONT_FAMILY
|
25647 |
|
25648 | }
|
25649 | },
|
25650 | region: {
|
25651 | style: {
|
25652 | lineWidth: 0,
|
25653 | fill: '#000',
|
25654 | fillOpacity: 0.04
|
25655 |
|
25656 | } },
|
25657 | html: {
|
25658 | alignX: 'middle',
|
25659 | alignY: 'middle'
|
25660 | }
|
25661 | },
|
25662 | pixelRatio: null
|
25663 | };
|
25664 |
|
25665 | module.exports = Theme;
|
25666 |
|
25667 | }),
|
25668 |
|
25669 | (function(module, exports, __webpack_require__) {
|
25670 |
|
25671 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25672 |
|
25673 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
25674 |
|
25675 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
25676 |
|
25677 | var _require = __webpack_require__(2),
|
25678 | Group = _require.Group;
|
25679 |
|
25680 | var Labels = __webpack_require__(65);
|
25681 | var Global = __webpack_require__(1);
|
25682 | var Util = __webpack_require__(0);
|
25683 | var IGNORE_ARR = ['line', 'point', 'path'];
|
25684 | var ORIGIN = '_origin';
|
25685 |
|
25686 | function avg(arr) {
|
25687 | var sum = 0;
|
25688 | Util.each(arr, function (value) {
|
25689 | sum += value;
|
25690 | });
|
25691 | return sum / arr.length;
|
25692 | }
|
25693 |
|
25694 | var GeomLabels = function (_Group) {
|
25695 | _inherits(GeomLabels, _Group);
|
25696 |
|
25697 | function GeomLabels() {
|
25698 | _classCallCheck(this, GeomLabels);
|
25699 |
|
25700 | return _possibleConstructorReturn(this, _Group.apply(this, arguments));
|
25701 | }
|
25702 |
|
25703 | GeomLabels.prototype.getDefaultCfg = function getDefaultCfg() {
|
25704 | return {
|
25705 | label: Global.label,
|
25706 | |
25707 |
|
25708 |
|
25709 |
|
25710 | labelCfg: null,
|
25711 | |
25712 |
|
25713 |
|
25714 |
|
25715 | coord: null,
|
25716 | |
25717 |
|
25718 |
|
25719 |
|
25720 | geomType: null,
|
25721 | zIndex: 6
|
25722 | };
|
25723 | };
|
25724 |
|
25725 | GeomLabels.prototype._renderUI = function _renderUI() {
|
25726 | _Group.prototype._renderUI.call(this);
|
25727 | this.initLabelsCfg();
|
25728 | this.renderLabels();
|
25729 | };
|
25730 |
|
25731 |
|
25732 |
|
25733 |
|
25734 | GeomLabels.prototype._getLabelValue = function _getLabelValue(record) {
|
25735 | var self = this;
|
25736 | var originRecord = record[ORIGIN];
|
25737 | var labelCfg = self.get('labelCfg');
|
25738 | var scales = labelCfg.scales;
|
25739 | var callback = labelCfg.cfg && labelCfg.cfg.content;
|
25740 | var value = void 0;
|
25741 | if (callback) {
|
25742 | var params = [];
|
25743 | Util.each(scales, function (scale) {
|
25744 | params.push(originRecord[scale.field]);
|
25745 | });
|
25746 | value = callback.apply(null, params);
|
25747 | } else {
|
25748 | var scale = scales[0];
|
25749 | value = originRecord[scale.field];
|
25750 | if (Util.isArray(value)) {
|
25751 | var tmp = [];
|
25752 | Util.each(value, function (subVal) {
|
25753 | tmp.push(scale.getText(subVal));
|
25754 | });
|
25755 | value = tmp;
|
25756 | } else {
|
25757 | value = scale.getText(value);
|
25758 | }
|
25759 | }
|
25760 | return value;
|
25761 | };
|
25762 |
|
25763 |
|
25764 |
|
25765 |
|
25766 | GeomLabels.prototype.initLabelsCfg = function initLabelsCfg() {
|
25767 | var self = this;
|
25768 | var labels = self.getDefaultLabelCfg();
|
25769 | var labelCfg = self.get('labelCfg');
|
25770 |
|
25771 | Util.deepMix(labels, labelCfg.cfg);
|
25772 | self.set('label', labels);
|
25773 | };
|
25774 |
|
25775 | |
25776 |
|
25777 |
|
25778 |
|
25779 |
|
25780 |
|
25781 |
|
25782 | GeomLabels.prototype.getDefaultLabelCfg = function getDefaultLabelCfg() {
|
25783 | var self = this;
|
25784 | var labelCfg = self.get('labelCfg').cfg;
|
25785 | var geomType = self.get('geomType');
|
25786 | if (geomType === 'polygon' || labelCfg && labelCfg.offset < 0 && Util.indexOf(IGNORE_ARR, geomType) === -1) {
|
25787 |
|
25788 | return Util.deepMix({}, self.get('label'), Global.innerLabels);
|
25789 | }
|
25790 |
|
25791 | return Util.deepMix({}, Global.label, self.get('label'));
|
25792 | };
|
25793 |
|
25794 | |
25795 |
|
25796 |
|
25797 |
|
25798 |
|
25799 |
|
25800 |
|
25801 |
|
25802 | GeomLabels.prototype.getLabelsItems = function getLabelsItems(points) {
|
25803 | var self = this;
|
25804 | var items = [];
|
25805 | var labels = self.get('label');
|
25806 | var geom = self.get('geom');
|
25807 | var origin = void 0;
|
25808 |
|
25809 |
|
25810 | Util.each(points, function (point) {
|
25811 | origin = point._origin;
|
25812 | var label = self._getLabelValue(point);
|
25813 | if (!Util.isArray(label)) {
|
25814 | label = [label];
|
25815 | }
|
25816 | var total = label.length;
|
25817 |
|
25818 | Util.each(label, function (sub, subIdx) {
|
25819 | var obj = self.getLabelPoint(label, point, subIdx);
|
25820 | if (obj) {
|
25821 | obj = Util.mix({}, origin, obj);
|
25822 | var align = void 0;
|
25823 | if (labels && labels.label && labels.label.textAlign) {
|
25824 | align = labels.label.textAlign;
|
25825 | } else {
|
25826 | align = self.getLabelAlign(obj, subIdx, total);
|
25827 | }
|
25828 | obj.textAlign = align;
|
25829 | if (geom) {
|
25830 | obj._id = geom._getShapeId(origin) + '-glabel-' + subIdx + '-' + obj.text;
|
25831 | }
|
25832 | obj.coord = self.get('coord');
|
25833 | items.push(obj);
|
25834 | }
|
25835 | });
|
25836 | });
|
25837 | return items;
|
25838 | };
|
25839 |
|
25840 | |
25841 |
|
25842 |
|
25843 |
|
25844 |
|
25845 |
|
25846 |
|
25847 |
|
25848 | GeomLabels.prototype.adjustItems = function adjustItems(items) {
|
25849 | return items;
|
25850 | };
|
25851 |
|
25852 | |
25853 |
|
25854 |
|
25855 |
|
25856 |
|
25857 |
|
25858 |
|
25859 | GeomLabels.prototype.drawLines = function drawLines(items, labelLine) {
|
25860 | var self = this;
|
25861 | var offset = self.getDefaultOffset();
|
25862 | if (offset > 0) {
|
25863 | Util.each(items, function (point) {
|
25864 | self.lineToLabel(point, labelLine);
|
25865 | });
|
25866 | }
|
25867 | };
|
25868 |
|
25869 |
|
25870 |
|
25871 |
|
25872 | GeomLabels.prototype.lineToLabel = function lineToLabel(label, labelLine) {
|
25873 | var self = this;
|
25874 | var coord = self.get('coord');
|
25875 | var start = {
|
25876 | x: label.x - label._offset.x,
|
25877 | y: label.y - label._offset.y
|
25878 | };
|
25879 | var inner = {
|
25880 | x: (start.x + label.x) / 2,
|
25881 | y: (start.y + label.y) / 2
|
25882 | };
|
25883 | var lineGroup = self.get('lineGroup');
|
25884 |
|
25885 | if (!lineGroup) {
|
25886 | lineGroup = self.addGroup({
|
25887 | elCls: 'x-line-group'
|
25888 | });
|
25889 | self.set('lineGroup', lineGroup);
|
25890 | }
|
25891 | var lineShape = lineGroup.addShape('path', {
|
25892 | attrs: Util.mix({
|
25893 | path: ['M' + start.x, start.y + ' Q' + inner.x, inner.y + ' ' + label.x, label.y].join(','),
|
25894 | fill: null,
|
25895 | stroke: label.color
|
25896 | }, labelLine)
|
25897 | });
|
25898 |
|
25899 | lineShape.name = 'labelLine';
|
25900 |
|
25901 | lineShape._id = label._id && label._id.replace('glabel', 'glabelline');
|
25902 | lineShape.set('coord', coord);
|
25903 | };
|
25904 |
|
25905 | |
25906 |
|
25907 |
|
25908 |
|
25909 |
|
25910 |
|
25911 |
|
25912 |
|
25913 |
|
25914 |
|
25915 | GeomLabels.prototype.getLabelPoint = function getLabelPoint(labels, point, index) {
|
25916 | var self = this;
|
25917 | var coord = self.get('coord');
|
25918 |
|
25919 | function getDimValue(value, idx) {
|
25920 | if (Util.isArray(value)) {
|
25921 | if (labels.length === 1) {
|
25922 |
|
25923 | if (value.length <= 2) {
|
25924 | value = value[value.length - 1];
|
25925 |
|
25926 | } else {
|
25927 | value = avg(value);
|
25928 | }
|
25929 | } else {
|
25930 | value = value[idx];
|
25931 | }
|
25932 | }
|
25933 | return value;
|
25934 | }
|
25935 |
|
25936 | var labelPoint = {
|
25937 | x: getDimValue(point.x, index),
|
25938 | y: getDimValue(point.y, index),
|
25939 | text: labels[index]
|
25940 | };
|
25941 |
|
25942 |
|
25943 | if (point && point.nextPoints && (point.shape === 'funnel' || point.shape === 'pyramid')) {
|
25944 | var maxX = -Infinity;
|
25945 | point.nextPoints.forEach(function (p) {
|
25946 | p = coord.convert(p);
|
25947 | if (p.x > maxX) {
|
25948 | maxX = p.x;
|
25949 | }
|
25950 | });
|
25951 | labelPoint.x = (labelPoint.x + maxX) / 2;
|
25952 | }
|
25953 |
|
25954 | if (point.shape === 'pyramid' && !point.nextPoints && point.points) {
|
25955 | point.points.forEach(function (p) {
|
25956 | p = coord.convert(p);
|
25957 | if (point.x.indexOf(p.x) === -1) {
|
25958 | labelPoint.x = (labelPoint.x + p.x) / 2;
|
25959 | }
|
25960 | });
|
25961 | }
|
25962 |
|
25963 | var offsetPoint = self.getLabelOffset(labelPoint, index, labels.length);
|
25964 | self.transLabelPoint(labelPoint);
|
25965 | labelPoint.x += offsetPoint.x;
|
25966 | labelPoint.y += offsetPoint.y;
|
25967 | labelPoint.color = point.color;
|
25968 | labelPoint._offset = offsetPoint;
|
25969 | return labelPoint;
|
25970 | };
|
25971 |
|
25972 | GeomLabels.prototype.transLabelPoint = function transLabelPoint(point) {
|
25973 | var self = this;
|
25974 | var coord = self.get('coord');
|
25975 | var tmpPoint = coord.applyMatrix(point.x, point.y, 1);
|
25976 | point.x = tmpPoint[0];
|
25977 | point.y = tmpPoint[1];
|
25978 | };
|
25979 |
|
25980 | GeomLabels.prototype.getOffsetVector = function getOffsetVector() {
|
25981 | var self = this;
|
25982 | var labelCfg = self.get('label');
|
25983 | var offset = labelCfg.offset || 0;
|
25984 | var coord = self.get('coord');
|
25985 | var vector = void 0;
|
25986 | if (coord.isTransposed) {
|
25987 |
|
25988 | vector = coord.applyMatrix(offset, 0);
|
25989 | } else {
|
25990 |
|
25991 | vector = coord.applyMatrix(0, offset);
|
25992 | }
|
25993 | return vector;
|
25994 | };
|
25995 |
|
25996 |
|
25997 |
|
25998 |
|
25999 | GeomLabels.prototype.getDefaultOffset = function getDefaultOffset() {
|
26000 | var self = this;
|
26001 | var offset = 0;
|
26002 |
|
26003 | var coord = self.get('coord');
|
26004 | var vector = self.getOffsetVector();
|
26005 | if (coord.isTransposed) {
|
26006 |
|
26007 | offset = vector[0];
|
26008 | } else {
|
26009 |
|
26010 | offset = vector[1];
|
26011 | }
|
26012 | return offset;
|
26013 | };
|
26014 |
|
26015 |
|
26016 |
|
26017 |
|
26018 | GeomLabels.prototype.getLabelOffset = function getLabelOffset(point, index, total) {
|
26019 | var self = this;
|
26020 | var offset = self.getDefaultOffset();
|
26021 | var coord = self.get('coord');
|
26022 | var transposed = coord.isTransposed;
|
26023 | var yField = transposed ? 'x' : 'y';
|
26024 | var factor = transposed ? 1 : -1;
|
26025 | var offsetPoint = {
|
26026 | x: 0,
|
26027 | y: 0
|
26028 | };
|
26029 | if (index > 0 || total === 1) {
|
26030 |
|
26031 | offsetPoint[yField] = offset * factor;
|
26032 | } else {
|
26033 | offsetPoint[yField] = offset * factor * -1;
|
26034 | }
|
26035 | return offsetPoint;
|
26036 | };
|
26037 |
|
26038 | GeomLabels.prototype.getLabelAlign = function getLabelAlign(point, index, total) {
|
26039 | var self = this;
|
26040 | var align = 'center';
|
26041 | var coord = self.get('coord');
|
26042 | if (coord.isTransposed) {
|
26043 | var offset = self.getDefaultOffset();
|
26044 |
|
26045 | if (offset < 0) {
|
26046 | align = 'right';
|
26047 | } else if (offset === 0) {
|
26048 | align = 'center';
|
26049 | } else {
|
26050 | align = 'left';
|
26051 | }
|
26052 | if (total > 1 && index === 0) {
|
26053 | if (align === 'right') {
|
26054 | align = 'left';
|
26055 | } else if (align === 'left') {
|
26056 | align = 'right';
|
26057 | }
|
26058 | }
|
26059 | }
|
26060 | return align;
|
26061 | };
|
26062 |
|
26063 | GeomLabels.prototype.showLabels = function showLabels(points) {
|
26064 | var self = this;
|
26065 | var items = self.getLabelsItems(points);
|
26066 | var labels = self.get('label');
|
26067 | items = self.adjustItems(items);
|
26068 | self.resetLabels(items);
|
26069 | if (labels.labelLine) {
|
26070 | self.drawLines(items, labels.labelLine);
|
26071 | }
|
26072 | };
|
26073 |
|
26074 | GeomLabels.prototype.destroy = function destroy() {
|
26075 | this.removeLabels();
|
26076 | _Group.prototype.destroy.call(this);
|
26077 | };
|
26078 |
|
26079 | return GeomLabels;
|
26080 | }(Group);
|
26081 |
|
26082 | Util.assign(GeomLabels.prototype, Labels.LabelsRenderer);
|
26083 |
|
26084 | module.exports = GeomLabels;
|
26085 |
|
26086 | }),
|
26087 |
|
26088 | (function(module, exports, __webpack_require__) {
|
26089 |
|
26090 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26091 |
|
26092 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
26093 |
|
26094 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
26095 |
|
26096 |
|
26097 |
|
26098 |
|
26099 |
|
26100 | var Util = __webpack_require__(0);
|
26101 |
|
26102 | var _require = __webpack_require__(2),
|
26103 | DomUtil = _require.DomUtil,
|
26104 | Group = _require.Group;
|
26105 |
|
26106 | var Labels = function (_Group) {
|
26107 | _inherits(Labels, _Group);
|
26108 |
|
26109 | function Labels() {
|
26110 | _classCallCheck(this, Labels);
|
26111 |
|
26112 | return _possibleConstructorReturn(this, _Group.apply(this, arguments));
|
26113 | }
|
26114 |
|
26115 | Labels.prototype.getDefaultCfg = function getDefaultCfg() {
|
26116 | return {
|
26117 | zIndex: 6,
|
26118 | |
26119 |
|
26120 |
|
26121 |
|
26122 | items: null,
|
26123 | |
26124 |
|
26125 |
|
26126 |
|
26127 | textStyle: null,
|
26128 | |
26129 |
|
26130 |
|
26131 |
|
26132 | formatter: null,
|
26133 | |
26134 |
|
26135 |
|
26136 |
|
26137 | htmlTemplate: null,
|
26138 | |
26139 |
|
26140 |
|
26141 |
|
26142 | _containerTpl: '<div class="g-labels" style="position:absolute;top:0;left:0;"></div>',
|
26143 | |
26144 |
|
26145 |
|
26146 |
|
26147 | _itemTpl: '<div class="g-label" style="position:absolute;">{text}</div>'
|
26148 | };
|
26149 | };
|
26150 |
|
26151 | Labels.prototype._renderUI = function _renderUI() {
|
26152 | this._drawLabels();
|
26153 | };
|
26154 |
|
26155 | Labels.prototype._drawLabels = function _drawLabels() {
|
26156 | var self = this;
|
26157 | var items = self.get('items');
|
26158 | Util.each(items, function (item, index) {
|
26159 | self._addLabel(item, index);
|
26160 | });
|
26161 | };
|
26162 |
|
26163 | Labels.prototype._addLabel = function _addLabel(item, index) {
|
26164 | var cfg = this._getLabelCfg(item, index);
|
26165 | return this._createText(cfg);
|
26166 | };
|
26167 |
|
26168 | Labels.prototype._getLabelCfg = function _getLabelCfg(item, index) {
|
26169 | var textStyle = this.get('textStyle') || {};
|
26170 | var formatter = this.get('formatter');
|
26171 | var htmlTemplate = this.get('htmlTemplate');
|
26172 |
|
26173 | if (!Util.isObject(item)) {
|
26174 | var tmp = item;
|
26175 | item = {};
|
26176 | item.text = tmp;
|
26177 | }
|
26178 |
|
26179 | if (Util.isFunction(textStyle)) {
|
26180 | textStyle = textStyle(item.text, item, index);
|
26181 | }
|
26182 |
|
26183 | if (formatter) {
|
26184 | item.text = formatter(item.text, item, index);
|
26185 | }
|
26186 |
|
26187 | if (Util.isFunction(htmlTemplate)) {
|
26188 | item.text = htmlTemplate(item.text, item, index);
|
26189 | }
|
26190 |
|
26191 | if (Util.isNil(item.text)) {
|
26192 | item.text = '';
|
26193 | }
|
26194 |
|
26195 | item.text = item.text + '';
|
26196 |
|
26197 | var cfg = Util.mix({}, item, textStyle, {
|
26198 | x: item.x || 0,
|
26199 | y: item.y || 0
|
26200 | });
|
26201 |
|
26202 | return cfg;
|
26203 | };
|
26204 |
|
26205 | Labels.prototype._createText = function _createText(cfg) {
|
26206 | var htmlTemplate = this.get('htmlTemplate');
|
26207 | var customDiv = this.get('customDiv');
|
26208 | var labelShape = void 0;
|
26209 |
|
26210 | if (htmlTemplate) {
|
26211 | if (!customDiv) {
|
26212 | var containerTpl = this.get('_containerTpl');
|
26213 | var wrapper = this.get('canvas').get('el').parentNode;
|
26214 | customDiv = DomUtil.createDom(containerTpl);
|
26215 | wrapper.style.position = 'relative';
|
26216 | wrapper.appendChild(customDiv);
|
26217 | this.set('customDiv', customDiv);
|
26218 | }
|
26219 |
|
26220 | var node = this._createDom(cfg);
|
26221 | customDiv.appendChild(node);
|
26222 | this._setCustomPosition(cfg, node);
|
26223 | } else {
|
26224 | var origin = cfg.point;
|
26225 | delete cfg.point;
|
26226 | labelShape = this.addShape('text', {
|
26227 | attrs: cfg
|
26228 | });
|
26229 | labelShape.setSilent('origin', origin);
|
26230 | labelShape.name = 'label';
|
26231 | this.get('appendInfo') && labelShape.setSilent('appendInfo', this.get('appendInfo'));
|
26232 | return labelShape;
|
26233 | }
|
26234 | };
|
26235 |
|
26236 | Labels.prototype._setCustomPosition = function _setCustomPosition(cfg, htmlDom) {
|
26237 | var textAlign = cfg.textAlign || 'left';
|
26238 | var top = cfg.y;
|
26239 | var left = cfg.x;
|
26240 | var width = DomUtil.getOuterWidth(htmlDom);
|
26241 | var height = DomUtil.getOuterHeight(htmlDom);
|
26242 |
|
26243 | top = top - height / 2;
|
26244 | if (textAlign === 'center') {
|
26245 | left = left - width / 2;
|
26246 | } else if (textAlign === 'right') {
|
26247 | left = left - width;
|
26248 | }
|
26249 |
|
26250 | htmlDom.style.top = parseInt(top, 10) + 'px';
|
26251 | htmlDom.style.left = parseInt(left, 10) + 'px';
|
26252 | };
|
26253 |
|
26254 | Labels.prototype._createDom = function _createDom(cfg) {
|
26255 | var itemTpl = this.get('_itemTpl');
|
26256 | var htmlTemplate = this.get('htmlTemplate');
|
26257 |
|
26258 | if (Util.isString(htmlTemplate)) {
|
26259 | cfg.text = Util.substitute(htmlTemplate, { text: cfg.text });
|
26260 | }
|
26261 |
|
26262 | var str = Util.substitute(itemTpl, { text: cfg.text });
|
26263 |
|
26264 | return DomUtil.createDom(str);
|
26265 | };
|
26266 |
|
26267 | Labels.prototype.getLabels = function getLabels() {
|
26268 | var customDiv = this.get('customDiv');
|
26269 | if (customDiv) {
|
26270 | return Util.toArray(customDiv.childNodes);
|
26271 | }
|
26272 | return this.get('children');
|
26273 | };
|
26274 |
|
26275 | Labels.prototype.addLabel = function addLabel(item) {
|
26276 | var items = this.get('items');
|
26277 | var count = items.length;
|
26278 | items.push(item);
|
26279 | return this._addLabel(item, count);
|
26280 | };
|
26281 |
|
26282 | Labels.prototype.changeLabel = function changeLabel(oldLabel, newLabel) {
|
26283 | if (!oldLabel) {
|
26284 | return;
|
26285 | }
|
26286 | var htmlTemplate = this.get('htmlTemplate');
|
26287 | var index = Util.indexOf(this.getLabels(), oldLabel);
|
26288 | var cfg = this._getLabelCfg(newLabel, index);
|
26289 | if (htmlTemplate) {
|
26290 | var node = this._createDom(cfg);
|
26291 | oldLabel.innerHTML = node.innerHTML;
|
26292 | this._setCustomPosition(cfg, oldLabel);
|
26293 | } else {
|
26294 | oldLabel._id = newLabel._id;
|
26295 | oldLabel.attr('text', cfg.text);
|
26296 | if (oldLabel.attr('x') !== cfg.x || oldLabel.attr('y') !== cfg.y) {
|
26297 | var rotate = oldLabel.get('attrs').rotate;
|
26298 | if (rotate) {
|
26299 | oldLabel.rotateAtStart(-rotate);
|
26300 | oldLabel.attr(cfg);
|
26301 | oldLabel.rotateAtStart(rotate);
|
26302 | } else {
|
26303 | oldLabel.attr(cfg);
|
26304 | }
|
26305 | }
|
26306 | }
|
26307 | };
|
26308 |
|
26309 | Labels.prototype.clear = function clear() {
|
26310 | var customDiv = this.get('customDiv');
|
26311 | if (customDiv) {
|
26312 | customDiv.innerHTML = '';
|
26313 | }
|
26314 | _Group.prototype.clear.call(this);
|
26315 | };
|
26316 |
|
26317 | Labels.prototype.setItems = function setItems(items) {
|
26318 | this.clear();
|
26319 | this.set('items', items);
|
26320 | this._drawLabels();
|
26321 | };
|
26322 |
|
26323 | Labels.prototype.remove = function remove() {
|
26324 | var customDiv = this.get('customDiv');
|
26325 | if (customDiv) {
|
26326 | customDiv.parentNode.removeChild(customDiv);
|
26327 | }
|
26328 | _Group.prototype.remove.call(this);
|
26329 | };
|
26330 |
|
26331 | return Labels;
|
26332 | }(Group);
|
26333 |
|
26334 | module.exports = Labels;
|
26335 |
|
26336 | }),
|
26337 |
|
26338 | (function(module, exports, __webpack_require__) {
|
26339 |
|
26340 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26341 |
|
26342 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
26343 |
|
26344 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
26345 |
|
26346 | var Labels = __webpack_require__(109);
|
26347 | var PathUtil = __webpack_require__(14);
|
26348 | var Util = __webpack_require__(0);
|
26349 |
|
26350 | var PolarLabels = function (_Labels) {
|
26351 | _inherits(PolarLabels, _Labels);
|
26352 |
|
26353 | function PolarLabels() {
|
26354 | _classCallCheck(this, PolarLabels);
|
26355 |
|
26356 | return _possibleConstructorReturn(this, _Labels.apply(this, arguments));
|
26357 | }
|
26358 |
|
26359 | PolarLabels.prototype.getPointRauis = function getPointRauis(coord, point) {
|
26360 | return PathUtil.getPointRadius(coord, point);
|
26361 | };
|
26362 |
|
26363 | PolarLabels.prototype.getCirclePoint = function getCirclePoint(angle, offset, point) {
|
26364 | var self = this;
|
26365 | var coord = self.get('coord');
|
26366 | var center = coord.getCenter();
|
26367 | var labelEmit = self._isEmitLabels();
|
26368 | var r = self.getPointRauis(coord, point);
|
26369 | if (coord.isTransposed && r > offset && !labelEmit) {
|
26370 | var appendAngle = Math.asin(offset / (2 * r));
|
26371 | angle = angle + appendAngle * 2;
|
26372 | } else {
|
26373 | r = r + offset;
|
26374 | }
|
26375 |
|
26376 | return {
|
26377 | x: center.x + r * Math.cos(angle),
|
26378 | y: center.y + r * Math.sin(angle),
|
26379 | angle: angle,
|
26380 | r: r
|
26381 | };
|
26382 | };
|
26383 |
|
26384 | PolarLabels.prototype.getArcPoint = function getArcPoint(point, index) {
|
26385 | var self = this;
|
26386 |
|
26387 | var outerPoint = void 0;
|
26388 |
|
26389 | index = index || 0;
|
26390 | if (Util.isArray(point.x) || Util.isArray(point.y)) {
|
26391 | outerPoint = {
|
26392 | x: Util.isArray(point.x) ? point.x[index] : point.x,
|
26393 | y: Util.isArray(point.y) ? point.y[index] : point.y
|
26394 | };
|
26395 | } else {
|
26396 | outerPoint = point;
|
26397 | }
|
26398 | self.transLabelPoint(outerPoint);
|
26399 | return outerPoint;
|
26400 | };
|
26401 |
|
26402 |
|
26403 |
|
26404 |
|
26405 | PolarLabels.prototype.getPointAngle = function getPointAngle(point) {
|
26406 | var self = this;
|
26407 | var coord = self.get('coord');
|
26408 | return PathUtil.getPointAngle(coord, point);
|
26409 | };
|
26410 |
|
26411 |
|
26412 |
|
26413 |
|
26414 | PolarLabels.prototype.getMiddlePoint = function getMiddlePoint(points) {
|
26415 | var self = this;
|
26416 | var coord = self.get('coord');
|
26417 | var count = points.length;
|
26418 | var middlePoint = {
|
26419 | x: 0,
|
26420 | y: 0
|
26421 | };
|
26422 | Util.each(points, function (point) {
|
26423 | middlePoint.x += point.x;
|
26424 | middlePoint.y += point.y;
|
26425 | });
|
26426 | middlePoint.x /= count;
|
26427 | middlePoint.y /= count;
|
26428 |
|
26429 | middlePoint = coord.convert(middlePoint);
|
26430 | return middlePoint;
|
26431 | };
|
26432 |
|
26433 |
|
26434 |
|
26435 |
|
26436 | PolarLabels.prototype._isToMiddle = function _isToMiddle(point) {
|
26437 | return point.x.length > 2;
|
26438 | };
|
26439 |
|
26440 | |
26441 |
|
26442 |
|
26443 |
|
26444 |
|
26445 |
|
26446 |
|
26447 |
|
26448 |
|
26449 |
|
26450 | PolarLabels.prototype.getLabelPoint = function getLabelPoint(labels, point, index) {
|
26451 | var self = this;
|
26452 | var text = labels[index];
|
26453 | var factor = 1;
|
26454 | var arcPoint = void 0;
|
26455 | if (self._isToMiddle(point)) {
|
26456 | arcPoint = self.getMiddlePoint(point.points);
|
26457 | } else {
|
26458 | if (labels.length === 1 && index === 0) {
|
26459 | index = 1;
|
26460 | } else if (index === 0) {
|
26461 | factor = -1;
|
26462 | }
|
26463 | arcPoint = self.getArcPoint(point, index);
|
26464 | }
|
26465 |
|
26466 | var offset = self.getDefaultOffset();
|
26467 | offset = offset * factor;
|
26468 | var middleAngle = self.getPointAngle(arcPoint);
|
26469 | var labelPoint = self.getCirclePoint(middleAngle, offset, arcPoint);
|
26470 | labelPoint.text = text;
|
26471 | labelPoint.angle = middleAngle;
|
26472 | labelPoint.color = point.color;
|
26473 |
|
26474 | labelPoint.rotate = self.getLabelRotate(middleAngle, offset, point);
|
26475 | return labelPoint;
|
26476 | };
|
26477 |
|
26478 | PolarLabels.prototype._isEmitLabels = function _isEmitLabels() {
|
26479 | var labels = this.get('label');
|
26480 | return labels.labelEmit;
|
26481 | };
|
26482 |
|
26483 | |
26484 |
|
26485 |
|
26486 |
|
26487 |
|
26488 |
|
26489 |
|
26490 |
|
26491 | PolarLabels.prototype.getLabelRotate = function getLabelRotate(angle) {
|
26492 | var self = this;
|
26493 | var rotate = void 0;
|
26494 | rotate = angle * 180 / Math.PI;
|
26495 | rotate += 90;
|
26496 |
|
26497 | if (self._isEmitLabels()) {
|
26498 | rotate -= 90;
|
26499 | }
|
26500 | if (rotate) {
|
26501 | if (rotate > 90) {
|
26502 | rotate = rotate - 180;
|
26503 | } else if (rotate < -90) {
|
26504 | rotate = rotate + 180;
|
26505 | }
|
26506 | }
|
26507 | return rotate / 180 * Math.PI;
|
26508 | };
|
26509 |
|
26510 |
|
26511 |
|
26512 |
|
26513 | PolarLabels.prototype.getLabelAlign = function getLabelAlign(point) {
|
26514 | var self = this;
|
26515 | var coord = self.get('coord');
|
26516 | var align = void 0;
|
26517 | if (self._isEmitLabels()) {
|
26518 | if (point.angle <= Math.PI / 2 && point.angle > -Math.PI / 2) {
|
26519 | align = 'left';
|
26520 | } else {
|
26521 | align = 'right';
|
26522 | }
|
26523 | } else if (!coord.isTransposed) {
|
26524 | align = 'center';
|
26525 | } else {
|
26526 | var center = coord.getCenter();
|
26527 | var offset = self.getDefaultOffset();
|
26528 | if (Math.abs(point.x - center.x) < 1) {
|
26529 | align = 'center';
|
26530 | } else if (point.angle > Math.PI || point.angle <= 0) {
|
26531 | if (offset > 0) {
|
26532 | align = 'left';
|
26533 | } else {
|
26534 | align = 'right';
|
26535 | }
|
26536 | } else {
|
26537 | if (offset > 0) {
|
26538 | align = 'right';
|
26539 | } else {
|
26540 | align = 'left';
|
26541 | }
|
26542 | }
|
26543 | }
|
26544 | return align;
|
26545 | };
|
26546 |
|
26547 | return PolarLabels;
|
26548 | }(Labels);
|
26549 |
|
26550 | module.exports = PolarLabels;
|
26551 |
|
26552 | }),
|
26553 |
|
26554 | (function(module, exports, __webpack_require__) {
|
26555 |
|
26556 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26557 |
|
26558 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
26559 |
|
26560 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
26561 |
|
26562 |
|
26563 |
|
26564 |
|
26565 |
|
26566 |
|
26567 | var GeomBase = __webpack_require__(9);
|
26568 | var SplitMixin = __webpack_require__(113);
|
26569 | var Util = __webpack_require__(0);
|
26570 |
|
26571 | var Path = function (_GeomBase) {
|
26572 | _inherits(Path, _GeomBase);
|
26573 |
|
26574 | |
26575 |
|
26576 |
|
26577 |
|
26578 |
|
26579 | Path.prototype.getDefaultCfg = function getDefaultCfg() {
|
26580 | var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
|
26581 | cfg.type = 'path';
|
26582 | cfg.shapeType = 'line';
|
26583 | return cfg;
|
26584 | };
|
26585 |
|
26586 | function Path(cfg) {
|
26587 | _classCallCheck(this, Path);
|
26588 |
|
26589 | var _this = _possibleConstructorReturn(this, _GeomBase.call(this, cfg));
|
26590 |
|
26591 | Util.assign(_this, SplitMixin);
|
26592 | return _this;
|
26593 | }
|
26594 |
|
26595 | Path.prototype.getDrawCfg = function getDrawCfg(obj) {
|
26596 | var cfg = _GeomBase.prototype.getDrawCfg.call(this, obj);
|
26597 | cfg.isStack = this.hasStack();
|
26598 | return cfg;
|
26599 | };
|
26600 |
|
26601 | Path.prototype.draw = function draw(data, container, shapeFactory, index) {
|
26602 | var self = this;
|
26603 | var splitArray = this.splitData(data);
|
26604 |
|
26605 | var cfg = this.getDrawCfg(data[0]);
|
26606 | cfg.origin = data;
|
26607 | Util.each(splitArray, function (subData, splitedIndex) {
|
26608 | if (!Util.isEmpty(subData)) {
|
26609 | cfg.splitedIndex = splitedIndex;
|
26610 | cfg.points = subData;
|
26611 | var geomShape = shapeFactory.drawShape(cfg.shape, cfg, container);
|
26612 | geomShape.setSilent('index', index + splitedIndex);
|
26613 | geomShape.setSilent('coord', self.get('coord'));
|
26614 |
|
26615 | if (self.get('animate') && self.get('animateCfg')) {
|
26616 | geomShape.setSilent('animateCfg', self.get('animateCfg'));
|
26617 | }
|
26618 | }
|
26619 | });
|
26620 | };
|
26621 |
|
26622 | return Path;
|
26623 | }(GeomBase);
|
26624 |
|
26625 | module.exports = Path;
|
26626 |
|
26627 | }),
|
26628 |
|
26629 | (function(module, exports, __webpack_require__) {
|
26630 |
|
26631 |
|
26632 |
|
26633 |
|
26634 |
|
26635 |
|
26636 | var Util = __webpack_require__(0);
|
26637 |
|
26638 | module.exports = {
|
26639 | splitData: function splitData(data) {
|
26640 | if (!data.length) return [];
|
26641 | var arr = [];
|
26642 | var tmp = [];
|
26643 | var yScale = this.getYScale();
|
26644 | var yDim = yScale.field;
|
26645 | var yValue = void 0;
|
26646 | Util.each(data, function (obj) {
|
26647 | yValue = obj._origin ? obj._origin[yDim] : obj[yDim];
|
26648 | if (Util.isArray(yValue) && Util.isNil(yValue[0]) || Util.isNil(yValue)) {
|
26649 | if (tmp.length) {
|
26650 | arr.push(tmp);
|
26651 | tmp = [];
|
26652 | }
|
26653 | } else {
|
26654 | tmp.push(obj);
|
26655 | }
|
26656 | });
|
26657 | if (tmp.length) {
|
26658 | arr.push(tmp);
|
26659 | }
|
26660 | return arr;
|
26661 | }
|
26662 | };
|
26663 |
|
26664 | }),
|
26665 |
|
26666 | (function(module, exports, __webpack_require__) {
|
26667 |
|
26668 |
|
26669 |
|
26670 |
|
26671 |
|
26672 |
|
26673 |
|
26674 | var Global = __webpack_require__(1);
|
26675 | var Util = __webpack_require__(0);
|
26676 |
|
26677 |
|
26678 | function findMinDistance(arr, scale) {
|
26679 | var count = arr.length;
|
26680 |
|
26681 | if (Util.isString(arr[0])) {
|
26682 | arr = arr.map(function (v) {
|
26683 | return scale.translate(v);
|
26684 | });
|
26685 | }
|
26686 | var distance = arr[1] - arr[0];
|
26687 | for (var i = 2; i < count; i++) {
|
26688 | var tmp = arr[i] - arr[i - 1];
|
26689 | if (distance > tmp) {
|
26690 | distance = tmp;
|
26691 | }
|
26692 | }
|
26693 | return distance;
|
26694 | }
|
26695 |
|
26696 | var SizeMixin = {
|
26697 | getDefalutSize: function getDefalutSize() {
|
26698 | var defaultSize = this.get('defaultSize');
|
26699 | if (!defaultSize) {
|
26700 | var coord = this.get('coord');
|
26701 | var xScale = this.getXScale();
|
26702 | var xValues = xScale.values;
|
26703 | var dataArray = this.get('dataArray');
|
26704 | var count = void 0;
|
26705 | if (xScale.isLinear && xValues.length > 1) {
|
26706 | xValues.sort();
|
26707 | var interval = findMinDistance(xValues, xScale);
|
26708 | count = (xScale.max - xScale.min) / interval;
|
26709 | if (xValues.length > count) {
|
26710 | count = xValues.length;
|
26711 | }
|
26712 | } else {
|
26713 | count = xValues.length;
|
26714 | }
|
26715 | var range = xScale.range;
|
26716 | var normalizeSize = 1 / count;
|
26717 | var widthRatio = 1;
|
26718 |
|
26719 | if (this.isInCircle()) {
|
26720 | if (coord.isTransposed && count > 1) {
|
26721 |
|
26722 | widthRatio = Global.widthRatio.multiplePie;
|
26723 | } else {
|
26724 | widthRatio = Global.widthRatio.rose;
|
26725 | }
|
26726 | |
26727 |
|
26728 |
|
26729 | } else {
|
26730 | if (xScale.isLinear) {
|
26731 | normalizeSize *= range[1] - range[0];
|
26732 | }
|
26733 | widthRatio = Global.widthRatio.column;
|
26734 | }
|
26735 | normalizeSize *= widthRatio;
|
26736 | if (this.hasAdjust('dodge')) {
|
26737 | var dodgeCount = this._getDodgeCount(dataArray);
|
26738 | normalizeSize = normalizeSize / dodgeCount;
|
26739 | }
|
26740 | defaultSize = normalizeSize;
|
26741 | this.set('defaultSize', defaultSize);
|
26742 | }
|
26743 | return defaultSize;
|
26744 | },
|
26745 | _getDodgeCount: function _getDodgeCount(dataArray) {
|
26746 | var adjusts = this.get('adjusts');
|
26747 | var dodgeBy = void 0;
|
26748 | var count = dataArray.length;
|
26749 | Util.each(adjusts, function (adjust) {
|
26750 | if (adjust.type === 'dodge') {
|
26751 | dodgeBy = adjust.dodgeBy;
|
26752 | }
|
26753 | });
|
26754 |
|
26755 | if (dodgeBy) {
|
26756 | var mergeData = Util.Array.merge(dataArray);
|
26757 | var values = Util.Array.values(mergeData, dodgeBy);
|
26758 | count = values.length;
|
26759 | }
|
26760 |
|
26761 | return count;
|
26762 | },
|
26763 | getDimWidth: function getDimWidth(dimName) {
|
26764 | var coord = this.get('coord');
|
26765 | var start = coord.convertPoint({
|
26766 | x: 0,
|
26767 | y: 0
|
26768 | });
|
26769 | var end = coord.convertPoint({
|
26770 | x: dimName === 'x' ? 1 : 0,
|
26771 | y: dimName === 'x' ? 0 : 1
|
26772 | });
|
26773 | var width = 0;
|
26774 | if (start && end) {
|
26775 | width = Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2));
|
26776 | }
|
26777 | return width;
|
26778 | },
|
26779 | _getWidth: function _getWidth() {
|
26780 | var coord = this.get('coord');
|
26781 | var width = void 0;
|
26782 | if (this.isInCircle() && !coord.isTransposed) {
|
26783 |
|
26784 | width = (coord.endAngle - coord.startAngle) * coord.radius;
|
26785 | } else {
|
26786 | width = this.getDimWidth('x');
|
26787 | }
|
26788 | return width;
|
26789 | },
|
26790 | _toNormalizedSize: function _toNormalizedSize(size) {
|
26791 | var width = this._getWidth();
|
26792 | return size / width;
|
26793 | },
|
26794 | _toCoordSize: function _toCoordSize(normalizeSize) {
|
26795 | var width = this._getWidth();
|
26796 | return width * normalizeSize;
|
26797 | },
|
26798 | getNormalizedSize: function getNormalizedSize(obj) {
|
26799 | var size = this.getAttrValue('size', obj);
|
26800 | if (Util.isNil(size)) {
|
26801 | size = this.getDefalutSize();
|
26802 | } else {
|
26803 | size = this._toNormalizedSize(size);
|
26804 | }
|
26805 | return size;
|
26806 | },
|
26807 | getSize: function getSize(obj) {
|
26808 | var size = this.getAttrValue('size', obj);
|
26809 | if (Util.isNil(size)) {
|
26810 | var normalizeSize = this.getDefalutSize();
|
26811 | size = this._toCoordSize(normalizeSize);
|
26812 | }
|
26813 | return size;
|
26814 | }
|
26815 | };
|
26816 |
|
26817 | module.exports = SizeMixin;
|
26818 |
|
26819 | }),
|
26820 |
|
26821 | (function(module, exports, __webpack_require__) {
|
26822 |
|
26823 | module.exports = {
|
26824 | Scale: __webpack_require__(321),
|
26825 | Coord: __webpack_require__(329),
|
26826 | Axis: __webpack_require__(334),
|
26827 | Guide: __webpack_require__(355),
|
26828 | Legend: __webpack_require__(356),
|
26829 | Tooltip: __webpack_require__(357),
|
26830 | Event: __webpack_require__(358)
|
26831 | };
|
26832 |
|
26833 | }),
|
26834 |
|
26835 | (function(module, exports, __webpack_require__) {
|
26836 |
|
26837 |
|
26838 |
|
26839 |
|
26840 |
|
26841 |
|
26842 | var Util = __webpack_require__(0);
|
26843 | var Base = __webpack_require__(41);
|
26844 | Base.Linear = __webpack_require__(42);
|
26845 | Base.Identity = __webpack_require__(323);
|
26846 | Base.Cat = __webpack_require__(118);
|
26847 | Base.Time = __webpack_require__(324);
|
26848 | Base.TimeCat = __webpack_require__(326);
|
26849 | Base.Log = __webpack_require__(327);
|
26850 | Base.Pow = __webpack_require__(328);
|
26851 |
|
26852 | var _loop = function _loop(k) {
|
26853 | if (Base.hasOwnProperty(k)) {
|
26854 | var methodName = Util.lowerFirst(k);
|
26855 | Base[methodName] = function (cfg) {
|
26856 | return new Base[k](cfg);
|
26857 | };
|
26858 | }
|
26859 | };
|
26860 |
|
26861 | for (var k in Base) {
|
26862 | _loop(k);
|
26863 | }
|
26864 |
|
26865 | var CAT_ARR = ['cat', 'timeCat'];
|
26866 |
|
26867 | Base.isCategory = function (type) {
|
26868 | return CAT_ARR.indexOf(type) >= 0;
|
26869 | };
|
26870 |
|
26871 | module.exports = Base;
|
26872 |
|
26873 | }),
|
26874 |
|
26875 | (function(module, exports) {
|
26876 |
|
26877 |
|
26878 |
|
26879 |
|
26880 |
|
26881 |
|
26882 |
|
26883 | var DECIMAL_LENGTH = 12;
|
26884 |
|
26885 | function getFactor(v) {
|
26886 | var factor = 1;
|
26887 | if (v < 1) {
|
26888 | var count = 0;
|
26889 | while (v < 1) {
|
26890 | factor = factor / 10;
|
26891 | v = v * 10;
|
26892 | count++;
|
26893 | }
|
26894 |
|
26895 | if (factor.toString().length > DECIMAL_LENGTH) {
|
26896 | factor = parseFloat(factor.toFixed(count));
|
26897 | }
|
26898 | } else {
|
26899 | while (v > 10) {
|
26900 | factor = factor * 10;
|
26901 | v = v / 10;
|
26902 | }
|
26903 | }
|
26904 |
|
26905 | return factor;
|
26906 | }
|
26907 |
|
26908 |
|
26909 | function arrayFloor(values, value) {
|
26910 | var length = values.length;
|
26911 | if (length === 0) {
|
26912 | return NaN;
|
26913 | }
|
26914 |
|
26915 | var pre = values[0];
|
26916 |
|
26917 | if (value < values[0]) {
|
26918 | return NaN;
|
26919 | }
|
26920 |
|
26921 | if (value >= values[length - 1]) {
|
26922 | return values[length - 1];
|
26923 | }
|
26924 | for (var i = 1; i < values.length; i++) {
|
26925 | if (value < values[i]) {
|
26926 | break;
|
26927 | }
|
26928 | pre = values[i];
|
26929 | }
|
26930 |
|
26931 | return pre;
|
26932 | }
|
26933 |
|
26934 |
|
26935 | function arrayCeiling(values, value) {
|
26936 | var length = values.length;
|
26937 | if (length === 0) {
|
26938 | return NaN;
|
26939 | }
|
26940 |
|
26941 | var rst = void 0;
|
26942 | if (value > values[length - 1]) {
|
26943 | return NaN;
|
26944 | }
|
26945 | if (value < values[0]) {
|
26946 | return values[0];
|
26947 | }
|
26948 |
|
26949 | for (var i = 1; i < values.length; i++) {
|
26950 | if (value <= values[i]) {
|
26951 | rst = values[i];
|
26952 | break;
|
26953 | }
|
26954 | }
|
26955 |
|
26956 | return rst;
|
26957 | }
|
26958 |
|
26959 | var Util = {
|
26960 |
|
26961 | snapFactorTo: function snapFactorTo(v, arr, snapType) {
|
26962 |
|
26963 | if (isNaN(v)) {
|
26964 | return NaN;
|
26965 | }
|
26966 | var factor = 1;
|
26967 | if (v !== 0) {
|
26968 | if (v < 0) {
|
26969 | factor = -1;
|
26970 | }
|
26971 | v = v * factor;
|
26972 | var tmpFactor = getFactor(v);
|
26973 | factor = factor * tmpFactor;
|
26974 |
|
26975 | v = v / tmpFactor;
|
26976 | }
|
26977 | if (snapType === 'floor') {
|
26978 | v = Util.snapFloor(arr, v);
|
26979 | } else if (snapType === 'ceil') {
|
26980 | v = Util.snapCeiling(arr, v);
|
26981 | } else {
|
26982 | v = Util.snapTo(arr, v);
|
26983 | }
|
26984 | var rst = v * factor;
|
26985 |
|
26986 | if (Math.abs(factor) < 1 && rst.toString().length > DECIMAL_LENGTH) {
|
26987 | var decimalVal = parseInt(1 / factor);
|
26988 | var symbol = factor > 0 ? 1 : -1;
|
26989 | rst = v / decimalVal * symbol;
|
26990 | }
|
26991 | return rst;
|
26992 | },
|
26993 |
|
26994 |
|
26995 | snapMultiple: function snapMultiple(v, base, snapType) {
|
26996 | var div = void 0;
|
26997 | if (snapType === 'ceil') {
|
26998 | div = Math.ceil(v / base);
|
26999 | } else if (snapType === 'floor') {
|
27000 | div = Math.floor(v / base);
|
27001 | } else {
|
27002 | div = Math.round(v / base);
|
27003 | }
|
27004 | return div * base;
|
27005 | },
|
27006 |
|
27007 | |
27008 |
|
27009 |
|
27010 |
|
27011 |
|
27012 |
|
27013 | snapTo: function snapTo(values, value) {
|
27014 |
|
27015 | var floorVal = arrayFloor(values, value);
|
27016 | var ceilingVal = arrayCeiling(values, value);
|
27017 | if (isNaN(floorVal) || isNaN(ceilingVal)) {
|
27018 | if (values[0] >= value) {
|
27019 | return values[0];
|
27020 | }
|
27021 | var last = values[values.length - 1];
|
27022 | if (last <= value) {
|
27023 | return last;
|
27024 | }
|
27025 | }
|
27026 | if (Math.abs(value - floorVal) < Math.abs(ceilingVal - value)) {
|
27027 | return floorVal;
|
27028 | }
|
27029 | return ceilingVal;
|
27030 | },
|
27031 |
|
27032 | |
27033 |
|
27034 |
|
27035 |
|
27036 |
|
27037 |
|
27038 | snapFloor: function snapFloor(values, value) {
|
27039 |
|
27040 | return arrayFloor(values, value);
|
27041 | },
|
27042 |
|
27043 | |
27044 |
|
27045 |
|
27046 |
|
27047 |
|
27048 |
|
27049 | snapCeiling: function snapCeiling(values, value) {
|
27050 |
|
27051 | return arrayCeiling(values, value);
|
27052 | }
|
27053 | };
|
27054 |
|
27055 | module.exports = Util;
|
27056 |
|
27057 | }),
|
27058 |
|
27059 | (function(module, exports, __webpack_require__) {
|
27060 |
|
27061 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
27062 |
|
27063 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
27064 |
|
27065 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
27066 |
|
27067 |
|
27068 |
|
27069 |
|
27070 |
|
27071 |
|
27072 | var Base = __webpack_require__(41);
|
27073 | var Util = __webpack_require__(0);
|
27074 | var catAuto = __webpack_require__(119);
|
27075 |
|
27076 |
|
27077 |
|
27078 |
|
27079 |
|
27080 |
|
27081 | var Category = function (_Base) {
|
27082 | _inherits(Category, _Base);
|
27083 |
|
27084 | function Category() {
|
27085 | _classCallCheck(this, Category);
|
27086 |
|
27087 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
27088 | }
|
27089 |
|
27090 | |
27091 |
|
27092 |
|
27093 | Category.prototype.getDefaultCfg = function getDefaultCfg() {
|
27094 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
27095 | return Util.mix({}, cfg, {
|
27096 | |
27097 |
|
27098 |
|
27099 |
|
27100 | type: 'cat',
|
27101 |
|
27102 | |
27103 |
|
27104 |
|
27105 |
|
27106 |
|
27107 | tickCount: null,
|
27108 |
|
27109 | |
27110 |
|
27111 |
|
27112 |
|
27113 | isCategory: true
|
27114 | });
|
27115 | };
|
27116 |
|
27117 | |
27118 |
|
27119 |
|
27120 |
|
27121 |
|
27122 | Category.prototype.init = function init() {
|
27123 | var self = this;
|
27124 | var values = self.values;
|
27125 | var tickCount = self.tickCount;
|
27126 |
|
27127 | Util.each(values, function (v, i) {
|
27128 | values[i] = v.toString();
|
27129 | });
|
27130 | if (!self.ticks) {
|
27131 | var ticks = values;
|
27132 | if (tickCount) {
|
27133 | var temp = catAuto({
|
27134 | maxCount: tickCount,
|
27135 | data: values
|
27136 | });
|
27137 | ticks = temp.ticks;
|
27138 | }
|
27139 | this.ticks = ticks;
|
27140 | }
|
27141 | };
|
27142 |
|
27143 | |
27144 |
|
27145 |
|
27146 |
|
27147 |
|
27148 | Category.prototype.getText = function getText(value) {
|
27149 |
|
27150 | if (this.values.indexOf(value) === -1 && Util.isNumber(value)) {
|
27151 | value = this.values[Math.round(value)];
|
27152 | }
|
27153 |
|
27154 | return _Base.prototype.getText.call(this, value);
|
27155 | };
|
27156 |
|
27157 | |
27158 |
|
27159 |
|
27160 |
|
27161 |
|
27162 | Category.prototype.translate = function translate(value) {
|
27163 | var index = this.values.indexOf(value);
|
27164 | if (index === -1 && Util.isNumber(value)) {
|
27165 | index = value;
|
27166 | } else if (index === -1) {
|
27167 | index = NaN;
|
27168 | }
|
27169 | return index;
|
27170 | };
|
27171 | |
27172 |
|
27173 |
|
27174 |
|
27175 |
|
27176 | Category.prototype.scale = function scale(value) {
|
27177 | var rangeMin = this.rangeMin();
|
27178 | var rangeMax = this.rangeMax();
|
27179 | var percent = void 0;
|
27180 |
|
27181 | if (Util.isString(value) || this.values.indexOf(value) !== -1) {
|
27182 | value = this.translate(value);
|
27183 | }
|
27184 | if (this.values.length > 1) {
|
27185 | percent = value / (this.values.length - 1);
|
27186 | } else {
|
27187 | percent = value;
|
27188 | }
|
27189 | return rangeMin + percent * (rangeMax - rangeMin);
|
27190 | };
|
27191 |
|
27192 | |
27193 |
|
27194 |
|
27195 |
|
27196 |
|
27197 | Category.prototype.invert = function invert(value) {
|
27198 | if (Util.isString(value)) {
|
27199 |
|
27200 | return value;
|
27201 | }
|
27202 | var min = this.rangeMin();
|
27203 | var max = this.rangeMax();
|
27204 |
|
27205 |
|
27206 | if (value < min) {
|
27207 | value = min;
|
27208 | }
|
27209 | if (value > max) {
|
27210 | value = max;
|
27211 | }
|
27212 | var percent = (value - min) / (max - min);
|
27213 | var index = Math.round(percent * (this.values.length - 1)) % this.values.length;
|
27214 | index = index || 0;
|
27215 | return this.values[index];
|
27216 | };
|
27217 |
|
27218 | return Category;
|
27219 | }(Base);
|
27220 |
|
27221 | module.exports = Category;
|
27222 |
|
27223 | }),
|
27224 |
|
27225 | (function(module, exports, __webpack_require__) {
|
27226 |
|
27227 |
|
27228 |
|
27229 |
|
27230 |
|
27231 |
|
27232 | var Util = __webpack_require__(0);
|
27233 | var MAX_COUNT = 8;
|
27234 |
|
27235 | function getSimpleArray(data) {
|
27236 | var arr = [];
|
27237 | Util.each(data, function (sub) {
|
27238 | if (Util.isArray(sub)) {
|
27239 | arr = arr.concat(sub);
|
27240 | } else {
|
27241 | arr.push(sub);
|
27242 | }
|
27243 | });
|
27244 | return arr;
|
27245 | }
|
27246 |
|
27247 | module.exports = function (info) {
|
27248 | var rst = {};
|
27249 | var ticks = [];
|
27250 | var tickCount = info.maxCount || MAX_COUNT;
|
27251 |
|
27252 | var categories = getSimpleArray(info.data);
|
27253 | if (categories.length <= tickCount + tickCount / 2) {
|
27254 | ticks = [].concat(categories);
|
27255 | } else {
|
27256 | var length = categories.length;
|
27257 | var step = parseInt(length / (tickCount - 1), 10);
|
27258 |
|
27259 | var groups = categories.map(function (e, i) {
|
27260 | return i % step === 0 ? categories.slice(i, i + step) : null;
|
27261 | }).filter(function (e) {
|
27262 | return e;
|
27263 | });
|
27264 |
|
27265 | ticks.push(categories[0]);
|
27266 | for (var i = 1; i < groups.length && i < tickCount - 1; i++) {
|
27267 | ticks.push(groups[i][0]);
|
27268 | }
|
27269 |
|
27270 | ticks.push(categories[length - 1]);
|
27271 | }
|
27272 |
|
27273 | rst.categories = categories;
|
27274 | rst.ticks = ticks;
|
27275 | return rst;
|
27276 | };
|
27277 |
|
27278 | }),
|
27279 |
|
27280 | (function(module, exports, __webpack_require__) {
|
27281 |
|
27282 | var __WEBPACK_AMD_DEFINE_RESULT__;(function (main) {
|
27283 | 'use strict';
|
27284 |
|
27285 | |
27286 |
|
27287 |
|
27288 |
|
27289 |
|
27290 | var fecha = {};
|
27291 | var token = /d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
|
27292 | var twoDigits = /\d\d?/;
|
27293 | var threeDigits = /\d{3}/;
|
27294 | var fourDigits = /\d{4}/;
|
27295 | var word = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
|
27296 | var literal = /\[([^]*?)\]/gm;
|
27297 | var noop = function noop() {};
|
27298 |
|
27299 | function shorten(arr, sLen) {
|
27300 | var newArr = [];
|
27301 | for (var i = 0, len = arr.length; i < len; i++) {
|
27302 | newArr.push(arr[i].substr(0, sLen));
|
27303 | }
|
27304 | return newArr;
|
27305 | }
|
27306 |
|
27307 | function monthUpdate(arrName) {
|
27308 | return function (d, v, i18n) {
|
27309 | var index = i18n[arrName].indexOf(v.charAt(0).toUpperCase() + v.substr(1).toLowerCase());
|
27310 | if (~index) {
|
27311 | d.month = index;
|
27312 | }
|
27313 | };
|
27314 | }
|
27315 |
|
27316 | function pad(val, len) {
|
27317 | val = String(val);
|
27318 | len = len || 2;
|
27319 | while (val.length < len) {
|
27320 | val = '0' + val;
|
27321 | }
|
27322 | return val;
|
27323 | }
|
27324 |
|
27325 | var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
27326 | var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
27327 | var monthNamesShort = shorten(monthNames, 3);
|
27328 | var dayNamesShort = shorten(dayNames, 3);
|
27329 | fecha.i18n = {
|
27330 | dayNamesShort: dayNamesShort,
|
27331 | dayNames: dayNames,
|
27332 | monthNamesShort: monthNamesShort,
|
27333 | monthNames: monthNames,
|
27334 | amPm: ['am', 'pm'],
|
27335 | DoFn: function DoFn(D) {
|
27336 | return D + ['th', 'st', 'nd', 'rd'][D % 10 > 3 ? 0 : (D - D % 10 !== 10) * D % 10];
|
27337 | }
|
27338 | };
|
27339 |
|
27340 | var formatFlags = {
|
27341 | D: function D(dateObj) {
|
27342 | return dateObj.getDate();
|
27343 | },
|
27344 | DD: function DD(dateObj) {
|
27345 | return pad(dateObj.getDate());
|
27346 | },
|
27347 | Do: function Do(dateObj, i18n) {
|
27348 | return i18n.DoFn(dateObj.getDate());
|
27349 | },
|
27350 | d: function d(dateObj) {
|
27351 | return dateObj.getDay();
|
27352 | },
|
27353 | dd: function dd(dateObj) {
|
27354 | return pad(dateObj.getDay());
|
27355 | },
|
27356 | ddd: function ddd(dateObj, i18n) {
|
27357 | return i18n.dayNamesShort[dateObj.getDay()];
|
27358 | },
|
27359 | dddd: function dddd(dateObj, i18n) {
|
27360 | return i18n.dayNames[dateObj.getDay()];
|
27361 | },
|
27362 | M: function M(dateObj) {
|
27363 | return dateObj.getMonth() + 1;
|
27364 | },
|
27365 | MM: function MM(dateObj) {
|
27366 | return pad(dateObj.getMonth() + 1);
|
27367 | },
|
27368 | MMM: function MMM(dateObj, i18n) {
|
27369 | return i18n.monthNamesShort[dateObj.getMonth()];
|
27370 | },
|
27371 | MMMM: function MMMM(dateObj, i18n) {
|
27372 | return i18n.monthNames[dateObj.getMonth()];
|
27373 | },
|
27374 | YY: function YY(dateObj) {
|
27375 | return String(dateObj.getFullYear()).substr(2);
|
27376 | },
|
27377 | YYYY: function YYYY(dateObj) {
|
27378 | return dateObj.getFullYear();
|
27379 | },
|
27380 | h: function h(dateObj) {
|
27381 | return dateObj.getHours() % 12 || 12;
|
27382 | },
|
27383 | hh: function hh(dateObj) {
|
27384 | return pad(dateObj.getHours() % 12 || 12);
|
27385 | },
|
27386 | H: function H(dateObj) {
|
27387 | return dateObj.getHours();
|
27388 | },
|
27389 | HH: function HH(dateObj) {
|
27390 | return pad(dateObj.getHours());
|
27391 | },
|
27392 | m: function m(dateObj) {
|
27393 | return dateObj.getMinutes();
|
27394 | },
|
27395 | mm: function mm(dateObj) {
|
27396 | return pad(dateObj.getMinutes());
|
27397 | },
|
27398 | s: function s(dateObj) {
|
27399 | return dateObj.getSeconds();
|
27400 | },
|
27401 | ss: function ss(dateObj) {
|
27402 | return pad(dateObj.getSeconds());
|
27403 | },
|
27404 | S: function S(dateObj) {
|
27405 | return Math.round(dateObj.getMilliseconds() / 100);
|
27406 | },
|
27407 | SS: function SS(dateObj) {
|
27408 | return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
|
27409 | },
|
27410 | SSS: function SSS(dateObj) {
|
27411 | return pad(dateObj.getMilliseconds(), 3);
|
27412 | },
|
27413 | a: function a(dateObj, i18n) {
|
27414 | return dateObj.getHours() < 12 ? i18n.amPm[0] : i18n.amPm[1];
|
27415 | },
|
27416 | A: function A(dateObj, i18n) {
|
27417 | return dateObj.getHours() < 12 ? i18n.amPm[0].toUpperCase() : i18n.amPm[1].toUpperCase();
|
27418 | },
|
27419 | ZZ: function ZZ(dateObj) {
|
27420 | var o = dateObj.getTimezoneOffset();
|
27421 | return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
|
27422 | }
|
27423 | };
|
27424 |
|
27425 | var parseFlags = {
|
27426 | D: [twoDigits, function (d, v) {
|
27427 | d.day = v;
|
27428 | }],
|
27429 | Do: [new RegExp(twoDigits.source + word.source), function (d, v) {
|
27430 | d.day = parseInt(v, 10);
|
27431 | }],
|
27432 | M: [twoDigits, function (d, v) {
|
27433 | d.month = v - 1;
|
27434 | }],
|
27435 | YY: [twoDigits, function (d, v) {
|
27436 | var da = new Date(),
|
27437 | cent = +('' + da.getFullYear()).substr(0, 2);
|
27438 | d.year = '' + (v > 68 ? cent - 1 : cent) + v;
|
27439 | }],
|
27440 | h: [twoDigits, function (d, v) {
|
27441 | d.hour = v;
|
27442 | }],
|
27443 | m: [twoDigits, function (d, v) {
|
27444 | d.minute = v;
|
27445 | }],
|
27446 | s: [twoDigits, function (d, v) {
|
27447 | d.second = v;
|
27448 | }],
|
27449 | YYYY: [fourDigits, function (d, v) {
|
27450 | d.year = v;
|
27451 | }],
|
27452 | S: [/\d/, function (d, v) {
|
27453 | d.millisecond = v * 100;
|
27454 | }],
|
27455 | SS: [/\d{2}/, function (d, v) {
|
27456 | d.millisecond = v * 10;
|
27457 | }],
|
27458 | SSS: [threeDigits, function (d, v) {
|
27459 | d.millisecond = v;
|
27460 | }],
|
27461 | d: [twoDigits, noop],
|
27462 | ddd: [word, noop],
|
27463 | MMM: [word, monthUpdate('monthNamesShort')],
|
27464 | MMMM: [word, monthUpdate('monthNames')],
|
27465 | a: [word, function (d, v, i18n) {
|
27466 | var val = v.toLowerCase();
|
27467 | if (val === i18n.amPm[0]) {
|
27468 | d.isPm = false;
|
27469 | } else if (val === i18n.amPm[1]) {
|
27470 | d.isPm = true;
|
27471 | }
|
27472 | }],
|
27473 | ZZ: [/([\+\-]\d\d:?\d\d|Z)/, function (d, v) {
|
27474 | if (v === 'Z') v = '+00:00';
|
27475 | var parts = (v + '').match(/([\+\-]|\d\d)/gi),
|
27476 | minutes;
|
27477 |
|
27478 | if (parts) {
|
27479 | minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
|
27480 | d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
|
27481 | }
|
27482 | }]
|
27483 | };
|
27484 | parseFlags.dd = parseFlags.d;
|
27485 | parseFlags.dddd = parseFlags.ddd;
|
27486 | parseFlags.DD = parseFlags.D;
|
27487 | parseFlags.mm = parseFlags.m;
|
27488 | parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
|
27489 | parseFlags.MM = parseFlags.M;
|
27490 | parseFlags.ss = parseFlags.s;
|
27491 | parseFlags.A = parseFlags.a;
|
27492 |
|
27493 |
|
27494 | fecha.masks = {
|
27495 | default: 'ddd MMM DD YYYY HH:mm:ss',
|
27496 | shortDate: 'M/D/YY',
|
27497 | mediumDate: 'MMM D, YYYY',
|
27498 | longDate: 'MMMM D, YYYY',
|
27499 | fullDate: 'dddd, MMMM D, YYYY',
|
27500 | shortTime: 'HH:mm',
|
27501 | mediumTime: 'HH:mm:ss',
|
27502 | longTime: 'HH:mm:ss.SSS'
|
27503 | };
|
27504 |
|
27505 | |
27506 |
|
27507 |
|
27508 |
|
27509 |
|
27510 |
|
27511 | fecha.format = function (dateObj, mask, i18nSettings) {
|
27512 | var i18n = i18nSettings || fecha.i18n;
|
27513 |
|
27514 | if (typeof dateObj === 'number') {
|
27515 | dateObj = new Date(dateObj);
|
27516 | }
|
27517 |
|
27518 | if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
|
27519 | throw new Error('Invalid Date in fecha.format');
|
27520 | }
|
27521 |
|
27522 | mask = fecha.masks[mask] || mask || fecha.masks['default'];
|
27523 |
|
27524 | var literals = [];
|
27525 |
|
27526 |
|
27527 | mask = mask.replace(literal, function ($0, $1) {
|
27528 | literals.push($1);
|
27529 | return '??';
|
27530 | });
|
27531 |
|
27532 | mask = mask.replace(token, function ($0) {
|
27533 | return $0 in formatFlags ? formatFlags[$0](dateObj, i18n) : $0.slice(1, $0.length - 1);
|
27534 | });
|
27535 |
|
27536 | return mask.replace(/\?\?/g, function () {
|
27537 | return literals.shift();
|
27538 | });
|
27539 | };
|
27540 |
|
27541 | |
27542 |
|
27543 |
|
27544 |
|
27545 |
|
27546 |
|
27547 |
|
27548 | fecha.parse = function (dateStr, format, i18nSettings) {
|
27549 | var i18n = i18nSettings || fecha.i18n;
|
27550 |
|
27551 | if (typeof format !== 'string') {
|
27552 | throw new Error('Invalid format in fecha.parse');
|
27553 | }
|
27554 |
|
27555 | format = fecha.masks[format] || format;
|
27556 |
|
27557 |
|
27558 |
|
27559 | if (dateStr.length > 1000) {
|
27560 | return false;
|
27561 | }
|
27562 |
|
27563 | var isValid = true;
|
27564 | var dateInfo = {};
|
27565 | format.replace(token, function ($0) {
|
27566 | if (parseFlags[$0]) {
|
27567 | var info = parseFlags[$0];
|
27568 | var index = dateStr.search(info[0]);
|
27569 | if (!~index) {
|
27570 | isValid = false;
|
27571 | } else {
|
27572 | dateStr.replace(info[0], function (result) {
|
27573 | info[1](dateInfo, result, i18n);
|
27574 | dateStr = dateStr.substr(index + result.length);
|
27575 | return result;
|
27576 | });
|
27577 | }
|
27578 | }
|
27579 |
|
27580 | return parseFlags[$0] ? '' : $0.slice(1, $0.length - 1);
|
27581 | });
|
27582 |
|
27583 | if (!isValid) {
|
27584 | return false;
|
27585 | }
|
27586 |
|
27587 | var today = new Date();
|
27588 | if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
|
27589 | dateInfo.hour = +dateInfo.hour + 12;
|
27590 | } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
|
27591 | dateInfo.hour = 0;
|
27592 | }
|
27593 |
|
27594 | var date;
|
27595 | if (dateInfo.timezoneOffset != null) {
|
27596 | dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
|
27597 | date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
|
27598 | } else {
|
27599 | date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
|
27600 | }
|
27601 | return date;
|
27602 | };
|
27603 |
|
27604 |
|
27605 | if (typeof module !== 'undefined' && module.exports) {
|
27606 | module.exports = fecha;
|
27607 | } else if (true) {
|
27608 | !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
|
27609 | return fecha;
|
27610 | }).call(exports, __webpack_require__, exports, module),
|
27611 | __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
27612 | } else {
|
27613 | main.fecha = fecha;
|
27614 | }
|
27615 | })(this);
|
27616 |
|
27617 | }),
|
27618 |
|
27619 | (function(module, exports, __webpack_require__) {
|
27620 |
|
27621 |
|
27622 |
|
27623 |
|
27624 |
|
27625 |
|
27626 | var Util = __webpack_require__(0);
|
27627 |
|
27628 | module.exports = {
|
27629 | toTimeStamp: function toTimeStamp(value) {
|
27630 | if (Util.isString(value)) {
|
27631 | if (value.indexOf('T') > 0) {
|
27632 | value = new Date(value).getTime();
|
27633 | } else {
|
27634 | value = new Date(value.replace(/-/ig, '/')).getTime();
|
27635 | }
|
27636 | }
|
27637 | if (Util.isDate(value)) {
|
27638 | value = value.getTime();
|
27639 | }
|
27640 | return value;
|
27641 | }
|
27642 | };
|
27643 |
|
27644 | }),
|
27645 |
|
27646 | (function(module, exports, __webpack_require__) {
|
27647 |
|
27648 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
27649 |
|
27650 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
27651 |
|
27652 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
27653 |
|
27654 |
|
27655 |
|
27656 |
|
27657 |
|
27658 | var Util = __webpack_require__(0);
|
27659 | var Global = __webpack_require__(1);
|
27660 |
|
27661 | var _require = __webpack_require__(2),
|
27662 | Group = _require.Group;
|
27663 |
|
27664 | var Base = function (_Group) {
|
27665 | _inherits(Base, _Group);
|
27666 |
|
27667 | function Base() {
|
27668 | _classCallCheck(this, Base);
|
27669 |
|
27670 | return _possibleConstructorReturn(this, _Group.apply(this, arguments));
|
27671 | }
|
27672 |
|
27673 | Base.prototype.getDefaultCfg = function getDefaultCfg() {
|
27674 | return {
|
27675 | |
27676 |
|
27677 |
|
27678 |
|
27679 | title: {
|
27680 | fill: '#333',
|
27681 | textBaseline: 'middle'
|
27682 | },
|
27683 | |
27684 |
|
27685 |
|
27686 |
|
27687 | itemFormatter: null,
|
27688 | |
27689 |
|
27690 |
|
27691 |
|
27692 | useHtml: false,
|
27693 | |
27694 |
|
27695 |
|
27696 |
|
27697 | inPlot: false,
|
27698 | |
27699 |
|
27700 |
|
27701 |
|
27702 | hoverable: true
|
27703 | };
|
27704 | };
|
27705 |
|
27706 | Base.prototype._beforeRenderUI = function _beforeRenderUI() {
|
27707 | this.set('itemsGroup', this.addGroup());
|
27708 | };
|
27709 |
|
27710 | Base.prototype._renderUI = function _renderUI() {
|
27711 | this._renderTitle();
|
27712 | };
|
27713 |
|
27714 | Base.prototype._renderTitle = function _renderTitle() {
|
27715 | var title = this.get('title');
|
27716 | if (title && title.text) {
|
27717 | var titleShape = this.addShape('text', {
|
27718 | attrs: Util.mix({
|
27719 | x: 0,
|
27720 | y: 0,
|
27721 | fill: '#333',
|
27722 | textBaseline: 'middle',
|
27723 | fontFamily: Global.fontFamily
|
27724 | }, title)
|
27725 | });
|
27726 | titleShape.name = 'legend-title';
|
27727 | this.get('appendInfo') && titleShape.setSilent('appendInfo', this.get('appendInfo'));
|
27728 | this.set('titleShape', titleShape);
|
27729 | }
|
27730 | };
|
27731 |
|
27732 | Base.prototype.getCheckedCount = function getCheckedCount() {
|
27733 | var itemsGroup = this.get('itemsGroup');
|
27734 | var items = itemsGroup.get('children');
|
27735 | var checkedArr = Util.filter(items, function (item) {
|
27736 | return item.get('checked');
|
27737 | });
|
27738 | return checkedArr.length;
|
27739 | };
|
27740 |
|
27741 | Base.prototype.setItems = function setItems(items) {
|
27742 | this.set('items', items);
|
27743 | this.clearItems();
|
27744 | this._renderUI();
|
27745 | };
|
27746 |
|
27747 | Base.prototype.addItem = function addItem(item) {
|
27748 | var items = this.get('items');
|
27749 | items.push(item);
|
27750 | this.clearItems();
|
27751 | this._renderUI();
|
27752 | };
|
27753 |
|
27754 | Base.prototype.clearItems = function clearItems() {
|
27755 | var itemsGroup = this.get('itemsGroup');
|
27756 | itemsGroup.clear();
|
27757 | };
|
27758 |
|
27759 | Base.prototype.getWidth = function getWidth() {
|
27760 | var bbox = this.getBBox();
|
27761 | return bbox.width;
|
27762 | };
|
27763 |
|
27764 | Base.prototype.getHeight = function getHeight() {
|
27765 | var bbox = this.getBBox();
|
27766 | return bbox.height;
|
27767 | };
|
27768 |
|
27769 | return Base;
|
27770 | }(Group);
|
27771 |
|
27772 | module.exports = Base;
|
27773 |
|
27774 | }),
|
27775 |
|
27776 | (function(module, exports, __webpack_require__) {
|
27777 |
|
27778 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
27779 |
|
27780 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
27781 |
|
27782 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
27783 |
|
27784 |
|
27785 |
|
27786 |
|
27787 |
|
27788 | var Util = __webpack_require__(0);
|
27789 | var Global = __webpack_require__(1);
|
27790 | var Base = __webpack_require__(122);
|
27791 |
|
27792 | var _require = __webpack_require__(2),
|
27793 | Event = _require.Event,
|
27794 | Group = _require.Group;
|
27795 |
|
27796 | var Slider = __webpack_require__(351);
|
27797 | var TRIGGER_WIDTH = 12;
|
27798 |
|
27799 | var Continuous = function (_Base) {
|
27800 | _inherits(Continuous, _Base);
|
27801 |
|
27802 | function Continuous() {
|
27803 | _classCallCheck(this, Continuous);
|
27804 |
|
27805 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
27806 | }
|
27807 |
|
27808 | Continuous.prototype.getDefaultCfg = function getDefaultCfg() {
|
27809 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
27810 | return Util.mix({}, cfg, {
|
27811 | |
27812 |
|
27813 |
|
27814 |
|
27815 | type: 'continuous-legend',
|
27816 | |
27817 |
|
27818 |
|
27819 |
|
27820 | items: null,
|
27821 | |
27822 |
|
27823 |
|
27824 |
|
27825 |
|
27826 |
|
27827 | layout: 'vertical',
|
27828 | |
27829 |
|
27830 |
|
27831 |
|
27832 | width: 156,
|
27833 | |
27834 |
|
27835 |
|
27836 |
|
27837 | height: 20,
|
27838 | |
27839 |
|
27840 |
|
27841 |
|
27842 | titleGap: 22,
|
27843 | |
27844 |
|
27845 |
|
27846 |
|
27847 | textStyle: {
|
27848 | fill: '#333',
|
27849 | textAlign: 'center',
|
27850 | textBaseline: 'middle',
|
27851 | fontFamily: Global.fontFamily
|
27852 | },
|
27853 | |
27854 |
|
27855 |
|
27856 |
|
27857 | slidable: true,
|
27858 | |
27859 |
|
27860 |
|
27861 |
|
27862 | inRange: {
|
27863 | fill: '#4E7CCC'
|
27864 | },
|
27865 | _range: [0, 100],
|
27866 | |
27867 |
|
27868 |
|
27869 |
|
27870 | middleAttr: {
|
27871 | fill: '#fff',
|
27872 | fillOpacity: 0
|
27873 | },
|
27874 | outRangeStyle: {
|
27875 | fill: '#D9D9D9'
|
27876 | },
|
27877 | labelOffset: 10
|
27878 | });
|
27879 | };
|
27880 |
|
27881 | Continuous.prototype._calStartPoint = function _calStartPoint() {
|
27882 | var start = {
|
27883 | x: 0,
|
27884 | y: this.get('titleGap') - TRIGGER_WIDTH
|
27885 | };
|
27886 | var titleShape = this.get('titleShape');
|
27887 | if (titleShape) {
|
27888 | var titleBox = titleShape.getBBox();
|
27889 | start.y += titleBox.height;
|
27890 | }
|
27891 |
|
27892 | return start;
|
27893 | };
|
27894 |
|
27895 | Continuous.prototype._beforeRenderUI = function _beforeRenderUI() {
|
27896 | var items = this.get('items');
|
27897 | if (!Util.isArray(items) || Util.isEmpty(items)) {
|
27898 | return;
|
27899 | }
|
27900 |
|
27901 | _Base.prototype._beforeRenderUI.call(this);
|
27902 | this.set('firstItem', items[0]);
|
27903 | this.set('lastItem', items[items.length - 1]);
|
27904 | };
|
27905 |
|
27906 | Continuous.prototype._formatItemValue = function _formatItemValue(value) {
|
27907 | var formatter = this.get('itemFormatter');
|
27908 | if (formatter) {
|
27909 | value = formatter.call(this, value);
|
27910 | }
|
27911 | return value;
|
27912 | };
|
27913 |
|
27914 | Continuous.prototype._renderUI = function _renderUI() {
|
27915 | _Base.prototype._renderUI.call(this);
|
27916 |
|
27917 | if (this.get('slidable')) {
|
27918 | this._renderSlider();
|
27919 | } else {
|
27920 | this._renderBackground();
|
27921 | }
|
27922 | };
|
27923 |
|
27924 | Continuous.prototype._renderSlider = function _renderSlider() {
|
27925 | var minHandleElement = new Group();
|
27926 | var maxHandleElement = new Group();
|
27927 | var backgroundElement = new Group();
|
27928 | var start = this._calStartPoint();
|
27929 | var slider = this.addGroup(Slider, {
|
27930 | minHandleElement: minHandleElement,
|
27931 | maxHandleElement: maxHandleElement,
|
27932 | backgroundElement: backgroundElement,
|
27933 | middleAttr: this.get('middleAttr'),
|
27934 | layout: this.get('layout'),
|
27935 | range: this.get('_range'),
|
27936 | width: this.get('width'),
|
27937 | height: this.get('height')
|
27938 | });
|
27939 | slider.translate(start.x, start.y);
|
27940 | this.set('slider', slider);
|
27941 |
|
27942 | var shape = this._renderSliderShape();
|
27943 | shape.attr('clip', slider.get('middleHandleElement'));
|
27944 | this._renderTrigger();
|
27945 | };
|
27946 |
|
27947 | Continuous.prototype._addBackground = function _addBackground(parent, name, attrs) {
|
27948 | parent.addShape(name, {
|
27949 | attrs: Util.mix({}, attrs, this.get('outRangeStyle'))
|
27950 | });
|
27951 | return parent.addShape(name, {
|
27952 | attrs: attrs
|
27953 | });
|
27954 | };
|
27955 |
|
27956 | Continuous.prototype._renderTrigger = function _renderTrigger() {
|
27957 | var min = this.get('firstItem');
|
27958 | var max = this.get('lastItem');
|
27959 | var layout = this.get('layout');
|
27960 | var textStyle = this.get('textStyle');
|
27961 | var inRange = this.get('inRange');
|
27962 | var attrType = this.get('type');
|
27963 | var minBlockAttr = void 0;
|
27964 | var maxBlockAttr = void 0;
|
27965 |
|
27966 | if (attrType === 'color-legend') {
|
27967 | minBlockAttr = {
|
27968 | fill: min.attrValue
|
27969 | };
|
27970 | maxBlockAttr = {
|
27971 | fill: max.attrValue
|
27972 | };
|
27973 | } else {
|
27974 | minBlockAttr = Util.mix({}, inRange);
|
27975 | maxBlockAttr = Util.mix({}, inRange);
|
27976 | }
|
27977 | var minTextAttr = Util.mix({
|
27978 | text: this._formatItemValue(min.value) + ''
|
27979 | }, textStyle);
|
27980 | var maxTextAttr = Util.mix({
|
27981 | text: this._formatItemValue(max.value) + ''
|
27982 | }, textStyle);
|
27983 | if (layout === 'vertical') {
|
27984 | this._addVerticalTrigger('min', minBlockAttr, minTextAttr);
|
27985 | this._addVerticalTrigger('max', maxBlockAttr, maxTextAttr);
|
27986 | } else {
|
27987 | this._addHorizontalTrigger('min', minBlockAttr, minTextAttr);
|
27988 | this._addHorizontalTrigger('max', maxBlockAttr, maxTextAttr);
|
27989 | }
|
27990 | };
|
27991 |
|
27992 | Continuous.prototype._addVerticalTrigger = function _addVerticalTrigger(type, blockAttr, textAttr) {
|
27993 | var slider = this.get('slider');
|
27994 | var trigger = slider.get(type + 'HandleElement');
|
27995 | var width = this.get('width');
|
27996 | var button = trigger.addShape('polygon', {
|
27997 | attrs: Util.mix({
|
27998 | points: [[width / 2 + TRIGGER_WIDTH, 0], [width / 2 + 1, 0], [width / 2 + TRIGGER_WIDTH, type === 'min' ? TRIGGER_WIDTH : -TRIGGER_WIDTH]]
|
27999 | }, blockAttr)
|
28000 | });
|
28001 | var text = trigger.addShape('text', {
|
28002 | attrs: Util.mix(textAttr, {
|
28003 | x: width + 8,
|
28004 | y: type === 'max' ? -4 : 4,
|
28005 | textAlign: 'start',
|
28006 | lineHeight: 1,
|
28007 | textBaseline: 'middle'
|
28008 | })
|
28009 | });
|
28010 | var layout = this.get('layout');
|
28011 | var trigerCursor = layout === 'vertical' ? 'ns-resize' : 'ew-resize';
|
28012 | button.attr('cursor', trigerCursor);
|
28013 | text.attr('cursor', trigerCursor);
|
28014 | this.set(type + 'ButtonElement', button);
|
28015 | this.set(type + 'TextElement', text);
|
28016 | };
|
28017 |
|
28018 | Continuous.prototype._addHorizontalTrigger = function _addHorizontalTrigger(type, blockAttr, textAttr) {
|
28019 | var slider = this.get('slider');
|
28020 | var trigger = slider.get(type + 'HandleElement');
|
28021 | var button = trigger.addShape('polygon', {
|
28022 | attrs: Util.mix({
|
28023 | points: [[0, 0], [0, TRIGGER_WIDTH], [type === 'min' ? -TRIGGER_WIDTH : TRIGGER_WIDTH, TRIGGER_WIDTH]]
|
28024 | }, blockAttr)
|
28025 | });
|
28026 | var text = trigger.addShape('text', {
|
28027 | attrs: Util.mix(textAttr, {
|
28028 | x: type === 'min' ? -TRIGGER_WIDTH - 4 : TRIGGER_WIDTH + 4,
|
28029 | y: TRIGGER_WIDTH / 2,
|
28030 | textAlign: type === 'min' ? 'end' : 'start',
|
28031 | textBaseline: 'middle'
|
28032 | })
|
28033 | });
|
28034 | var layout = this.get('layout');
|
28035 | var trigerCursor = layout === 'vertical' ? 'ns-resize' : 'ew-resize';
|
28036 | button.attr('cursor', trigerCursor);
|
28037 | text.attr('cursor', trigerCursor);
|
28038 | this.set(type + 'ButtonElement', button);
|
28039 | this.set(type + 'TextElement', text);
|
28040 | };
|
28041 |
|
28042 | Continuous.prototype._bindUI = function _bindUI() {
|
28043 | var self = this;
|
28044 | if (self.get('slidable')) {
|
28045 |
|
28046 | var slider = self.get('slider');
|
28047 | slider.on('sliderchange', function (ev) {
|
28048 | var range = ev.range;
|
28049 | var firstItemValue = self.get('firstItem').value * 1;
|
28050 | var lastItemValue = self.get('lastItem').value * 1;
|
28051 | var minValue = firstItemValue + range[0] / 100 * (lastItemValue - firstItemValue);
|
28052 | var maxValue = firstItemValue + range[1] / 100 * (lastItemValue - firstItemValue);
|
28053 | self._updateElement(minValue, maxValue);
|
28054 | var itemFiltered = new Event('itemfilter', ev, true, true);
|
28055 | itemFiltered.range = [minValue, maxValue];
|
28056 | self.emit('itemfilter', itemFiltered);
|
28057 | });
|
28058 | }
|
28059 | };
|
28060 |
|
28061 | Continuous.prototype._updateElement = function _updateElement(min, max) {
|
28062 | var minTextElement = this.get('minTextElement');
|
28063 | var maxTextElement = this.get('maxTextElement');
|
28064 | if (max > 1) {
|
28065 |
|
28066 | min = parseInt(min, 10);
|
28067 | max = parseInt(max, 10);
|
28068 | }
|
28069 | minTextElement.attr('text', this._formatItemValue(min) + '');
|
28070 | maxTextElement.attr('text', this._formatItemValue(max) + '');
|
28071 | if (this.get('type') === 'color-legend' && this.get('attr')) {
|
28072 | var attr = this.get('attr');
|
28073 | var minButtonElement = this.get('minButtonElement');
|
28074 | var maxButtonElement = this.get('maxButtonElement');
|
28075 | minButtonElement.attr('fill', attr.mapping(min).join(''));
|
28076 | maxButtonElement.attr('fill', attr.mapping(max).join(''));
|
28077 | }
|
28078 | };
|
28079 |
|
28080 | return Continuous;
|
28081 | }(Base);
|
28082 |
|
28083 | module.exports = Continuous;
|
28084 |
|
28085 | }),
|
28086 |
|
28087 | (function(module, exports, __webpack_require__) {
|
28088 |
|
28089 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
28090 |
|
28091 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
28092 |
|
28093 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
28094 |
|
28095 |
|
28096 |
|
28097 |
|
28098 |
|
28099 |
|
28100 | var Base = __webpack_require__(45);
|
28101 |
|
28102 |
|
28103 |
|
28104 |
|
28105 |
|
28106 |
|
28107 |
|
28108 |
|
28109 |
|
28110 |
|
28111 |
|
28112 |
|
28113 |
|
28114 |
|
28115 |
|
28116 |
|
28117 |
|
28118 |
|
28119 | var Rect = function (_Base) {
|
28120 | _inherits(Rect, _Base);
|
28121 |
|
28122 | function Rect() {
|
28123 | _classCallCheck(this, Rect);
|
28124 |
|
28125 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
28126 | }
|
28127 |
|
28128 | Rect.prototype.getDefaultCfg = function getDefaultCfg() {
|
28129 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
28130 | cfg.type = 'rect';
|
28131 | return cfg;
|
28132 | };
|
28133 |
|
28134 | Rect.prototype.generateFacets = function generateFacets(data) {
|
28135 | var self = this;
|
28136 | var fields = self.fields;
|
28137 |
|
28138 | var rst = [];
|
28139 | var rows = 1;
|
28140 | var cols = 1;
|
28141 | var colField = fields[0];
|
28142 | var rowField = fields[1];
|
28143 | var colValues = [''];
|
28144 | var rowValues = [''];
|
28145 | if (colField) {
|
28146 | colValues = self.getFieldValues(colField, data);
|
28147 | cols = colValues.length;
|
28148 | }
|
28149 | if (rowField) {
|
28150 | rowValues = self.getFieldValues(rowField, data);
|
28151 | rows = rowValues.length;
|
28152 | }
|
28153 |
|
28154 |
|
28155 | colValues.forEach(function (xVal, xIndex) {
|
28156 | rowValues.forEach(function (yVal, yIndex) {
|
28157 | var conditions = [{ field: colField, value: xVal, values: colValues }, { field: rowField, value: yVal, values: rowValues }];
|
28158 | var filter = self.getFilter(conditions);
|
28159 | var subData = data.filter(filter);
|
28160 | var facet = {
|
28161 | type: self.type,
|
28162 | colValue: xVal,
|
28163 | rowValue: yVal,
|
28164 | colField: colField,
|
28165 | rowField: rowField,
|
28166 | colIndex: xIndex,
|
28167 | rowIndex: yIndex,
|
28168 | cols: cols,
|
28169 | rows: rows,
|
28170 | data: subData,
|
28171 | region: self.getRegion(rows, cols, xIndex, yIndex)
|
28172 | };
|
28173 | rst.push(facet);
|
28174 | });
|
28175 | });
|
28176 |
|
28177 | return rst;
|
28178 | };
|
28179 |
|
28180 |
|
28181 |
|
28182 |
|
28183 | Rect.prototype.setXAxis = function setXAxis(xField, axes, facet) {
|
28184 | if (facet.rowIndex !== facet.rows - 1) {
|
28185 | axes[xField].title = null;
|
28186 | axes[xField].label = null;
|
28187 | } else if (facet.colIndex !== parseInt((facet.cols - 1) / 2)) {
|
28188 | axes[xField].title = null;
|
28189 | }
|
28190 | };
|
28191 |
|
28192 |
|
28193 |
|
28194 | Rect.prototype.setYAxis = function setYAxis(yField, axes, facet) {
|
28195 | if (facet.colIndex !== 0) {
|
28196 | axes[yField].title = null;
|
28197 | axes[yField].label = null;
|
28198 | } else if (facet.rowIndex !== parseInt((facet.rows - 1) / 2)) {
|
28199 | axes[yField].title = null;
|
28200 | }
|
28201 | };
|
28202 |
|
28203 | Rect.prototype.renderTitle = function renderTitle(view, facet) {
|
28204 | if (facet.rowIndex === 0) {
|
28205 | this.drawColTitle(view, facet);
|
28206 | }
|
28207 | if (facet.colIndex === facet.cols - 1) {
|
28208 | this.drawRowTitle(view, facet);
|
28209 | }
|
28210 | };
|
28211 |
|
28212 | return Rect;
|
28213 | }(Base);
|
28214 |
|
28215 | module.exports = Rect;
|
28216 |
|
28217 | }),
|
28218 |
|
28219 | (function(module, exports, __webpack_require__) {
|
28220 |
|
28221 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
28222 |
|
28223 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
28224 |
|
28225 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
28226 |
|
28227 |
|
28228 |
|
28229 |
|
28230 |
|
28231 | var Base = __webpack_require__(45);
|
28232 |
|
28233 |
|
28234 |
|
28235 |
|
28236 |
|
28237 |
|
28238 | var List = function (_Base) {
|
28239 | _inherits(List, _Base);
|
28240 |
|
28241 | function List() {
|
28242 | _classCallCheck(this, List);
|
28243 |
|
28244 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
28245 | }
|
28246 |
|
28247 | List.prototype.getDefaultCfg = function getDefaultCfg() {
|
28248 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
28249 | cfg.type = 'list';
|
28250 | cfg.cols = null;
|
28251 | return cfg;
|
28252 | };
|
28253 |
|
28254 | List.prototype.generateFacets = function generateFacets(data) {
|
28255 | var self = this;
|
28256 | var fields = self.fields;
|
28257 | var colField = fields[0];
|
28258 | if (!colField) {
|
28259 | throw 'Please specify for the field for facet!';
|
28260 | }
|
28261 | var colValues = self.getFieldValues(colField, data);
|
28262 | var count = colValues.length;
|
28263 | var cols = self.cols || count;
|
28264 | var rows = parseInt((count + cols - 1) / cols);
|
28265 | var rst = [];
|
28266 | colValues.forEach(function (xVal, index) {
|
28267 | var row = parseInt(index / cols);
|
28268 | var col = index % cols;
|
28269 | var conditions = [{ field: colField, value: xVal, values: colValues }];
|
28270 | var filter = self.getFilter(conditions);
|
28271 | var subData = data.filter(filter);
|
28272 | var facet = {
|
28273 | type: self.type,
|
28274 | count: count,
|
28275 | colValue: xVal,
|
28276 | colField: colField,
|
28277 | rowField: null,
|
28278 | rowValue: xVal,
|
28279 | colIndex: col,
|
28280 | rowIndex: row,
|
28281 | cols: cols,
|
28282 | rows: rows,
|
28283 | data: subData,
|
28284 | region: self.getRegion(rows, cols, col, row)
|
28285 | };
|
28286 | rst.push(facet);
|
28287 | });
|
28288 | return rst;
|
28289 | };
|
28290 |
|
28291 |
|
28292 |
|
28293 |
|
28294 | List.prototype.setXAxis = function setXAxis(xField, axes, facet) {
|
28295 |
|
28296 | if (facet.rowIndex !== facet.rows - 1 && facet.cols * facet.rowIndex + facet.colIndex + 1 + facet.cols <= facet.count) {
|
28297 | axes[xField].label = null;
|
28298 | axes[xField].title = null;
|
28299 | }
|
28300 | };
|
28301 |
|
28302 |
|
28303 |
|
28304 |
|
28305 | List.prototype.setYAxis = function setYAxis(yField, axes, facet) {
|
28306 | if (facet.colIndex !== 0) {
|
28307 | axes[yField].title = null;
|
28308 | axes[yField].label = null;
|
28309 | }
|
28310 | };
|
28311 |
|
28312 | return List;
|
28313 | }(Base);
|
28314 |
|
28315 | module.exports = List;
|
28316 |
|
28317 | }),
|
28318 |
|
28319 | (function(module, exports, __webpack_require__) {
|
28320 |
|
28321 | var G = __webpack_require__(2);
|
28322 | var Animate = __webpack_require__(68);
|
28323 | var Chart = __webpack_require__(282);
|
28324 | var Global = __webpack_require__(1);
|
28325 | var Scale = __webpack_require__(116);
|
28326 | var Shape = __webpack_require__(66);
|
28327 | var Util = __webpack_require__(0);
|
28328 |
|
28329 | var G2 = {
|
28330 |
|
28331 | version: Global.version,
|
28332 |
|
28333 | Animate: Animate,
|
28334 | Chart: Chart,
|
28335 | Global: Global,
|
28336 | Scale: Scale,
|
28337 | Shape: Shape,
|
28338 | Util: Util,
|
28339 |
|
28340 | G: G,
|
28341 | DomUtil: G.DomUtil,
|
28342 | MatrixUtil: G.MatrixUtil,
|
28343 | PathUtil: G.PathUtil
|
28344 | };
|
28345 |
|
28346 | G2.track = function (enable) {
|
28347 | Global.trackable = enable;
|
28348 | };
|
28349 | __webpack_require__(365);
|
28350 |
|
28351 |
|
28352 | if (typeof window !== 'undefined') {
|
28353 | if (window.G2) {
|
28354 | console.warn('There are multiple versions of G2. Version ' + G2.version + '\'s reference is \'window.G2_3\'');
|
28355 | } else {
|
28356 | window.G2 = G2;
|
28357 | }
|
28358 | }
|
28359 |
|
28360 | module.exports = G2;
|
28361 |
|
28362 | }),
|
28363 |
|
28364 | (function(module, exports, __webpack_require__) {
|
28365 |
|
28366 | module.exports = __webpack_require__(128);
|
28367 |
|
28368 | }),
|
28369 |
|
28370 | (function(module, exports, __webpack_require__) {
|
28371 |
|
28372 | var arrayEach = __webpack_require__(69),
|
28373 | baseEach = __webpack_require__(27),
|
28374 | castFunction = __webpack_require__(141),
|
28375 | isArray = __webpack_require__(3);
|
28376 |
|
28377 |
|
28378 |
|
28379 |
|
28380 |
|
28381 |
|
28382 |
|
28383 |
|
28384 |
|
28385 |
|
28386 |
|
28387 |
|
28388 |
|
28389 |
|
28390 |
|
28391 |
|
28392 |
|
28393 |
|
28394 |
|
28395 |
|
28396 |
|
28397 |
|
28398 |
|
28399 |
|
28400 |
|
28401 |
|
28402 |
|
28403 |
|
28404 |
|
28405 |
|
28406 |
|
28407 | function forEach(collection, iteratee) {
|
28408 | var func = isArray(collection) ? arrayEach : baseEach;
|
28409 | return func(collection, castFunction(iteratee));
|
28410 | }
|
28411 |
|
28412 | module.exports = forEach;
|
28413 |
|
28414 | }),
|
28415 |
|
28416 | (function(module, exports, __webpack_require__) {
|
28417 |
|
28418 | var baseFor = __webpack_require__(130),
|
28419 | keys = __webpack_require__(11);
|
28420 |
|
28421 |
|
28422 |
|
28423 |
|
28424 |
|
28425 |
|
28426 |
|
28427 |
|
28428 |
|
28429 | function baseForOwn(object, iteratee) {
|
28430 | return object && baseFor(object, iteratee, keys);
|
28431 | }
|
28432 |
|
28433 | module.exports = baseForOwn;
|
28434 |
|
28435 | }),
|
28436 |
|
28437 | (function(module, exports, __webpack_require__) {
|
28438 |
|
28439 | var createBaseFor = __webpack_require__(131);
|
28440 |
|
28441 |
|
28442 |
|
28443 |
|
28444 |
|
28445 |
|
28446 |
|
28447 |
|
28448 |
|
28449 |
|
28450 |
|
28451 |
|
28452 | var baseFor = createBaseFor();
|
28453 |
|
28454 | module.exports = baseFor;
|
28455 |
|
28456 | }),
|
28457 |
|
28458 | (function(module, exports) {
|
28459 |
|
28460 |
|
28461 |
|
28462 |
|
28463 |
|
28464 |
|
28465 |
|
28466 |
|
28467 | function createBaseFor(fromRight) {
|
28468 | return function (object, iteratee, keysFunc) {
|
28469 | var index = -1,
|
28470 | iterable = Object(object),
|
28471 | props = keysFunc(object),
|
28472 | length = props.length;
|
28473 |
|
28474 | while (length--) {
|
28475 | var key = props[fromRight ? length : ++index];
|
28476 | if (iteratee(iterable[key], key, iterable) === false) {
|
28477 | break;
|
28478 | }
|
28479 | }
|
28480 | return object;
|
28481 | };
|
28482 | }
|
28483 |
|
28484 | module.exports = createBaseFor;
|
28485 |
|
28486 | }),
|
28487 |
|
28488 | (function(module, exports) {
|
28489 |
|
28490 |
|
28491 |
|
28492 |
|
28493 |
|
28494 |
|
28495 |
|
28496 |
|
28497 |
|
28498 |
|
28499 | function baseTimes(n, iteratee) {
|
28500 | var index = -1,
|
28501 | result = Array(n);
|
28502 |
|
28503 | while (++index < n) {
|
28504 | result[index] = iteratee(index);
|
28505 | }
|
28506 | return result;
|
28507 | }
|
28508 |
|
28509 | module.exports = baseTimes;
|
28510 |
|
28511 | }),
|
28512 |
|
28513 | (function(module, exports, __webpack_require__) {
|
28514 |
|
28515 | var baseGetTag = __webpack_require__(6),
|
28516 | isObjectLike = __webpack_require__(5);
|
28517 |
|
28518 |
|
28519 | var argsTag = '[object Arguments]';
|
28520 |
|
28521 |
|
28522 |
|
28523 |
|
28524 |
|
28525 |
|
28526 |
|
28527 |
|
28528 | function baseIsArguments(value) {
|
28529 | return isObjectLike(value) && baseGetTag(value) == argsTag;
|
28530 | }
|
28531 |
|
28532 | module.exports = baseIsArguments;
|
28533 |
|
28534 | }),
|
28535 |
|
28536 | (function(module, exports) {
|
28537 |
|
28538 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
28539 |
|
28540 | var g;
|
28541 |
|
28542 |
|
28543 | g = function () {
|
28544 | return this;
|
28545 | }();
|
28546 |
|
28547 | try {
|
28548 |
|
28549 | g = g || Function("return this")() || (1, eval)("this");
|
28550 | } catch (e) {
|
28551 |
|
28552 | if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
|
28553 | }
|
28554 |
|
28555 |
|
28556 |
|
28557 |
|
28558 |
|
28559 | module.exports = g;
|
28560 |
|
28561 | }),
|
28562 |
|
28563 | (function(module, exports, __webpack_require__) {
|
28564 |
|
28565 | var _Symbol = __webpack_require__(12);
|
28566 |
|
28567 |
|
28568 | var objectProto = Object.prototype;
|
28569 |
|
28570 |
|
28571 | var hasOwnProperty = objectProto.hasOwnProperty;
|
28572 |
|
28573 |
|
28574 |
|
28575 |
|
28576 |
|
28577 |
|
28578 | var nativeObjectToString = objectProto.toString;
|
28579 |
|
28580 |
|
28581 | var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
28582 |
|
28583 |
|
28584 |
|
28585 |
|
28586 |
|
28587 |
|
28588 |
|
28589 |
|
28590 | function getRawTag(value) {
|
28591 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
28592 | tag = value[symToStringTag];
|
28593 |
|
28594 | try {
|
28595 | value[symToStringTag] = undefined;
|
28596 | var unmasked = true;
|
28597 | } catch (e) {}
|
28598 |
|
28599 | var result = nativeObjectToString.call(value);
|
28600 | if (unmasked) {
|
28601 | if (isOwn) {
|
28602 | value[symToStringTag] = tag;
|
28603 | } else {
|
28604 | delete value[symToStringTag];
|
28605 | }
|
28606 | }
|
28607 | return result;
|
28608 | }
|
28609 |
|
28610 | module.exports = getRawTag;
|
28611 |
|
28612 | }),
|
28613 |
|
28614 | (function(module, exports) {
|
28615 |
|
28616 |
|
28617 | var objectProto = Object.prototype;
|
28618 |
|
28619 |
|
28620 |
|
28621 |
|
28622 |
|
28623 |
|
28624 | var nativeObjectToString = objectProto.toString;
|
28625 |
|
28626 |
|
28627 |
|
28628 |
|
28629 |
|
28630 |
|
28631 |
|
28632 |
|
28633 | function objectToString(value) {
|
28634 | return nativeObjectToString.call(value);
|
28635 | }
|
28636 |
|
28637 | module.exports = objectToString;
|
28638 |
|
28639 | }),
|
28640 |
|
28641 | (function(module, exports) {
|
28642 |
|
28643 |
|
28644 |
|
28645 |
|
28646 |
|
28647 |
|
28648 |
|
28649 |
|
28650 |
|
28651 |
|
28652 |
|
28653 |
|
28654 |
|
28655 |
|
28656 | function stubFalse() {
|
28657 | return false;
|
28658 | }
|
28659 |
|
28660 | module.exports = stubFalse;
|
28661 |
|
28662 | }),
|
28663 |
|
28664 | (function(module, exports, __webpack_require__) {
|
28665 |
|
28666 | var baseGetTag = __webpack_require__(6),
|
28667 | isLength = __webpack_require__(47),
|
28668 | isObjectLike = __webpack_require__(5);
|
28669 |
|
28670 |
|
28671 | var argsTag = '[object Arguments]',
|
28672 | arrayTag = '[object Array]',
|
28673 | boolTag = '[object Boolean]',
|
28674 | dateTag = '[object Date]',
|
28675 | errorTag = '[object Error]',
|
28676 | funcTag = '[object Function]',
|
28677 | mapTag = '[object Map]',
|
28678 | numberTag = '[object Number]',
|
28679 | objectTag = '[object Object]',
|
28680 | regexpTag = '[object RegExp]',
|
28681 | setTag = '[object Set]',
|
28682 | stringTag = '[object String]',
|
28683 | weakMapTag = '[object WeakMap]';
|
28684 |
|
28685 | var arrayBufferTag = '[object ArrayBuffer]',
|
28686 | dataViewTag = '[object DataView]',
|
28687 | float32Tag = '[object Float32Array]',
|
28688 | float64Tag = '[object Float64Array]',
|
28689 | int8Tag = '[object Int8Array]',
|
28690 | int16Tag = '[object Int16Array]',
|
28691 | int32Tag = '[object Int32Array]',
|
28692 | uint8Tag = '[object Uint8Array]',
|
28693 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
28694 | uint16Tag = '[object Uint16Array]',
|
28695 | uint32Tag = '[object Uint32Array]';
|
28696 |
|
28697 |
|
28698 | var typedArrayTags = {};
|
28699 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
28700 | typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
|
28701 |
|
28702 |
|
28703 |
|
28704 |
|
28705 |
|
28706 |
|
28707 |
|
28708 |
|
28709 | function baseIsTypedArray(value) {
|
28710 | return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
28711 | }
|
28712 |
|
28713 | module.exports = baseIsTypedArray;
|
28714 |
|
28715 | }),
|
28716 |
|
28717 | (function(module, exports, __webpack_require__) {
|
28718 |
|
28719 | var overArg = __webpack_require__(75);
|
28720 |
|
28721 |
|
28722 | var nativeKeys = overArg(Object.keys, Object);
|
28723 |
|
28724 | module.exports = nativeKeys;
|
28725 |
|
28726 | }),
|
28727 |
|
28728 | (function(module, exports, __webpack_require__) {
|
28729 |
|
28730 | var isArrayLike = __webpack_require__(8);
|
28731 |
|
28732 |
|
28733 |
|
28734 |
|
28735 |
|
28736 |
|
28737 |
|
28738 |
|
28739 |
|
28740 | function createBaseEach(eachFunc, fromRight) {
|
28741 | return function (collection, iteratee) {
|
28742 | if (collection == null) {
|
28743 | return collection;
|
28744 | }
|
28745 | if (!isArrayLike(collection)) {
|
28746 | return eachFunc(collection, iteratee);
|
28747 | }
|
28748 | var length = collection.length,
|
28749 | index = fromRight ? length : -1,
|
28750 | iterable = Object(collection);
|
28751 |
|
28752 | while (fromRight ? index-- : ++index < length) {
|
28753 | if (iteratee(iterable[index], index, iterable) === false) {
|
28754 | break;
|
28755 | }
|
28756 | }
|
28757 | return collection;
|
28758 | };
|
28759 | }
|
28760 |
|
28761 | module.exports = createBaseEach;
|
28762 |
|
28763 | }),
|
28764 |
|
28765 | (function(module, exports, __webpack_require__) {
|
28766 |
|
28767 | var identity = __webpack_require__(31);
|
28768 |
|
28769 |
|
28770 |
|
28771 |
|
28772 |
|
28773 |
|
28774 |
|
28775 |
|
28776 | function castFunction(value) {
|
28777 | return typeof value == 'function' ? value : identity;
|
28778 | }
|
28779 |
|
28780 | module.exports = castFunction;
|
28781 |
|
28782 | }),
|
28783 |
|
28784 | (function(module, exports, __webpack_require__) {
|
28785 |
|
28786 | var arrayMap = __webpack_require__(49),
|
28787 | baseIteratee = __webpack_require__(19),
|
28788 | baseMap = __webpack_require__(192),
|
28789 | isArray = __webpack_require__(3);
|
28790 |
|
28791 |
|
28792 |
|
28793 |
|
28794 |
|
28795 |
|
28796 |
|
28797 |
|
28798 |
|
28799 |
|
28800 |
|
28801 |
|
28802 |
|
28803 |
|
28804 |
|
28805 |
|
28806 |
|
28807 |
|
28808 |
|
28809 |
|
28810 |
|
28811 |
|
28812 |
|
28813 |
|
28814 |
|
28815 |
|
28816 |
|
28817 |
|
28818 |
|
28819 |
|
28820 |
|
28821 |
|
28822 |
|
28823 |
|
28824 |
|
28825 |
|
28826 |
|
28827 |
|
28828 |
|
28829 |
|
28830 |
|
28831 |
|
28832 |
|
28833 | function map(collection, iteratee) {
|
28834 | var func = isArray(collection) ? arrayMap : baseMap;
|
28835 | return func(collection, baseIteratee(iteratee, 3));
|
28836 | }
|
28837 |
|
28838 | module.exports = map;
|
28839 |
|
28840 | }),
|
28841 |
|
28842 | (function(module, exports, __webpack_require__) {
|
28843 |
|
28844 | var baseIsMatch = __webpack_require__(144),
|
28845 | getMatchData = __webpack_require__(180),
|
28846 | matchesStrictComparable = __webpack_require__(87);
|
28847 |
|
28848 |
|
28849 |
|
28850 |
|
28851 |
|
28852 |
|
28853 |
|
28854 |
|
28855 | function baseMatches(source) {
|
28856 | var matchData = getMatchData(source);
|
28857 | if (matchData.length == 1 && matchData[0][2]) {
|
28858 | return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
28859 | }
|
28860 | return function (object) {
|
28861 | return object === source || baseIsMatch(object, source, matchData);
|
28862 | };
|
28863 | }
|
28864 |
|
28865 | module.exports = baseMatches;
|
28866 |
|
28867 | }),
|
28868 |
|
28869 | (function(module, exports, __webpack_require__) {
|
28870 |
|
28871 | var Stack = __webpack_require__(50),
|
28872 | baseIsEqual = __webpack_require__(37);
|
28873 |
|
28874 |
|
28875 | var COMPARE_PARTIAL_FLAG = 1,
|
28876 | COMPARE_UNORDERED_FLAG = 2;
|
28877 |
|
28878 |
|
28879 |
|
28880 |
|
28881 |
|
28882 |
|
28883 |
|
28884 |
|
28885 |
|
28886 |
|
28887 |
|
28888 | function baseIsMatch(object, source, matchData, customizer) {
|
28889 | var index = matchData.length,
|
28890 | length = index,
|
28891 | noCustomizer = !customizer;
|
28892 |
|
28893 | if (object == null) {
|
28894 | return !length;
|
28895 | }
|
28896 | object = Object(object);
|
28897 | while (index--) {
|
28898 | var data = matchData[index];
|
28899 | if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
|
28900 | return false;
|
28901 | }
|
28902 | }
|
28903 | while (++index < length) {
|
28904 | data = matchData[index];
|
28905 | var key = data[0],
|
28906 | objValue = object[key],
|
28907 | srcValue = data[1];
|
28908 |
|
28909 | if (noCustomizer && data[2]) {
|
28910 | if (objValue === undefined && !(key in object)) {
|
28911 | return false;
|
28912 | }
|
28913 | } else {
|
28914 | var stack = new Stack();
|
28915 | if (customizer) {
|
28916 | var result = customizer(objValue, srcValue, key, object, source, stack);
|
28917 | }
|
28918 | if (!(result === undefined ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result)) {
|
28919 | return false;
|
28920 | }
|
28921 | }
|
28922 | }
|
28923 | return true;
|
28924 | }
|
28925 |
|
28926 | module.exports = baseIsMatch;
|
28927 |
|
28928 | }),
|
28929 |
|
28930 | (function(module, exports) {
|
28931 |
|
28932 |
|
28933 |
|
28934 |
|
28935 |
|
28936 |
|
28937 |
|
28938 |
|
28939 | function listCacheClear() {
|
28940 | this.__data__ = [];
|
28941 | this.size = 0;
|
28942 | }
|
28943 |
|
28944 | module.exports = listCacheClear;
|
28945 |
|
28946 | }),
|
28947 |
|
28948 | (function(module, exports, __webpack_require__) {
|
28949 |
|
28950 | var assocIndexOf = __webpack_require__(33);
|
28951 |
|
28952 |
|
28953 | var arrayProto = Array.prototype;
|
28954 |
|
28955 |
|
28956 | var splice = arrayProto.splice;
|
28957 |
|
28958 |
|
28959 |
|
28960 |
|
28961 |
|
28962 |
|
28963 |
|
28964 |
|
28965 |
|
28966 |
|
28967 | function listCacheDelete(key) {
|
28968 | var data = this.__data__,
|
28969 | index = assocIndexOf(data, key);
|
28970 |
|
28971 | if (index < 0) {
|
28972 | return false;
|
28973 | }
|
28974 | var lastIndex = data.length - 1;
|
28975 | if (index == lastIndex) {
|
28976 | data.pop();
|
28977 | } else {
|
28978 | splice.call(data, index, 1);
|
28979 | }
|
28980 | --this.size;
|
28981 | return true;
|
28982 | }
|
28983 |
|
28984 | module.exports = listCacheDelete;
|
28985 |
|
28986 | }),
|
28987 |
|
28988 | (function(module, exports, __webpack_require__) {
|
28989 |
|
28990 | var assocIndexOf = __webpack_require__(33);
|
28991 |
|
28992 |
|
28993 |
|
28994 |
|
28995 |
|
28996 |
|
28997 |
|
28998 |
|
28999 |
|
29000 |
|
29001 | function listCacheGet(key) {
|
29002 | var data = this.__data__,
|
29003 | index = assocIndexOf(data, key);
|
29004 |
|
29005 | return index < 0 ? undefined : data[index][1];
|
29006 | }
|
29007 |
|
29008 | module.exports = listCacheGet;
|
29009 |
|
29010 | }),
|
29011 |
|
29012 | (function(module, exports, __webpack_require__) {
|
29013 |
|
29014 | var assocIndexOf = __webpack_require__(33);
|
29015 |
|
29016 |
|
29017 |
|
29018 |
|
29019 |
|
29020 |
|
29021 |
|
29022 |
|
29023 |
|
29024 |
|
29025 | function listCacheHas(key) {
|
29026 | return assocIndexOf(this.__data__, key) > -1;
|
29027 | }
|
29028 |
|
29029 | module.exports = listCacheHas;
|
29030 |
|
29031 | }),
|
29032 |
|
29033 | (function(module, exports, __webpack_require__) {
|
29034 |
|
29035 | var assocIndexOf = __webpack_require__(33);
|
29036 |
|
29037 |
|
29038 |
|
29039 |
|
29040 |
|
29041 |
|
29042 |
|
29043 |
|
29044 |
|
29045 |
|
29046 |
|
29047 | function listCacheSet(key, value) {
|
29048 | var data = this.__data__,
|
29049 | index = assocIndexOf(data, key);
|
29050 |
|
29051 | if (index < 0) {
|
29052 | ++this.size;
|
29053 | data.push([key, value]);
|
29054 | } else {
|
29055 | data[index][1] = value;
|
29056 | }
|
29057 | return this;
|
29058 | }
|
29059 |
|
29060 | module.exports = listCacheSet;
|
29061 |
|
29062 | }),
|
29063 |
|
29064 | (function(module, exports, __webpack_require__) {
|
29065 |
|
29066 | var ListCache = __webpack_require__(32);
|
29067 |
|
29068 |
|
29069 |
|
29070 |
|
29071 |
|
29072 |
|
29073 |
|
29074 |
|
29075 | function stackClear() {
|
29076 | this.__data__ = new ListCache();
|
29077 | this.size = 0;
|
29078 | }
|
29079 |
|
29080 | module.exports = stackClear;
|
29081 |
|
29082 | }),
|
29083 |
|
29084 | (function(module, exports) {
|
29085 |
|
29086 |
|
29087 |
|
29088 |
|
29089 |
|
29090 |
|
29091 |
|
29092 |
|
29093 |
|
29094 |
|
29095 | function stackDelete(key) {
|
29096 | var data = this.__data__,
|
29097 | result = data['delete'](key);
|
29098 |
|
29099 | this.size = data.size;
|
29100 | return result;
|
29101 | }
|
29102 |
|
29103 | module.exports = stackDelete;
|
29104 |
|
29105 | }),
|
29106 |
|
29107 | (function(module, exports) {
|
29108 |
|
29109 |
|
29110 |
|
29111 |
|
29112 |
|
29113 |
|
29114 |
|
29115 |
|
29116 |
|
29117 |
|
29118 | function stackGet(key) {
|
29119 | return this.__data__.get(key);
|
29120 | }
|
29121 |
|
29122 | module.exports = stackGet;
|
29123 |
|
29124 | }),
|
29125 |
|
29126 | (function(module, exports) {
|
29127 |
|
29128 |
|
29129 |
|
29130 |
|
29131 |
|
29132 |
|
29133 |
|
29134 |
|
29135 |
|
29136 |
|
29137 | function stackHas(key) {
|
29138 | return this.__data__.has(key);
|
29139 | }
|
29140 |
|
29141 | module.exports = stackHas;
|
29142 |
|
29143 | }),
|
29144 |
|
29145 | (function(module, exports, __webpack_require__) {
|
29146 |
|
29147 | var ListCache = __webpack_require__(32),
|
29148 | Map = __webpack_require__(51),
|
29149 | MapCache = __webpack_require__(52);
|
29150 |
|
29151 |
|
29152 | var LARGE_ARRAY_SIZE = 200;
|
29153 |
|
29154 |
|
29155 |
|
29156 |
|
29157 |
|
29158 |
|
29159 |
|
29160 |
|
29161 |
|
29162 |
|
29163 |
|
29164 | function stackSet(key, value) {
|
29165 | var data = this.__data__;
|
29166 | if (data instanceof ListCache) {
|
29167 | var pairs = data.__data__;
|
29168 | if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
29169 | pairs.push([key, value]);
|
29170 | this.size = ++data.size;
|
29171 | return this;
|
29172 | }
|
29173 | data = this.__data__ = new MapCache(pairs);
|
29174 | }
|
29175 | data.set(key, value);
|
29176 | this.size = data.size;
|
29177 | return this;
|
29178 | }
|
29179 |
|
29180 | module.exports = stackSet;
|
29181 |
|
29182 | }),
|
29183 |
|
29184 | (function(module, exports, __webpack_require__) {
|
29185 |
|
29186 | var isFunction = __webpack_require__(48),
|
29187 | isMasked = __webpack_require__(156),
|
29188 | isObject = __webpack_require__(7),
|
29189 | toSource = __webpack_require__(76);
|
29190 |
|
29191 |
|
29192 |
|
29193 |
|
29194 |
|
29195 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
29196 |
|
29197 |
|
29198 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
29199 |
|
29200 |
|
29201 | var funcProto = Function.prototype,
|
29202 | objectProto = Object.prototype;
|
29203 |
|
29204 |
|
29205 | var funcToString = funcProto.toString;
|
29206 |
|
29207 |
|
29208 | var hasOwnProperty = objectProto.hasOwnProperty;
|
29209 |
|
29210 |
|
29211 | var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
29212 |
|
29213 |
|
29214 |
|
29215 |
|
29216 |
|
29217 |
|
29218 |
|
29219 |
|
29220 |
|
29221 | function baseIsNative(value) {
|
29222 | if (!isObject(value) || isMasked(value)) {
|
29223 | return false;
|
29224 | }
|
29225 | var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
29226 | return pattern.test(toSource(value));
|
29227 | }
|
29228 |
|
29229 | module.exports = baseIsNative;
|
29230 |
|
29231 | }),
|
29232 |
|
29233 | (function(module, exports, __webpack_require__) {
|
29234 |
|
29235 | var coreJsData = __webpack_require__(157);
|
29236 |
|
29237 |
|
29238 | var maskSrcKey = function () {
|
29239 | var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
29240 | return uid ? 'Symbol(src)_1.' + uid : '';
|
29241 | }();
|
29242 |
|
29243 |
|
29244 |
|
29245 |
|
29246 |
|
29247 |
|
29248 |
|
29249 |
|
29250 | function isMasked(func) {
|
29251 | return !!maskSrcKey && maskSrcKey in func;
|
29252 | }
|
29253 |
|
29254 | module.exports = isMasked;
|
29255 |
|
29256 | }),
|
29257 |
|
29258 | (function(module, exports, __webpack_require__) {
|
29259 |
|
29260 | var root = __webpack_require__(4);
|
29261 |
|
29262 |
|
29263 | var coreJsData = root['__core-js_shared__'];
|
29264 |
|
29265 | module.exports = coreJsData;
|
29266 |
|
29267 | }),
|
29268 |
|
29269 | (function(module, exports) {
|
29270 |
|
29271 |
|
29272 |
|
29273 |
|
29274 |
|
29275 |
|
29276 |
|
29277 |
|
29278 |
|
29279 | function getValue(object, key) {
|
29280 | return object == null ? undefined : object[key];
|
29281 | }
|
29282 |
|
29283 | module.exports = getValue;
|
29284 |
|
29285 | }),
|
29286 |
|
29287 | (function(module, exports, __webpack_require__) {
|
29288 |
|
29289 | var Hash = __webpack_require__(160),
|
29290 | ListCache = __webpack_require__(32),
|
29291 | Map = __webpack_require__(51);
|
29292 |
|
29293 |
|
29294 |
|
29295 |
|
29296 |
|
29297 |
|
29298 |
|
29299 |
|
29300 | function mapCacheClear() {
|
29301 | this.size = 0;
|
29302 | this.__data__ = {
|
29303 | 'hash': new Hash(),
|
29304 | 'map': new (Map || ListCache)(),
|
29305 | 'string': new Hash()
|
29306 | };
|
29307 | }
|
29308 |
|
29309 | module.exports = mapCacheClear;
|
29310 |
|
29311 | }),
|
29312 |
|
29313 | (function(module, exports, __webpack_require__) {
|
29314 |
|
29315 | var hashClear = __webpack_require__(161),
|
29316 | hashDelete = __webpack_require__(162),
|
29317 | hashGet = __webpack_require__(163),
|
29318 | hashHas = __webpack_require__(164),
|
29319 | hashSet = __webpack_require__(165);
|
29320 |
|
29321 |
|
29322 |
|
29323 |
|
29324 |
|
29325 |
|
29326 |
|
29327 |
|
29328 | function Hash(entries) {
|
29329 | var index = -1,
|
29330 | length = entries == null ? 0 : entries.length;
|
29331 |
|
29332 | this.clear();
|
29333 | while (++index < length) {
|
29334 | var entry = entries[index];
|
29335 | this.set(entry[0], entry[1]);
|
29336 | }
|
29337 | }
|
29338 |
|
29339 |
|
29340 | Hash.prototype.clear = hashClear;
|
29341 | Hash.prototype['delete'] = hashDelete;
|
29342 | Hash.prototype.get = hashGet;
|
29343 | Hash.prototype.has = hashHas;
|
29344 | Hash.prototype.set = hashSet;
|
29345 |
|
29346 | module.exports = Hash;
|
29347 |
|
29348 | }),
|
29349 |
|
29350 | (function(module, exports, __webpack_require__) {
|
29351 |
|
29352 | var nativeCreate = __webpack_require__(35);
|
29353 |
|
29354 |
|
29355 |
|
29356 |
|
29357 |
|
29358 |
|
29359 |
|
29360 |
|
29361 | function hashClear() {
|
29362 | this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
29363 | this.size = 0;
|
29364 | }
|
29365 |
|
29366 | module.exports = hashClear;
|
29367 |
|
29368 | }),
|
29369 |
|
29370 | (function(module, exports) {
|
29371 |
|
29372 |
|
29373 |
|
29374 |
|
29375 |
|
29376 |
|
29377 |
|
29378 |
|
29379 |
|
29380 |
|
29381 |
|
29382 | function hashDelete(key) {
|
29383 | var result = this.has(key) && delete this.__data__[key];
|
29384 | this.size -= result ? 1 : 0;
|
29385 | return result;
|
29386 | }
|
29387 |
|
29388 | module.exports = hashDelete;
|
29389 |
|
29390 | }),
|
29391 |
|
29392 | (function(module, exports, __webpack_require__) {
|
29393 |
|
29394 | var nativeCreate = __webpack_require__(35);
|
29395 |
|
29396 |
|
29397 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
29398 |
|
29399 |
|
29400 | var objectProto = Object.prototype;
|
29401 |
|
29402 |
|
29403 | var hasOwnProperty = objectProto.hasOwnProperty;
|
29404 |
|
29405 |
|
29406 |
|
29407 |
|
29408 |
|
29409 |
|
29410 |
|
29411 |
|
29412 |
|
29413 |
|
29414 | function hashGet(key) {
|
29415 | var data = this.__data__;
|
29416 | if (nativeCreate) {
|
29417 | var result = data[key];
|
29418 | return result === HASH_UNDEFINED ? undefined : result;
|
29419 | }
|
29420 | return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
29421 | }
|
29422 |
|
29423 | module.exports = hashGet;
|
29424 |
|
29425 | }),
|
29426 |
|
29427 | (function(module, exports, __webpack_require__) {
|
29428 |
|
29429 | var nativeCreate = __webpack_require__(35);
|
29430 |
|
29431 |
|
29432 | var objectProto = Object.prototype;
|
29433 |
|
29434 |
|
29435 | var hasOwnProperty = objectProto.hasOwnProperty;
|
29436 |
|
29437 |
|
29438 |
|
29439 |
|
29440 |
|
29441 |
|
29442 |
|
29443 |
|
29444 |
|
29445 |
|
29446 | function hashHas(key) {
|
29447 | var data = this.__data__;
|
29448 | return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
29449 | }
|
29450 |
|
29451 | module.exports = hashHas;
|
29452 |
|
29453 | }),
|
29454 |
|
29455 | (function(module, exports, __webpack_require__) {
|
29456 |
|
29457 | var nativeCreate = __webpack_require__(35);
|
29458 |
|
29459 |
|
29460 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
29461 |
|
29462 |
|
29463 |
|
29464 |
|
29465 |
|
29466 |
|
29467 |
|
29468 |
|
29469 |
|
29470 |
|
29471 |
|
29472 | function hashSet(key, value) {
|
29473 | var data = this.__data__;
|
29474 | this.size += this.has(key) ? 0 : 1;
|
29475 | data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
|
29476 | return this;
|
29477 | }
|
29478 |
|
29479 | module.exports = hashSet;
|
29480 |
|
29481 | }),
|
29482 |
|
29483 | (function(module, exports, __webpack_require__) {
|
29484 |
|
29485 | var getMapData = __webpack_require__(36);
|
29486 |
|
29487 |
|
29488 |
|
29489 |
|
29490 |
|
29491 |
|
29492 |
|
29493 |
|
29494 |
|
29495 |
|
29496 | function mapCacheDelete(key) {
|
29497 | var result = getMapData(this, key)['delete'](key);
|
29498 | this.size -= result ? 1 : 0;
|
29499 | return result;
|
29500 | }
|
29501 |
|
29502 | module.exports = mapCacheDelete;
|
29503 |
|
29504 | }),
|
29505 |
|
29506 | (function(module, exports) {
|
29507 |
|
29508 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
29509 |
|
29510 |
|
29511 |
|
29512 |
|
29513 |
|
29514 |
|
29515 |
|
29516 |
|
29517 | function isKeyable(value) {
|
29518 | var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
29519 | return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
|
29520 | }
|
29521 |
|
29522 | module.exports = isKeyable;
|
29523 |
|
29524 | }),
|
29525 |
|
29526 | (function(module, exports, __webpack_require__) {
|
29527 |
|
29528 | var getMapData = __webpack_require__(36);
|
29529 |
|
29530 |
|
29531 |
|
29532 |
|
29533 |
|
29534 |
|
29535 |
|
29536 |
|
29537 |
|
29538 |
|
29539 | function mapCacheGet(key) {
|
29540 | return getMapData(this, key).get(key);
|
29541 | }
|
29542 |
|
29543 | module.exports = mapCacheGet;
|
29544 |
|
29545 | }),
|
29546 |
|
29547 | (function(module, exports, __webpack_require__) {
|
29548 |
|
29549 | var getMapData = __webpack_require__(36);
|
29550 |
|
29551 |
|
29552 |
|
29553 |
|
29554 |
|
29555 |
|
29556 |
|
29557 |
|
29558 |
|
29559 |
|
29560 | function mapCacheHas(key) {
|
29561 | return getMapData(this, key).has(key);
|
29562 | }
|
29563 |
|
29564 | module.exports = mapCacheHas;
|
29565 |
|
29566 | }),
|
29567 |
|
29568 | (function(module, exports, __webpack_require__) {
|
29569 |
|
29570 | var getMapData = __webpack_require__(36);
|
29571 |
|
29572 |
|
29573 |
|
29574 |
|
29575 |
|
29576 |
|
29577 |
|
29578 |
|
29579 |
|
29580 |
|
29581 |
|
29582 | function mapCacheSet(key, value) {
|
29583 | var data = getMapData(this, key),
|
29584 | size = data.size;
|
29585 |
|
29586 | data.set(key, value);
|
29587 | this.size += data.size == size ? 0 : 1;
|
29588 | return this;
|
29589 | }
|
29590 |
|
29591 | module.exports = mapCacheSet;
|
29592 |
|
29593 | }),
|
29594 |
|
29595 | (function(module, exports, __webpack_require__) {
|
29596 |
|
29597 | var Stack = __webpack_require__(50),
|
29598 | equalArrays = __webpack_require__(77),
|
29599 | equalByTag = __webpack_require__(175),
|
29600 | equalObjects = __webpack_require__(176),
|
29601 | getTag = __webpack_require__(38),
|
29602 | isArray = __webpack_require__(3),
|
29603 | isBuffer = __webpack_require__(29),
|
29604 | isTypedArray = __webpack_require__(46);
|
29605 |
|
29606 |
|
29607 | var COMPARE_PARTIAL_FLAG = 1;
|
29608 |
|
29609 |
|
29610 | var argsTag = '[object Arguments]',
|
29611 | arrayTag = '[object Array]',
|
29612 | objectTag = '[object Object]';
|
29613 |
|
29614 |
|
29615 | var objectProto = Object.prototype;
|
29616 |
|
29617 |
|
29618 | var hasOwnProperty = objectProto.hasOwnProperty;
|
29619 |
|
29620 |
|
29621 |
|
29622 |
|
29623 |
|
29624 |
|
29625 |
|
29626 |
|
29627 |
|
29628 |
|
29629 |
|
29630 |
|
29631 |
|
29632 |
|
29633 |
|
29634 | function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
29635 | var objIsArr = isArray(object),
|
29636 | othIsArr = isArray(other),
|
29637 | objTag = objIsArr ? arrayTag : getTag(object),
|
29638 | othTag = othIsArr ? arrayTag : getTag(other);
|
29639 |
|
29640 | objTag = objTag == argsTag ? objectTag : objTag;
|
29641 | othTag = othTag == argsTag ? objectTag : othTag;
|
29642 |
|
29643 | var objIsObj = objTag == objectTag,
|
29644 | othIsObj = othTag == objectTag,
|
29645 | isSameTag = objTag == othTag;
|
29646 |
|
29647 | if (isSameTag && isBuffer(object)) {
|
29648 | if (!isBuffer(other)) {
|
29649 | return false;
|
29650 | }
|
29651 | objIsArr = true;
|
29652 | objIsObj = false;
|
29653 | }
|
29654 | if (isSameTag && !objIsObj) {
|
29655 | stack || (stack = new Stack());
|
29656 | return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
29657 | }
|
29658 | if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
29659 | var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
29660 | othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
29661 |
|
29662 | if (objIsWrapped || othIsWrapped) {
|
29663 | var objUnwrapped = objIsWrapped ? object.value() : object,
|
29664 | othUnwrapped = othIsWrapped ? other.value() : other;
|
29665 |
|
29666 | stack || (stack = new Stack());
|
29667 | return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
29668 | }
|
29669 | }
|
29670 | if (!isSameTag) {
|
29671 | return false;
|
29672 | }
|
29673 | stack || (stack = new Stack());
|
29674 | return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
29675 | }
|
29676 |
|
29677 | module.exports = baseIsEqualDeep;
|
29678 |
|
29679 | }),
|
29680 |
|
29681 | (function(module, exports) {
|
29682 |
|
29683 |
|
29684 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
29685 |
|
29686 |
|
29687 |
|
29688 |
|
29689 |
|
29690 |
|
29691 |
|
29692 |
|
29693 |
|
29694 |
|
29695 |
|
29696 | function setCacheAdd(value) {
|
29697 | this.__data__.set(value, HASH_UNDEFINED);
|
29698 | return this;
|
29699 | }
|
29700 |
|
29701 | module.exports = setCacheAdd;
|
29702 |
|
29703 | }),
|
29704 |
|
29705 | (function(module, exports) {
|
29706 |
|
29707 |
|
29708 |
|
29709 |
|
29710 |
|
29711 |
|
29712 |
|
29713 |
|
29714 |
|
29715 |
|
29716 | function setCacheHas(value) {
|
29717 | return this.__data__.has(value);
|
29718 | }
|
29719 |
|
29720 | module.exports = setCacheHas;
|
29721 |
|
29722 | }),
|
29723 |
|
29724 | (function(module, exports) {
|
29725 |
|
29726 |
|
29727 |
|
29728 |
|
29729 |
|
29730 |
|
29731 |
|
29732 |
|
29733 |
|
29734 |
|
29735 |
|
29736 | function arraySome(array, predicate) {
|
29737 | var index = -1,
|
29738 | length = array == null ? 0 : array.length;
|
29739 |
|
29740 | while (++index < length) {
|
29741 | if (predicate(array[index], index, array)) {
|
29742 | return true;
|
29743 | }
|
29744 | }
|
29745 | return false;
|
29746 | }
|
29747 |
|
29748 | module.exports = arraySome;
|
29749 |
|
29750 | }),
|
29751 |
|
29752 | (function(module, exports, __webpack_require__) {
|
29753 |
|
29754 | var _Symbol = __webpack_require__(12),
|
29755 | Uint8Array = __webpack_require__(80),
|
29756 | eq = __webpack_require__(34),
|
29757 | equalArrays = __webpack_require__(77),
|
29758 | mapToArray = __webpack_require__(53),
|
29759 | setToArray = __webpack_require__(20);
|
29760 |
|
29761 |
|
29762 | var COMPARE_PARTIAL_FLAG = 1,
|
29763 | COMPARE_UNORDERED_FLAG = 2;
|
29764 |
|
29765 |
|
29766 | var boolTag = '[object Boolean]',
|
29767 | dateTag = '[object Date]',
|
29768 | errorTag = '[object Error]',
|
29769 | mapTag = '[object Map]',
|
29770 | numberTag = '[object Number]',
|
29771 | regexpTag = '[object RegExp]',
|
29772 | setTag = '[object Set]',
|
29773 | stringTag = '[object String]',
|
29774 | symbolTag = '[object Symbol]';
|
29775 |
|
29776 | var arrayBufferTag = '[object ArrayBuffer]',
|
29777 | dataViewTag = '[object DataView]';
|
29778 |
|
29779 |
|
29780 | var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
29781 | symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
29782 |
|
29783 |
|
29784 |
|
29785 |
|
29786 |
|
29787 |
|
29788 |
|
29789 |
|
29790 |
|
29791 |
|
29792 |
|
29793 |
|
29794 |
|
29795 |
|
29796 |
|
29797 |
|
29798 |
|
29799 |
|
29800 | function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
29801 | switch (tag) {
|
29802 | case dataViewTag:
|
29803 | if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
29804 | return false;
|
29805 | }
|
29806 | object = object.buffer;
|
29807 | other = other.buffer;
|
29808 |
|
29809 | case arrayBufferTag:
|
29810 | if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
29811 | return false;
|
29812 | }
|
29813 | return true;
|
29814 |
|
29815 | case boolTag:
|
29816 | case dateTag:
|
29817 | case numberTag:
|
29818 |
|
29819 |
|
29820 | return eq(+object, +other);
|
29821 |
|
29822 | case errorTag:
|
29823 | return object.name == other.name && object.message == other.message;
|
29824 |
|
29825 | case regexpTag:
|
29826 | case stringTag:
|
29827 |
|
29828 |
|
29829 |
|
29830 | return object == other + '';
|
29831 |
|
29832 | case mapTag:
|
29833 | var convert = mapToArray;
|
29834 |
|
29835 | case setTag:
|
29836 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
29837 | convert || (convert = setToArray);
|
29838 |
|
29839 | if (object.size != other.size && !isPartial) {
|
29840 | return false;
|
29841 | }
|
29842 |
|
29843 | var stacked = stack.get(object);
|
29844 | if (stacked) {
|
29845 | return stacked == other;
|
29846 | }
|
29847 | bitmask |= COMPARE_UNORDERED_FLAG;
|
29848 |
|
29849 |
|
29850 | stack.set(object, other);
|
29851 | var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
29852 | stack['delete'](object);
|
29853 | return result;
|
29854 |
|
29855 | case symbolTag:
|
29856 | if (symbolValueOf) {
|
29857 | return symbolValueOf.call(object) == symbolValueOf.call(other);
|
29858 | }
|
29859 | }
|
29860 | return false;
|
29861 | }
|
29862 |
|
29863 | module.exports = equalByTag;
|
29864 |
|
29865 | }),
|
29866 |
|
29867 | (function(module, exports, __webpack_require__) {
|
29868 |
|
29869 | var getAllKeys = __webpack_require__(81);
|
29870 |
|
29871 |
|
29872 | var COMPARE_PARTIAL_FLAG = 1;
|
29873 |
|
29874 |
|
29875 | var objectProto = Object.prototype;
|
29876 |
|
29877 |
|
29878 | var hasOwnProperty = objectProto.hasOwnProperty;
|
29879 |
|
29880 |
|
29881 |
|
29882 |
|
29883 |
|
29884 |
|
29885 |
|
29886 |
|
29887 |
|
29888 |
|
29889 |
|
29890 |
|
29891 |
|
29892 |
|
29893 | function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
29894 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
29895 | objProps = getAllKeys(object),
|
29896 | objLength = objProps.length,
|
29897 | othProps = getAllKeys(other),
|
29898 | othLength = othProps.length;
|
29899 |
|
29900 | if (objLength != othLength && !isPartial) {
|
29901 | return false;
|
29902 | }
|
29903 | var index = objLength;
|
29904 | while (index--) {
|
29905 | var key = objProps[index];
|
29906 | if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
29907 | return false;
|
29908 | }
|
29909 | }
|
29910 |
|
29911 | var stacked = stack.get(object);
|
29912 | if (stacked && stack.get(other)) {
|
29913 | return stacked == other;
|
29914 | }
|
29915 | var result = true;
|
29916 | stack.set(object, other);
|
29917 | stack.set(other, object);
|
29918 |
|
29919 | var skipCtor = isPartial;
|
29920 | while (++index < objLength) {
|
29921 | key = objProps[index];
|
29922 | var objValue = object[key],
|
29923 | othValue = other[key];
|
29924 |
|
29925 | if (customizer) {
|
29926 | var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
29927 | }
|
29928 |
|
29929 | if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
29930 | result = false;
|
29931 | break;
|
29932 | }
|
29933 | skipCtor || (skipCtor = key == 'constructor');
|
29934 | }
|
29935 | if (result && !skipCtor) {
|
29936 | var objCtor = object.constructor,
|
29937 | othCtor = other.constructor;
|
29938 |
|
29939 |
|
29940 | if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
29941 | result = false;
|
29942 | }
|
29943 | }
|
29944 | stack['delete'](object);
|
29945 | stack['delete'](other);
|
29946 | return result;
|
29947 | }
|
29948 |
|
29949 | module.exports = equalObjects;
|
29950 |
|
29951 | }),
|
29952 |
|
29953 | (function(module, exports, __webpack_require__) {
|
29954 |
|
29955 | var getNative = __webpack_require__(13),
|
29956 | root = __webpack_require__(4);
|
29957 |
|
29958 |
|
29959 | var DataView = getNative(root, 'DataView');
|
29960 |
|
29961 | module.exports = DataView;
|
29962 |
|
29963 | }),
|
29964 |
|
29965 | (function(module, exports, __webpack_require__) {
|
29966 |
|
29967 | var getNative = __webpack_require__(13),
|
29968 | root = __webpack_require__(4);
|
29969 |
|
29970 |
|
29971 | var Promise = getNative(root, 'Promise');
|
29972 |
|
29973 | module.exports = Promise;
|
29974 |
|
29975 | }),
|
29976 |
|
29977 | (function(module, exports, __webpack_require__) {
|
29978 |
|
29979 | var getNative = __webpack_require__(13),
|
29980 | root = __webpack_require__(4);
|
29981 |
|
29982 |
|
29983 | var WeakMap = getNative(root, 'WeakMap');
|
29984 |
|
29985 | module.exports = WeakMap;
|
29986 |
|
29987 | }),
|
29988 |
|
29989 | (function(module, exports, __webpack_require__) {
|
29990 |
|
29991 | var isStrictComparable = __webpack_require__(86),
|
29992 | keys = __webpack_require__(11);
|
29993 |
|
29994 |
|
29995 |
|
29996 |
|
29997 |
|
29998 |
|
29999 |
|
30000 |
|
30001 | function getMatchData(object) {
|
30002 | var result = keys(object),
|
30003 | length = result.length;
|
30004 |
|
30005 | while (length--) {
|
30006 | var key = result[length],
|
30007 | value = object[key];
|
30008 |
|
30009 | result[length] = [key, value, isStrictComparable(value)];
|
30010 | }
|
30011 | return result;
|
30012 | }
|
30013 |
|
30014 | module.exports = getMatchData;
|
30015 |
|
30016 | }),
|
30017 |
|
30018 | (function(module, exports, __webpack_require__) {
|
30019 |
|
30020 | var baseIsEqual = __webpack_require__(37),
|
30021 | get = __webpack_require__(182),
|
30022 | hasIn = __webpack_require__(88),
|
30023 | isKey = __webpack_require__(57),
|
30024 | isStrictComparable = __webpack_require__(86),
|
30025 | matchesStrictComparable = __webpack_require__(87),
|
30026 | toKey = __webpack_require__(22);
|
30027 |
|
30028 | /** Used to compose bitmasks for value comparisons. */
|
30029 | var COMPARE_PARTIAL_FLAG = 1,
|
30030 | COMPARE_UNORDERED_FLAG = 2;
|
30031 |
|
30032 | /**
|
30033 | * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
30034 | *
|
30035 | * @private
|
30036 | * @param {string} path The path of the property to get.
|
30037 | * @param {*} srcValue The value to match.
|
30038 | * @returns {Function} Returns the new spec function.
|
30039 | */
|
30040 | function baseMatchesProperty(path, srcValue) {
|
30041 | if (isKey(path) && isStrictComparable(srcValue)) {
|
30042 | return matchesStrictComparable(toKey(path), srcValue);
|
30043 | }
|
30044 | return function (object) {
|
30045 | var objValue = get(object, path);
|
30046 | return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
30047 | };
|
30048 | }
|
30049 |
|
30050 | module.exports = baseMatchesProperty;
|
30051 |
|
30052 | /***/ }),
|
30053 | /* 182 */
|
30054 | /***/ (function(module, exports, __webpack_require__) {
|
30055 |
|
30056 | var baseGet = __webpack_require__(56);
|
30057 |
|
30058 |
|
30059 |
|
30060 |
|
30061 |
|
30062 |
|
30063 |
|
30064 |
|
30065 |
|
30066 |
|
30067 |
|
30068 |
|
30069 |
|
30070 |
|
30071 |
|
30072 |
|
30073 |
|
30074 |
|
30075 |
|
30076 |
|
30077 |
|
30078 |
|
30079 |
|
30080 |
|
30081 |
|
30082 |
|
30083 | function get(object, path, defaultValue) {
|
30084 | var result = object == null ? undefined : baseGet(object, path);
|
30085 | return result === undefined ? defaultValue : result;
|
30086 | }
|
30087 |
|
30088 | module.exports = get;
|
30089 |
|
30090 | /***/ }),
|
30091 | /* 183 */
|
30092 | /***/ (function(module, exports, __webpack_require__) {
|
30093 |
|
30094 | var memoizeCapped = __webpack_require__(184);
|
30095 |
|
30096 |
|
30097 | var reLeadingDot = /^\./,
|
30098 | rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
30099 |
|
30100 |
|
30101 | var reEscapeChar = /\\(\\)?/g;
|
30102 |
|
30103 |
|
30104 |
|
30105 |
|
30106 |
|
30107 |
|
30108 |
|
30109 |
|
30110 | var stringToPath = memoizeCapped(function (string) {
|
30111 | var result = [];
|
30112 | if (reLeadingDot.test(string)) {
|
30113 | result.push('');
|
30114 | }
|
30115 | string.replace(rePropName, function (match, number, quote, string) {
|
30116 | result.push(quote ? string.replace(reEscapeChar, '$1') : number || match);
|
30117 | });
|
30118 | return result;
|
30119 | });
|
30120 |
|
30121 | module.exports = stringToPath;
|
30122 |
|
30123 | }),
|
30124 |
|
30125 | (function(module, exports, __webpack_require__) {
|
30126 |
|
30127 | var memoize = __webpack_require__(185);
|
30128 |
|
30129 |
|
30130 | var MAX_MEMOIZE_SIZE = 500;
|
30131 |
|
30132 |
|
30133 |
|
30134 |
|
30135 |
|
30136 |
|
30137 |
|
30138 |
|
30139 |
|
30140 | function memoizeCapped(func) {
|
30141 | var result = memoize(func, function (key) {
|
30142 | if (cache.size === MAX_MEMOIZE_SIZE) {
|
30143 | cache.clear();
|
30144 | }
|
30145 | return key;
|
30146 | });
|
30147 |
|
30148 | var cache = result.cache;
|
30149 | return result;
|
30150 | }
|
30151 |
|
30152 | module.exports = memoizeCapped;
|
30153 |
|
30154 | }),
|
30155 |
|
30156 | (function(module, exports, __webpack_require__) {
|
30157 |
|
30158 | var MapCache = __webpack_require__(52);
|
30159 |
|
30160 |
|
30161 | var FUNC_ERROR_TEXT = 'Expected a function';
|
30162 |
|
30163 |
|
30164 |
|
30165 |
|
30166 |
|
30167 |
|
30168 |
|
30169 |
|
30170 |
|
30171 |
|
30172 |
|
30173 |
|
30174 |
|
30175 |
|
30176 |
|
30177 |
|
30178 |
|
30179 |
|
30180 |
|
30181 |
|
30182 |
|
30183 |
|
30184 |
|
30185 |
|
30186 |
|
30187 |
|
30188 |
|
30189 |
|
30190 |
|
30191 |
|
30192 |
|
30193 |
|
30194 |
|
30195 |
|
30196 |
|
30197 |
|
30198 |
|
30199 |
|
30200 |
|
30201 |
|
30202 |
|
30203 |
|
30204 |
|
30205 |
|
30206 |
|
30207 | function memoize(func, resolver) {
|
30208 | if (typeof func != 'function' || resolver != null && typeof resolver != 'function') {
|
30209 | throw new TypeError(FUNC_ERROR_TEXT);
|
30210 | }
|
30211 | var memoized = function memoized() {
|
30212 | var args = arguments,
|
30213 | key = resolver ? resolver.apply(this, args) : args[0],
|
30214 | cache = memoized.cache;
|
30215 |
|
30216 | if (cache.has(key)) {
|
30217 | return cache.get(key);
|
30218 | }
|
30219 | var result = func.apply(this, args);
|
30220 | memoized.cache = cache.set(key, result) || cache;
|
30221 | return result;
|
30222 | };
|
30223 | memoized.cache = new (memoize.Cache || MapCache)();
|
30224 | return memoized;
|
30225 | }
|
30226 |
|
30227 |
|
30228 | memoize.Cache = MapCache;
|
30229 |
|
30230 | module.exports = memoize;
|
30231 |
|
30232 | }),
|
30233 |
|
30234 | (function(module, exports, __webpack_require__) {
|
30235 |
|
30236 | var _Symbol = __webpack_require__(12),
|
30237 | arrayMap = __webpack_require__(49),
|
30238 | isArray = __webpack_require__(3),
|
30239 | isSymbol = __webpack_require__(21);
|
30240 |
|
30241 |
|
30242 | var INFINITY = 1 / 0;
|
30243 |
|
30244 |
|
30245 | var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
30246 | symbolToString = symbolProto ? symbolProto.toString : undefined;
|
30247 |
|
30248 |
|
30249 |
|
30250 |
|
30251 |
|
30252 |
|
30253 |
|
30254 |
|
30255 |
|
30256 | function baseToString(value) {
|
30257 |
|
30258 | if (typeof value == 'string') {
|
30259 | return value;
|
30260 | }
|
30261 | if (isArray(value)) {
|
30262 |
|
30263 | return arrayMap(value, baseToString) + '';
|
30264 | }
|
30265 | if (isSymbol(value)) {
|
30266 | return symbolToString ? symbolToString.call(value) : '';
|
30267 | }
|
30268 | var result = value + '';
|
30269 | return result == '0' && 1 / value == -INFINITY ? '-0' : result;
|
30270 | }
|
30271 |
|
30272 | module.exports = baseToString;
|
30273 |
|
30274 | }),
|
30275 |
|
30276 | (function(module, exports) {
|
30277 |
|
30278 |
|
30279 |
|
30280 |
|
30281 |
|
30282 |
|
30283 |
|
30284 |
|
30285 |
|
30286 | function baseHasIn(object, key) {
|
30287 | return object != null && key in Object(object);
|
30288 | }
|
30289 |
|
30290 | module.exports = baseHasIn;
|
30291 |
|
30292 | }),
|
30293 |
|
30294 | (function(module, exports, __webpack_require__) {
|
30295 |
|
30296 | var castPath = __webpack_require__(39),
|
30297 | isArguments = __webpack_require__(28),
|
30298 | isArray = __webpack_require__(3),
|
30299 | isIndex = __webpack_require__(30),
|
30300 | isLength = __webpack_require__(47),
|
30301 | toKey = __webpack_require__(22);
|
30302 |
|
30303 |
|
30304 |
|
30305 |
|
30306 |
|
30307 |
|
30308 |
|
30309 |
|
30310 |
|
30311 |
|
30312 | function hasPath(object, path, hasFunc) {
|
30313 | path = castPath(path, object);
|
30314 |
|
30315 | var index = -1,
|
30316 | length = path.length,
|
30317 | result = false;
|
30318 |
|
30319 | while (++index < length) {
|
30320 | var key = toKey(path[index]);
|
30321 | if (!(result = object != null && hasFunc(object, key))) {
|
30322 | break;
|
30323 | }
|
30324 | object = object[key];
|
30325 | }
|
30326 | if (result || ++index != length) {
|
30327 | return result;
|
30328 | }
|
30329 | length = object == null ? 0 : object.length;
|
30330 | return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
|
30331 | }
|
30332 |
|
30333 | module.exports = hasPath;
|
30334 |
|
30335 | }),
|
30336 |
|
30337 | (function(module, exports, __webpack_require__) {
|
30338 |
|
30339 | var baseProperty = __webpack_require__(190),
|
30340 | basePropertyDeep = __webpack_require__(191),
|
30341 | isKey = __webpack_require__(57),
|
30342 | toKey = __webpack_require__(22);
|
30343 |
|
30344 |
|
30345 |
|
30346 |
|
30347 |
|
30348 |
|
30349 |
|
30350 |
|
30351 |
|
30352 |
|
30353 |
|
30354 |
|
30355 |
|
30356 |
|
30357 |
|
30358 |
|
30359 |
|
30360 |
|
30361 |
|
30362 |
|
30363 |
|
30364 |
|
30365 |
|
30366 | function property(path) {
|
30367 | return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
|
30368 | }
|
30369 |
|
30370 | module.exports = property;
|
30371 |
|
30372 | }),
|
30373 |
|
30374 | (function(module, exports) {
|
30375 |
|
30376 |
|
30377 |
|
30378 |
|
30379 |
|
30380 |
|
30381 |
|
30382 |
|
30383 | function baseProperty(key) {
|
30384 | return function (object) {
|
30385 | return object == null ? undefined : object[key];
|
30386 | };
|
30387 | }
|
30388 |
|
30389 | module.exports = baseProperty;
|
30390 |
|
30391 | }),
|
30392 |
|
30393 | (function(module, exports, __webpack_require__) {
|
30394 |
|
30395 | var baseGet = __webpack_require__(56);
|
30396 |
|
30397 |
|
30398 |
|
30399 |
|
30400 |
|
30401 |
|
30402 |
|
30403 |
|
30404 | function basePropertyDeep(path) {
|
30405 | return function (object) {
|
30406 | return baseGet(object, path);
|
30407 | };
|
30408 | }
|
30409 |
|
30410 | module.exports = basePropertyDeep;
|
30411 |
|
30412 | }),
|
30413 |
|
30414 | (function(module, exports, __webpack_require__) {
|
30415 |
|
30416 | var baseEach = __webpack_require__(27),
|
30417 | isArrayLike = __webpack_require__(8);
|
30418 |
|
30419 |
|
30420 |
|
30421 |
|
30422 |
|
30423 |
|
30424 |
|
30425 |
|
30426 |
|
30427 | function baseMap(collection, iteratee) {
|
30428 | var index = -1,
|
30429 | result = isArrayLike(collection) ? Array(collection.length) : [];
|
30430 |
|
30431 | baseEach(collection, function (value, key, collection) {
|
30432 | result[++index] = iteratee(value, key, collection);
|
30433 | });
|
30434 | return result;
|
30435 | }
|
30436 |
|
30437 | module.exports = baseMap;
|
30438 |
|
30439 | }),
|
30440 |
|
30441 | (function(module, exports, __webpack_require__) {
|
30442 |
|
30443 | var baseGetTag = __webpack_require__(6),
|
30444 | isObjectLike = __webpack_require__(5);
|
30445 |
|
30446 |
|
30447 | var numberTag = '[object Number]';
|
30448 |
|
30449 |
|
30450 |
|
30451 |
|
30452 |
|
30453 |
|
30454 |
|
30455 |
|
30456 |
|
30457 |
|
30458 |
|
30459 |
|
30460 |
|
30461 |
|
30462 |
|
30463 |
|
30464 |
|
30465 |
|
30466 |
|
30467 |
|
30468 |
|
30469 |
|
30470 |
|
30471 |
|
30472 |
|
30473 |
|
30474 |
|
30475 | function isNumber(value) {
|
30476 | return typeof value == 'number' || isObjectLike(value) && baseGetTag(value) == numberTag;
|
30477 | }
|
30478 |
|
30479 | module.exports = isNumber;
|
30480 |
|
30481 | }),
|
30482 |
|
30483 | (function(module, exports, __webpack_require__) {
|
30484 |
|
30485 | var root = __webpack_require__(4);
|
30486 |
|
30487 |
|
30488 | var nativeIsFinite = root.isFinite;
|
30489 |
|
30490 |
|
30491 |
|
30492 |
|
30493 |
|
30494 |
|
30495 |
|
30496 |
|
30497 |
|
30498 |
|
30499 |
|
30500 |
|
30501 |
|
30502 |
|
30503 |
|
30504 |
|
30505 |
|
30506 |
|
30507 |
|
30508 |
|
30509 |
|
30510 |
|
30511 |
|
30512 |
|
30513 |
|
30514 |
|
30515 |
|
30516 | function isFinite(value) {
|
30517 | return typeof value == 'number' && nativeIsFinite(value);
|
30518 | }
|
30519 |
|
30520 | module.exports = isFinite;
|
30521 |
|
30522 | }),
|
30523 |
|
30524 | (function(module, exports, __webpack_require__) {
|
30525 |
|
30526 | var baseGetTag = __webpack_require__(6),
|
30527 | isObjectLike = __webpack_require__(5);
|
30528 |
|
30529 |
|
30530 | var boolTag = '[object Boolean]';
|
30531 |
|
30532 |
|
30533 |
|
30534 |
|
30535 |
|
30536 |
|
30537 |
|
30538 |
|
30539 |
|
30540 |
|
30541 |
|
30542 |
|
30543 |
|
30544 |
|
30545 |
|
30546 |
|
30547 |
|
30548 |
|
30549 | function isBoolean(value) {
|
30550 | return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
|
30551 | }
|
30552 |
|
30553 | module.exports = isBoolean;
|
30554 |
|
30555 | }),
|
30556 |
|
30557 | (function(module, exports, __webpack_require__) {
|
30558 |
|
30559 | var baseKeys = __webpack_require__(74),
|
30560 | getTag = __webpack_require__(38),
|
30561 | isArguments = __webpack_require__(28),
|
30562 | isArray = __webpack_require__(3),
|
30563 | isArrayLike = __webpack_require__(8),
|
30564 | isBuffer = __webpack_require__(29),
|
30565 | isPrototype = __webpack_require__(18),
|
30566 | isTypedArray = __webpack_require__(46);
|
30567 |
|
30568 |
|
30569 | var mapTag = '[object Map]',
|
30570 | setTag = '[object Set]';
|
30571 |
|
30572 |
|
30573 | var objectProto = Object.prototype;
|
30574 |
|
30575 |
|
30576 | var hasOwnProperty = objectProto.hasOwnProperty;
|
30577 |
|
30578 |
|
30579 |
|
30580 |
|
30581 |
|
30582 |
|
30583 |
|
30584 |
|
30585 |
|
30586 |
|
30587 |
|
30588 |
|
30589 |
|
30590 |
|
30591 |
|
30592 |
|
30593 |
|
30594 |
|
30595 |
|
30596 |
|
30597 |
|
30598 |
|
30599 |
|
30600 |
|
30601 |
|
30602 |
|
30603 |
|
30604 |
|
30605 |
|
30606 |
|
30607 |
|
30608 |
|
30609 |
|
30610 |
|
30611 | function isEmpty(value) {
|
30612 | if (value == null) {
|
30613 | return true;
|
30614 | }
|
30615 | if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
30616 | return !value.length;
|
30617 | }
|
30618 | var tag = getTag(value);
|
30619 | if (tag == mapTag || tag == setTag) {
|
30620 | return !value.size;
|
30621 | }
|
30622 | if (isPrototype(value)) {
|
30623 | return !baseKeys(value).length;
|
30624 | }
|
30625 | for (var key in value) {
|
30626 | if (hasOwnProperty.call(value, key)) {
|
30627 | return false;
|
30628 | }
|
30629 | }
|
30630 | return true;
|
30631 | }
|
30632 |
|
30633 | module.exports = isEmpty;
|
30634 |
|
30635 | }),
|
30636 |
|
30637 | (function(module, exports, __webpack_require__) {
|
30638 |
|
30639 | var createCaseFirst = __webpack_require__(90);
|
30640 |
|
30641 |
|
30642 |
|
30643 |
|
30644 |
|
30645 |
|
30646 |
|
30647 |
|
30648 |
|
30649 |
|
30650 |
|
30651 |
|
30652 |
|
30653 |
|
30654 |
|
30655 |
|
30656 |
|
30657 |
|
30658 | var lowerFirst = createCaseFirst('toLowerCase');
|
30659 |
|
30660 | module.exports = lowerFirst;
|
30661 |
|
30662 | }),
|
30663 |
|
30664 | (function(module, exports, __webpack_require__) {
|
30665 |
|
30666 | var baseSlice = __webpack_require__(199);
|
30667 |
|
30668 |
|
30669 |
|
30670 |
|
30671 |
|
30672 |
|
30673 |
|
30674 |
|
30675 |
|
30676 |
|
30677 | function castSlice(array, start, end) {
|
30678 | var length = array.length;
|
30679 | end = end === undefined ? length : end;
|
30680 | return !start && end >= length ? array : baseSlice(array, start, end);
|
30681 | }
|
30682 |
|
30683 | module.exports = castSlice;
|
30684 |
|
30685 | }),
|
30686 |
|
30687 | (function(module, exports) {
|
30688 |
|
30689 |
|
30690 |
|
30691 |
|
30692 |
|
30693 |
|
30694 |
|
30695 |
|
30696 |
|
30697 |
|
30698 | function baseSlice(array, start, end) {
|
30699 | var index = -1,
|
30700 | length = array.length;
|
30701 |
|
30702 | if (start < 0) {
|
30703 | start = -start > length ? 0 : length + start;
|
30704 | }
|
30705 | end = end > length ? length : end;
|
30706 | if (end < 0) {
|
30707 | end += length;
|
30708 | }
|
30709 | length = start > end ? 0 : end - start >>> 0;
|
30710 | start >>>= 0;
|
30711 |
|
30712 | var result = Array(length);
|
30713 | while (++index < length) {
|
30714 | result[index] = array[index + start];
|
30715 | }
|
30716 | return result;
|
30717 | }
|
30718 |
|
30719 | module.exports = baseSlice;
|
30720 |
|
30721 | }),
|
30722 |
|
30723 | (function(module, exports) {
|
30724 |
|
30725 |
|
30726 |
|
30727 |
|
30728 |
|
30729 |
|
30730 |
|
30731 |
|
30732 | function asciiToArray(string) {
|
30733 | return string.split('');
|
30734 | }
|
30735 |
|
30736 | module.exports = asciiToArray;
|
30737 |
|
30738 | }),
|
30739 |
|
30740 | (function(module, exports) {
|
30741 |
|
30742 |
|
30743 | var rsAstralRange = '\\ud800-\\udfff',
|
30744 | rsComboMarksRange = '\\u0300-\\u036f',
|
30745 | reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
30746 | rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
30747 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
30748 | rsVarRange = '\\ufe0e\\ufe0f';
|
30749 |
|
30750 |
|
30751 | var rsAstral = '[' + rsAstralRange + ']',
|
30752 | rsCombo = '[' + rsComboRange + ']',
|
30753 | rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
30754 | rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
30755 | rsNonAstral = '[^' + rsAstralRange + ']',
|
30756 | rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
30757 | rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
30758 | rsZWJ = '\\u200d';
|
30759 |
|
30760 |
|
30761 | var reOptMod = rsModifier + '?',
|
30762 | rsOptVar = '[' + rsVarRange + ']?',
|
30763 | rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
30764 | rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
30765 | rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
30766 |
|
30767 |
|
30768 | var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
30769 |
|
30770 |
|
30771 |
|
30772 |
|
30773 |
|
30774 |
|
30775 |
|
30776 |
|
30777 | function unicodeToArray(string) {
|
30778 | return string.match(reUnicode) || [];
|
30779 | }
|
30780 |
|
30781 | module.exports = unicodeToArray;
|
30782 |
|
30783 | }),
|
30784 |
|
30785 | (function(module, exports, __webpack_require__) {
|
30786 |
|
30787 | var createCaseFirst = __webpack_require__(90);
|
30788 |
|
30789 |
|
30790 |
|
30791 |
|
30792 |
|
30793 |
|
30794 |
|
30795 |
|
30796 |
|
30797 |
|
30798 |
|
30799 |
|
30800 |
|
30801 |
|
30802 |
|
30803 |
|
30804 |
|
30805 |
|
30806 | var upperFirst = createCaseFirst('toUpperCase');
|
30807 |
|
30808 | module.exports = upperFirst;
|
30809 |
|
30810 | }),
|
30811 |
|
30812 | (function(module, exports, __webpack_require__) {
|
30813 |
|
30814 | var createCompounder = __webpack_require__(204);
|
30815 |
|
30816 |
|
30817 |
|
30818 |
|
30819 |
|
30820 |
|
30821 |
|
30822 |
|
30823 |
|
30824 |
|
30825 |
|
30826 |
|
30827 |
|
30828 |
|
30829 |
|
30830 |
|
30831 |
|
30832 |
|
30833 |
|
30834 |
|
30835 |
|
30836 | var upperCase = createCompounder(function (result, word, index) {
|
30837 | return result + (index ? ' ' : '') + word.toUpperCase();
|
30838 | });
|
30839 |
|
30840 | module.exports = upperCase;
|
30841 |
|
30842 | }),
|
30843 |
|
30844 | (function(module, exports, __webpack_require__) {
|
30845 |
|
30846 | var arrayReduce = __webpack_require__(58),
|
30847 | deburr = __webpack_require__(205),
|
30848 | words = __webpack_require__(208);
|
30849 |
|
30850 |
|
30851 | var rsApos = '[\'\u2019]';
|
30852 |
|
30853 |
|
30854 | var reApos = RegExp(rsApos, 'g');
|
30855 |
|
30856 |
|
30857 |
|
30858 |
|
30859 |
|
30860 |
|
30861 |
|
30862 |
|
30863 | function createCompounder(callback) {
|
30864 | return function (string) {
|
30865 | return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
30866 | };
|
30867 | }
|
30868 |
|
30869 | module.exports = createCompounder;
|
30870 |
|
30871 | }),
|
30872 |
|
30873 | (function(module, exports, __webpack_require__) {
|
30874 |
|
30875 | var deburrLetter = __webpack_require__(206),
|
30876 | toString = __webpack_require__(15);
|
30877 |
|
30878 |
|
30879 | var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
30880 |
|
30881 |
|
30882 | var rsComboMarksRange = '\\u0300-\\u036f',
|
30883 | reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
30884 | rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
30885 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
30886 |
|
30887 |
|
30888 | var rsCombo = '[' + rsComboRange + ']';
|
30889 |
|
30890 |
|
30891 |
|
30892 |
|
30893 |
|
30894 | var reComboMark = RegExp(rsCombo, 'g');
|
30895 |
|
30896 |
|
30897 |
|
30898 |
|
30899 |
|
30900 |
|
30901 |
|
30902 |
|
30903 |
|
30904 |
|
30905 |
|
30906 |
|
30907 |
|
30908 |
|
30909 |
|
30910 |
|
30911 |
|
30912 |
|
30913 |
|
30914 | function deburr(string) {
|
30915 | string = toString(string);
|
30916 | return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
30917 | }
|
30918 |
|
30919 | module.exports = deburr;
|
30920 |
|
30921 | }),
|
30922 |
|
30923 | (function(module, exports, __webpack_require__) {
|
30924 |
|
30925 | var basePropertyOf = __webpack_require__(207);
|
30926 |
|
30927 |
|
30928 | var deburredLetters = {
|
30929 |
|
30930 | '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
30931 | '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
30932 | '\xc7': 'C', '\xe7': 'c',
|
30933 | '\xd0': 'D', '\xf0': 'd',
|
30934 | '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
|
30935 | '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
|
30936 | '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
|
30937 | '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
|
30938 | '\xd1': 'N', '\xf1': 'n',
|
30939 | '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
|
30940 | '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
|
30941 | '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
|
30942 | '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
|
30943 | '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
30944 | '\xc6': 'Ae', '\xe6': 'ae',
|
30945 | '\xde': 'Th', '\xfe': 'th',
|
30946 | '\xdf': 'ss',
|
30947 |
|
30948 | '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
|
30949 | '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
|
30950 | '\u0106': 'C', '\u0108': 'C', '\u010A': 'C', '\u010C': 'C',
|
30951 | '\u0107': 'c', '\u0109': 'c', '\u010B': 'c', '\u010D': 'c',
|
30952 | '\u010E': 'D', '\u0110': 'D', '\u010F': 'd', '\u0111': 'd',
|
30953 | '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011A': 'E',
|
30954 | '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011B': 'e',
|
30955 | '\u011C': 'G', '\u011E': 'G', '\u0120': 'G', '\u0122': 'G',
|
30956 | '\u011D': 'g', '\u011F': 'g', '\u0121': 'g', '\u0123': 'g',
|
30957 | '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
|
30958 | '\u0128': 'I', '\u012A': 'I', '\u012C': 'I', '\u012E': 'I', '\u0130': 'I',
|
30959 | '\u0129': 'i', '\u012B': 'i', '\u012D': 'i', '\u012F': 'i', '\u0131': 'i',
|
30960 | '\u0134': 'J', '\u0135': 'j',
|
30961 | '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
|
30962 | '\u0139': 'L', '\u013B': 'L', '\u013D': 'L', '\u013F': 'L', '\u0141': 'L',
|
30963 | '\u013A': 'l', '\u013C': 'l', '\u013E': 'l', '\u0140': 'l', '\u0142': 'l',
|
30964 | '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014A': 'N',
|
30965 | '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014B': 'n',
|
30966 | '\u014C': 'O', '\u014E': 'O', '\u0150': 'O',
|
30967 | '\u014D': 'o', '\u014F': 'o', '\u0151': 'o',
|
30968 | '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
|
30969 | '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
|
30970 | '\u015A': 'S', '\u015C': 'S', '\u015E': 'S', '\u0160': 'S',
|
30971 | '\u015B': 's', '\u015D': 's', '\u015F': 's', '\u0161': 's',
|
30972 | '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
|
30973 | '\u0163': 't', '\u0165': 't', '\u0167': 't',
|
30974 | '\u0168': 'U', '\u016A': 'U', '\u016C': 'U', '\u016E': 'U', '\u0170': 'U', '\u0172': 'U',
|
30975 | '\u0169': 'u', '\u016B': 'u', '\u016D': 'u', '\u016F': 'u', '\u0171': 'u', '\u0173': 'u',
|
30976 | '\u0174': 'W', '\u0175': 'w',
|
30977 | '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
|
30978 | '\u0179': 'Z', '\u017B': 'Z', '\u017D': 'Z',
|
30979 | '\u017A': 'z', '\u017C': 'z', '\u017E': 'z',
|
30980 | '\u0132': 'IJ', '\u0133': 'ij',
|
30981 | '\u0152': 'Oe', '\u0153': 'oe',
|
30982 | '\u0149': "'n", '\u017F': 's'
|
30983 | };
|
30984 |
|
30985 |
|
30986 |
|
30987 |
|
30988 |
|
30989 |
|
30990 |
|
30991 |
|
30992 |
|
30993 | var deburrLetter = basePropertyOf(deburredLetters);
|
30994 |
|
30995 | module.exports = deburrLetter;
|
30996 |
|
30997 | }),
|
30998 |
|
30999 | (function(module, exports) {
|
31000 |
|
31001 |
|
31002 |
|
31003 |
|
31004 |
|
31005 |
|
31006 |
|
31007 |
|
31008 | function basePropertyOf(object) {
|
31009 | return function (key) {
|
31010 | return object == null ? undefined : object[key];
|
31011 | };
|
31012 | }
|
31013 |
|
31014 | module.exports = basePropertyOf;
|
31015 |
|
31016 | }),
|
31017 |
|
31018 | (function(module, exports, __webpack_require__) {
|
31019 |
|
31020 | var asciiWords = __webpack_require__(209),
|
31021 | hasUnicodeWord = __webpack_require__(210),
|
31022 | toString = __webpack_require__(15),
|
31023 | unicodeWords = __webpack_require__(211);
|
31024 |
|
31025 |
|
31026 |
|
31027 |
|
31028 |
|
31029 |
|
31030 |
|
31031 |
|
31032 |
|
31033 |
|
31034 |
|
31035 |
|
31036 |
|
31037 |
|
31038 |
|
31039 |
|
31040 |
|
31041 |
|
31042 |
|
31043 |
|
31044 | function words(string, pattern, guard) {
|
31045 | string = toString(string);
|
31046 | pattern = guard ? undefined : pattern;
|
31047 |
|
31048 | if (pattern === undefined) {
|
31049 | return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
31050 | }
|
31051 | return string.match(pattern) || [];
|
31052 | }
|
31053 |
|
31054 | module.exports = words;
|
31055 |
|
31056 | }),
|
31057 |
|
31058 | (function(module, exports) {
|
31059 |
|
31060 |
|
31061 | var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
31062 |
|
31063 |
|
31064 |
|
31065 |
|
31066 |
|
31067 |
|
31068 |
|
31069 |
|
31070 | function asciiWords(string) {
|
31071 | return string.match(reAsciiWord) || [];
|
31072 | }
|
31073 |
|
31074 | module.exports = asciiWords;
|
31075 |
|
31076 | }),
|
31077 |
|
31078 | (function(module, exports) {
|
31079 |
|
31080 |
|
31081 | var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
31082 |
|
31083 |
|
31084 |
|
31085 |
|
31086 |
|
31087 |
|
31088 |
|
31089 |
|
31090 | function hasUnicodeWord(string) {
|
31091 | return reHasUnicodeWord.test(string);
|
31092 | }
|
31093 |
|
31094 | module.exports = hasUnicodeWord;
|
31095 |
|
31096 | }),
|
31097 |
|
31098 | (function(module, exports) {
|
31099 |
|
31100 |
|
31101 | var rsAstralRange = '\\ud800-\\udfff',
|
31102 | rsComboMarksRange = '\\u0300-\\u036f',
|
31103 | reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
31104 | rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
31105 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
31106 | rsDingbatRange = '\\u2700-\\u27bf',
|
31107 | rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
31108 | rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
31109 | rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
31110 | rsPunctuationRange = '\\u2000-\\u206f',
|
31111 | rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
|
31112 | rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
31113 | rsVarRange = '\\ufe0e\\ufe0f',
|
31114 | rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
31115 |
|
31116 |
|
31117 | var rsApos = '[\'\u2019]',
|
31118 | rsBreak = '[' + rsBreakRange + ']',
|
31119 | rsCombo = '[' + rsComboRange + ']',
|
31120 | rsDigits = '\\d+',
|
31121 | rsDingbat = '[' + rsDingbatRange + ']',
|
31122 | rsLower = '[' + rsLowerRange + ']',
|
31123 | rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
31124 | rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
31125 | rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
31126 | rsNonAstral = '[^' + rsAstralRange + ']',
|
31127 | rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
31128 | rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
31129 | rsUpper = '[' + rsUpperRange + ']',
|
31130 | rsZWJ = '\\u200d';
|
31131 |
|
31132 |
|
31133 | var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
|
31134 | rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
|
31135 | rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
31136 | rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
31137 | reOptMod = rsModifier + '?',
|
31138 | rsOptVar = '[' + rsVarRange + ']?',
|
31139 | rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
31140 | rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
|
31141 | rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
|
31142 | rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
31143 | rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
|
31144 |
|
31145 |
|
31146 | var reUnicodeWord = RegExp([rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, rsUpper + '+' + rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji].join('|'), 'g');
|
31147 |
|
31148 |
|
31149 |
|
31150 |
|
31151 |
|
31152 |
|
31153 |
|
31154 |
|
31155 | function unicodeWords(string) {
|
31156 | return string.match(reUnicodeWord) || [];
|
31157 | }
|
31158 |
|
31159 | module.exports = unicodeWords;
|
31160 |
|
31161 | }),
|
31162 |
|
31163 | (function(module, exports) {
|
31164 |
|
31165 |
|
31166 |
|
31167 |
|
31168 |
|
31169 |
|
31170 |
|
31171 |
|
31172 |
|
31173 |
|
31174 |
|
31175 |
|
31176 |
|
31177 |
|
31178 |
|
31179 |
|
31180 |
|
31181 |
|
31182 | function isNull(value) {
|
31183 | return value === null;
|
31184 | }
|
31185 |
|
31186 | module.exports = isNull;
|
31187 |
|
31188 | }),
|
31189 |
|
31190 | (function(module, exports, __webpack_require__) {
|
31191 |
|
31192 | var baseIsDate = __webpack_require__(214),
|
31193 | baseUnary = __webpack_require__(72),
|
31194 | nodeUtil = __webpack_require__(73);
|
31195 |
|
31196 |
|
31197 | var nodeIsDate = nodeUtil && nodeUtil.isDate;
|
31198 |
|
31199 |
|
31200 |
|
31201 |
|
31202 |
|
31203 |
|
31204 |
|
31205 |
|
31206 |
|
31207 |
|
31208 |
|
31209 |
|
31210 |
|
31211 |
|
31212 |
|
31213 |
|
31214 |
|
31215 |
|
31216 | var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
|
31217 |
|
31218 | module.exports = isDate;
|
31219 |
|
31220 | }),
|
31221 |
|
31222 | (function(module, exports, __webpack_require__) {
|
31223 |
|
31224 | var baseGetTag = __webpack_require__(6),
|
31225 | isObjectLike = __webpack_require__(5);
|
31226 |
|
31227 |
|
31228 | var dateTag = '[object Date]';
|
31229 |
|
31230 |
|
31231 |
|
31232 |
|
31233 |
|
31234 |
|
31235 |
|
31236 |
|
31237 | function baseIsDate(value) {
|
31238 | return isObjectLike(value) && baseGetTag(value) == dateTag;
|
31239 | }
|
31240 |
|
31241 | module.exports = baseIsDate;
|
31242 |
|
31243 | }),
|
31244 |
|
31245 | (function(module, exports, __webpack_require__) {
|
31246 |
|
31247 | var baseGetTag = __webpack_require__(6),
|
31248 | getPrototype = __webpack_require__(59),
|
31249 | isObjectLike = __webpack_require__(5);
|
31250 |
|
31251 |
|
31252 | var objectTag = '[object Object]';
|
31253 |
|
31254 |
|
31255 | var funcProto = Function.prototype,
|
31256 | objectProto = Object.prototype;
|
31257 |
|
31258 |
|
31259 | var funcToString = funcProto.toString;
|
31260 |
|
31261 |
|
31262 | var hasOwnProperty = objectProto.hasOwnProperty;
|
31263 |
|
31264 |
|
31265 | var objectCtorString = funcToString.call(Object);
|
31266 |
|
31267 |
|
31268 |
|
31269 |
|
31270 |
|
31271 |
|
31272 |
|
31273 |
|
31274 |
|
31275 |
|
31276 |
|
31277 |
|
31278 |
|
31279 |
|
31280 |
|
31281 |
|
31282 |
|
31283 |
|
31284 |
|
31285 |
|
31286 |
|
31287 |
|
31288 |
|
31289 |
|
31290 |
|
31291 |
|
31292 |
|
31293 |
|
31294 |
|
31295 | function isPlainObject(value) {
|
31296 | if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
31297 | return false;
|
31298 | }
|
31299 | var proto = getPrototype(value);
|
31300 | if (proto === null) {
|
31301 | return true;
|
31302 | }
|
31303 | var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
31304 | return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
31305 | }
|
31306 |
|
31307 | module.exports = isPlainObject;
|
31308 |
|
31309 | }),
|
31310 |
|
31311 | (function(module, exports, __webpack_require__) {
|
31312 |
|
31313 | var _Symbol = __webpack_require__(12),
|
31314 | copyArray = __webpack_require__(94),
|
31315 | getTag = __webpack_require__(38),
|
31316 | isArrayLike = __webpack_require__(8),
|
31317 | isString = __webpack_require__(89),
|
31318 | iteratorToArray = __webpack_require__(217),
|
31319 | mapToArray = __webpack_require__(53),
|
31320 | setToArray = __webpack_require__(20),
|
31321 | stringToArray = __webpack_require__(92),
|
31322 | values = __webpack_require__(218);
|
31323 |
|
31324 |
|
31325 | var mapTag = '[object Map]',
|
31326 | setTag = '[object Set]';
|
31327 |
|
31328 |
|
31329 | var symIterator = _Symbol ? _Symbol.iterator : undefined;
|
31330 |
|
31331 |
|
31332 |
|
31333 |
|
31334 |
|
31335 |
|
31336 |
|
31337 |
|
31338 |
|
31339 |
|
31340 |
|
31341 |
|
31342 |
|
31343 |
|
31344 |
|
31345 |
|
31346 |
|
31347 |
|
31348 |
|
31349 |
|
31350 |
|
31351 |
|
31352 |
|
31353 |
|
31354 | function toArray(value) {
|
31355 | if (!value) {
|
31356 | return [];
|
31357 | }
|
31358 | if (isArrayLike(value)) {
|
31359 | return isString(value) ? stringToArray(value) : copyArray(value);
|
31360 | }
|
31361 | if (symIterator && value[symIterator]) {
|
31362 | return iteratorToArray(value[symIterator]());
|
31363 | }
|
31364 | var tag = getTag(value),
|
31365 | func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
|
31366 |
|
31367 | return func(value);
|
31368 | }
|
31369 |
|
31370 | module.exports = toArray;
|
31371 |
|
31372 | }),
|
31373 |
|
31374 | (function(module, exports) {
|
31375 |
|
31376 |
|
31377 |
|
31378 |
|
31379 |
|
31380 |
|
31381 |
|
31382 |
|
31383 | function iteratorToArray(iterator) {
|
31384 | var data,
|
31385 | result = [];
|
31386 |
|
31387 | while (!(data = iterator.next()).done) {
|
31388 | result.push(data.value);
|
31389 | }
|
31390 | return result;
|
31391 | }
|
31392 |
|
31393 | module.exports = iteratorToArray;
|
31394 |
|
31395 | }),
|
31396 |
|
31397 | (function(module, exports, __webpack_require__) {
|
31398 |
|
31399 | var baseValues = __webpack_require__(219),
|
31400 | keys = __webpack_require__(11);
|
31401 |
|
31402 |
|
31403 |
|
31404 |
|
31405 |
|
31406 |
|
31407 |
|
31408 |
|
31409 |
|
31410 |
|
31411 |
|
31412 |
|
31413 |
|
31414 |
|
31415 |
|
31416 |
|
31417 |
|
31418 |
|
31419 |
|
31420 |
|
31421 |
|
31422 |
|
31423 |
|
31424 |
|
31425 |
|
31426 |
|
31427 |
|
31428 | function values(object) {
|
31429 | return object == null ? [] : baseValues(object, keys(object));
|
31430 | }
|
31431 |
|
31432 | module.exports = values;
|
31433 |
|
31434 | }),
|
31435 |
|
31436 | (function(module, exports, __webpack_require__) {
|
31437 |
|
31438 | var arrayMap = __webpack_require__(49);
|
31439 |
|
31440 |
|
31441 |
|
31442 |
|
31443 |
|
31444 |
|
31445 |
|
31446 |
|
31447 |
|
31448 |
|
31449 |
|
31450 | function baseValues(object, props) {
|
31451 | return arrayMap(props, function (key) {
|
31452 | return object[key];
|
31453 | });
|
31454 | }
|
31455 |
|
31456 | module.exports = baseValues;
|
31457 |
|
31458 | }),
|
31459 |
|
31460 | (function(module, exports, __webpack_require__) {
|
31461 |
|
31462 | var baseIndexOf = __webpack_require__(95),
|
31463 | toInteger = __webpack_require__(96);
|
31464 |
|
31465 |
|
31466 | var nativeMax = Math.max;
|
31467 |
|
31468 |
|
31469 |
|
31470 |
|
31471 |
|
31472 |
|
31473 |
|
31474 |
|
31475 |
|
31476 |
|
31477 |
|
31478 |
|
31479 |
|
31480 |
|
31481 |
|
31482 |
|
31483 |
|
31484 |
|
31485 |
|
31486 |
|
31487 |
|
31488 |
|
31489 |
|
31490 |
|
31491 | function indexOf(array, value, fromIndex) {
|
31492 | var length = array == null ? 0 : array.length;
|
31493 | if (!length) {
|
31494 | return -1;
|
31495 | }
|
31496 | var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
31497 | if (index < 0) {
|
31498 | index = nativeMax(length + index, 0);
|
31499 | }
|
31500 | return baseIndexOf(array, value, index);
|
31501 | }
|
31502 |
|
31503 | module.exports = indexOf;
|
31504 |
|
31505 | }),
|
31506 |
|
31507 | (function(module, exports) {
|
31508 |
|
31509 |
|
31510 |
|
31511 |
|
31512 |
|
31513 |
|
31514 |
|
31515 |
|
31516 |
|
31517 |
|
31518 |
|
31519 |
|
31520 | function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
31521 | var length = array.length,
|
31522 | index = fromIndex + (fromRight ? 1 : -1);
|
31523 |
|
31524 | while (fromRight ? index-- : ++index < length) {
|
31525 | if (predicate(array[index], index, array)) {
|
31526 | return index;
|
31527 | }
|
31528 | }
|
31529 | return -1;
|
31530 | }
|
31531 |
|
31532 | module.exports = baseFindIndex;
|
31533 |
|
31534 | }),
|
31535 |
|
31536 | (function(module, exports) {
|
31537 |
|
31538 |
|
31539 |
|
31540 |
|
31541 |
|
31542 |
|
31543 |
|
31544 |
|
31545 | function baseIsNaN(value) {
|
31546 | return value !== value;
|
31547 | }
|
31548 |
|
31549 | module.exports = baseIsNaN;
|
31550 |
|
31551 | }),
|
31552 |
|
31553 | (function(module, exports) {
|
31554 |
|
31555 |
|
31556 |
|
31557 |
|
31558 |
|
31559 |
|
31560 |
|
31561 |
|
31562 |
|
31563 |
|
31564 |
|
31565 | function strictIndexOf(array, value, fromIndex) {
|
31566 | var index = fromIndex - 1,
|
31567 | length = array.length;
|
31568 |
|
31569 | while (++index < length) {
|
31570 | if (array[index] === value) {
|
31571 | return index;
|
31572 | }
|
31573 | }
|
31574 | return -1;
|
31575 | }
|
31576 |
|
31577 | module.exports = strictIndexOf;
|
31578 |
|
31579 | }),
|
31580 |
|
31581 | (function(module, exports, __webpack_require__) {
|
31582 |
|
31583 | var toNumber = __webpack_require__(97);
|
31584 |
|
31585 |
|
31586 | var INFINITY = 1 / 0,
|
31587 | MAX_INTEGER = 1.7976931348623157e+308;
|
31588 |
|
31589 |
|
31590 |
|
31591 |
|
31592 |
|
31593 |
|
31594 |
|
31595 |
|
31596 |
|
31597 |
|
31598 |
|
31599 |
|
31600 |
|
31601 |
|
31602 |
|
31603 |
|
31604 |
|
31605 |
|
31606 |
|
31607 |
|
31608 |
|
31609 |
|
31610 |
|
31611 |
|
31612 | function toFinite(value) {
|
31613 | if (!value) {
|
31614 | return value === 0 ? value : 0;
|
31615 | }
|
31616 | value = toNumber(value);
|
31617 | if (value === INFINITY || value === -INFINITY) {
|
31618 | var sign = value < 0 ? -1 : 1;
|
31619 | return sign * MAX_INTEGER;
|
31620 | }
|
31621 | return value === value ? value : 0;
|
31622 | }
|
31623 |
|
31624 | module.exports = toFinite;
|
31625 |
|
31626 | }),
|
31627 |
|
31628 | (function(module, exports, __webpack_require__) {
|
31629 |
|
31630 | var baseRest = __webpack_require__(99),
|
31631 | isIterateeCall = __webpack_require__(230);
|
31632 |
|
31633 |
|
31634 |
|
31635 |
|
31636 |
|
31637 |
|
31638 |
|
31639 |
|
31640 | function createAssigner(assigner) {
|
31641 | return baseRest(function (object, sources) {
|
31642 | var index = -1,
|
31643 | length = sources.length,
|
31644 | customizer = length > 1 ? sources[length - 1] : undefined,
|
31645 | guard = length > 2 ? sources[2] : undefined;
|
31646 |
|
31647 | customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined;
|
31648 |
|
31649 | if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
31650 | customizer = length < 3 ? undefined : customizer;
|
31651 | length = 1;
|
31652 | }
|
31653 | object = Object(object);
|
31654 | while (++index < length) {
|
31655 | var source = sources[index];
|
31656 | if (source) {
|
31657 | assigner(object, source, index, customizer);
|
31658 | }
|
31659 | }
|
31660 | return object;
|
31661 | });
|
31662 | }
|
31663 |
|
31664 | module.exports = createAssigner;
|
31665 |
|
31666 | }),
|
31667 |
|
31668 | (function(module, exports) {
|
31669 |
|
31670 |
|
31671 |
|
31672 |
|
31673 |
|
31674 |
|
31675 |
|
31676 |
|
31677 |
|
31678 |
|
31679 |
|
31680 | function apply(func, thisArg, args) {
|
31681 | switch (args.length) {
|
31682 | case 0:
|
31683 | return func.call(thisArg);
|
31684 | case 1:
|
31685 | return func.call(thisArg, args[0]);
|
31686 | case 2:
|
31687 | return func.call(thisArg, args[0], args[1]);
|
31688 | case 3:
|
31689 | return func.call(thisArg, args[0], args[1], args[2]);
|
31690 | }
|
31691 | return func.apply(thisArg, args);
|
31692 | }
|
31693 |
|
31694 | module.exports = apply;
|
31695 |
|
31696 | }),
|
31697 |
|
31698 | (function(module, exports, __webpack_require__) {
|
31699 |
|
31700 | var constant = __webpack_require__(228),
|
31701 | defineProperty = __webpack_require__(98),
|
31702 | identity = __webpack_require__(31);
|
31703 |
|
31704 |
|
31705 |
|
31706 |
|
31707 |
|
31708 |
|
31709 |
|
31710 |
|
31711 |
|
31712 | var baseSetToString = !defineProperty ? identity : function (func, string) {
|
31713 | return defineProperty(func, 'toString', {
|
31714 | 'configurable': true,
|
31715 | 'enumerable': false,
|
31716 | 'value': constant(string),
|
31717 | 'writable': true
|
31718 | });
|
31719 | };
|
31720 |
|
31721 | module.exports = baseSetToString;
|
31722 |
|
31723 | }),
|
31724 |
|
31725 | (function(module, exports) {
|
31726 |
|
31727 |
|
31728 |
|
31729 |
|
31730 |
|
31731 |
|
31732 |
|
31733 |
|
31734 |
|
31735 |
|
31736 |
|
31737 |
|
31738 |
|
31739 |
|
31740 |
|
31741 |
|
31742 |
|
31743 |
|
31744 |
|
31745 |
|
31746 | function constant(value) {
|
31747 | return function () {
|
31748 | return value;
|
31749 | };
|
31750 | }
|
31751 |
|
31752 | module.exports = constant;
|
31753 |
|
31754 | }),
|
31755 |
|
31756 | (function(module, exports) {
|
31757 |
|
31758 |
|
31759 | var HOT_COUNT = 800,
|
31760 | HOT_SPAN = 16;
|
31761 |
|
31762 |
|
31763 | var nativeNow = Date.now;
|
31764 |
|
31765 |
|
31766 |
|
31767 |
|
31768 |
|
31769 |
|
31770 |
|
31771 |
|
31772 |
|
31773 |
|
31774 | function shortOut(func) {
|
31775 | var count = 0,
|
31776 | lastCalled = 0;
|
31777 |
|
31778 | return function () {
|
31779 | var stamp = nativeNow(),
|
31780 | remaining = HOT_SPAN - (stamp - lastCalled);
|
31781 |
|
31782 | lastCalled = stamp;
|
31783 | if (remaining > 0) {
|
31784 | if (++count >= HOT_COUNT) {
|
31785 | return arguments[0];
|
31786 | }
|
31787 | } else {
|
31788 | count = 0;
|
31789 | }
|
31790 | return func.apply(undefined, arguments);
|
31791 | };
|
31792 | }
|
31793 |
|
31794 | module.exports = shortOut;
|
31795 |
|
31796 | }),
|
31797 |
|
31798 | (function(module, exports, __webpack_require__) {
|
31799 |
|
31800 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
31801 |
|
31802 | var eq = __webpack_require__(34),
|
31803 | isArrayLike = __webpack_require__(8),
|
31804 | isIndex = __webpack_require__(30),
|
31805 | isObject = __webpack_require__(7);
|
31806 |
|
31807 |
|
31808 |
|
31809 |
|
31810 |
|
31811 |
|
31812 |
|
31813 |
|
31814 |
|
31815 |
|
31816 |
|
31817 | function isIterateeCall(value, index, object) {
|
31818 | if (!isObject(object)) {
|
31819 | return false;
|
31820 | }
|
31821 | var type = typeof index === 'undefined' ? 'undefined' : _typeof(index);
|
31822 | if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) {
|
31823 | return eq(object[index], value);
|
31824 | }
|
31825 | return false;
|
31826 | }
|
31827 |
|
31828 | module.exports = isIterateeCall;
|
31829 |
|
31830 | }),
|
31831 |
|
31832 | (function(module, exports, __webpack_require__) {
|
31833 |
|
31834 | var baseAssignValue = __webpack_require__(61),
|
31835 | createAggregator = __webpack_require__(232);
|
31836 |
|
31837 |
|
31838 | var objectProto = Object.prototype;
|
31839 |
|
31840 |
|
31841 | var hasOwnProperty = objectProto.hasOwnProperty;
|
31842 |
|
31843 |
|
31844 |
|
31845 |
|
31846 |
|
31847 |
|
31848 |
|
31849 |
|
31850 |
|
31851 |
|
31852 |
|
31853 |
|
31854 |
|
31855 |
|
31856 |
|
31857 |
|
31858 |
|
31859 |
|
31860 |
|
31861 |
|
31862 |
|
31863 |
|
31864 |
|
31865 |
|
31866 | var groupBy = createAggregator(function (result, value, key) {
|
31867 | if (hasOwnProperty.call(result, key)) {
|
31868 | result[key].push(value);
|
31869 | } else {
|
31870 | baseAssignValue(result, key, [value]);
|
31871 | }
|
31872 | });
|
31873 |
|
31874 | module.exports = groupBy;
|
31875 |
|
31876 | }),
|
31877 |
|
31878 | (function(module, exports, __webpack_require__) {
|
31879 |
|
31880 | var arrayAggregator = __webpack_require__(233),
|
31881 | baseAggregator = __webpack_require__(234),
|
31882 | baseIteratee = __webpack_require__(19),
|
31883 | isArray = __webpack_require__(3);
|
31884 |
|
31885 |
|
31886 |
|
31887 |
|
31888 |
|
31889 |
|
31890 |
|
31891 |
|
31892 |
|
31893 | function createAggregator(setter, initializer) {
|
31894 | return function (collection, iteratee) {
|
31895 | var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
31896 | accumulator = initializer ? initializer() : {};
|
31897 |
|
31898 | return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
|
31899 | };
|
31900 | }
|
31901 |
|
31902 | module.exports = createAggregator;
|
31903 |
|
31904 | }),
|
31905 |
|
31906 | (function(module, exports) {
|
31907 |
|
31908 |
|
31909 |
|
31910 |
|
31911 |
|
31912 |
|
31913 |
|
31914 |
|
31915 |
|
31916 |
|
31917 |
|
31918 | function arrayAggregator(array, setter, iteratee, accumulator) {
|
31919 | var index = -1,
|
31920 | length = array == null ? 0 : array.length;
|
31921 |
|
31922 | while (++index < length) {
|
31923 | var value = array[index];
|
31924 | setter(accumulator, value, iteratee(value), array);
|
31925 | }
|
31926 | return accumulator;
|
31927 | }
|
31928 |
|
31929 | module.exports = arrayAggregator;
|
31930 |
|
31931 | }),
|
31932 |
|
31933 | (function(module, exports, __webpack_require__) {
|
31934 |
|
31935 | var baseEach = __webpack_require__(27);
|
31936 |
|
31937 |
|
31938 |
|
31939 |
|
31940 |
|
31941 |
|
31942 |
|
31943 |
|
31944 |
|
31945 |
|
31946 |
|
31947 |
|
31948 | function baseAggregator(collection, setter, iteratee, accumulator) {
|
31949 | baseEach(collection, function (value, key, collection) {
|
31950 | setter(accumulator, value, iteratee(value), collection);
|
31951 | });
|
31952 | return accumulator;
|
31953 | }
|
31954 |
|
31955 | module.exports = baseAggregator;
|
31956 |
|
31957 | }),
|
31958 |
|
31959 | (function(module, exports, __webpack_require__) {
|
31960 |
|
31961 | var Stack = __webpack_require__(50),
|
31962 | arrayEach = __webpack_require__(69),
|
31963 | assignValue = __webpack_require__(40),
|
31964 | baseAssign = __webpack_require__(236),
|
31965 | baseAssignIn = __webpack_require__(237),
|
31966 | cloneBuffer = __webpack_require__(240),
|
31967 | copyArray = __webpack_require__(94),
|
31968 | copySymbols = __webpack_require__(241),
|
31969 | copySymbolsIn = __webpack_require__(242),
|
31970 | getAllKeys = __webpack_require__(81),
|
31971 | getAllKeysIn = __webpack_require__(243),
|
31972 | getTag = __webpack_require__(38),
|
31973 | initCloneArray = __webpack_require__(244),
|
31974 | initCloneByTag = __webpack_require__(245),
|
31975 | initCloneObject = __webpack_require__(254),
|
31976 | isArray = __webpack_require__(3),
|
31977 | isBuffer = __webpack_require__(29),
|
31978 | isObject = __webpack_require__(7),
|
31979 | keys = __webpack_require__(11);
|
31980 |
|
31981 |
|
31982 | var CLONE_DEEP_FLAG = 1,
|
31983 | CLONE_FLAT_FLAG = 2,
|
31984 | CLONE_SYMBOLS_FLAG = 4;
|
31985 |
|
31986 |
|
31987 | var argsTag = '[object Arguments]',
|
31988 | arrayTag = '[object Array]',
|
31989 | boolTag = '[object Boolean]',
|
31990 | dateTag = '[object Date]',
|
31991 | errorTag = '[object Error]',
|
31992 | funcTag = '[object Function]',
|
31993 | genTag = '[object GeneratorFunction]',
|
31994 | mapTag = '[object Map]',
|
31995 | numberTag = '[object Number]',
|
31996 | objectTag = '[object Object]',
|
31997 | regexpTag = '[object RegExp]',
|
31998 | setTag = '[object Set]',
|
31999 | stringTag = '[object String]',
|
32000 | symbolTag = '[object Symbol]',
|
32001 | weakMapTag = '[object WeakMap]';
|
32002 |
|
32003 | var arrayBufferTag = '[object ArrayBuffer]',
|
32004 | dataViewTag = '[object DataView]',
|
32005 | float32Tag = '[object Float32Array]',
|
32006 | float64Tag = '[object Float64Array]',
|
32007 | int8Tag = '[object Int8Array]',
|
32008 | int16Tag = '[object Int16Array]',
|
32009 | int32Tag = '[object Int32Array]',
|
32010 | uint8Tag = '[object Uint8Array]',
|
32011 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
32012 | uint16Tag = '[object Uint16Array]',
|
32013 | uint32Tag = '[object Uint32Array]';
|
32014 |
|
32015 |
|
32016 | var cloneableTags = {};
|
32017 | cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
32018 | cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
|
32019 |
|
32020 |
|
32021 |
|
32022 |
|
32023 |
|
32024 |
|
32025 |
|
32026 |
|
32027 |
|
32028 |
|
32029 |
|
32030 |
|
32031 |
|
32032 |
|
32033 |
|
32034 |
|
32035 |
|
32036 | function baseClone(value, bitmask, customizer, key, object, stack) {
|
32037 | var result,
|
32038 | isDeep = bitmask & CLONE_DEEP_FLAG,
|
32039 | isFlat = bitmask & CLONE_FLAT_FLAG,
|
32040 | isFull = bitmask & CLONE_SYMBOLS_FLAG;
|
32041 |
|
32042 | if (customizer) {
|
32043 | result = object ? customizer(value, key, object, stack) : customizer(value);
|
32044 | }
|
32045 | if (result !== undefined) {
|
32046 | return result;
|
32047 | }
|
32048 | if (!isObject(value)) {
|
32049 | return value;
|
32050 | }
|
32051 | var isArr = isArray(value);
|
32052 | if (isArr) {
|
32053 | result = initCloneArray(value);
|
32054 | if (!isDeep) {
|
32055 | return copyArray(value, result);
|
32056 | }
|
32057 | } else {
|
32058 | var tag = getTag(value),
|
32059 | isFunc = tag == funcTag || tag == genTag;
|
32060 |
|
32061 | if (isBuffer(value)) {
|
32062 | return cloneBuffer(value, isDeep);
|
32063 | }
|
32064 | if (tag == objectTag || tag == argsTag || isFunc && !object) {
|
32065 | result = isFlat || isFunc ? {} : initCloneObject(value);
|
32066 | if (!isDeep) {
|
32067 | return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
|
32068 | }
|
32069 | } else {
|
32070 | if (!cloneableTags[tag]) {
|
32071 | return object ? value : {};
|
32072 | }
|
32073 | result = initCloneByTag(value, tag, baseClone, isDeep);
|
32074 | }
|
32075 | }
|
32076 |
|
32077 | stack || (stack = new Stack());
|
32078 | var stacked = stack.get(value);
|
32079 | if (stacked) {
|
32080 | return stacked;
|
32081 | }
|
32082 | stack.set(value, result);
|
32083 |
|
32084 | var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
|
32085 |
|
32086 | var props = isArr ? undefined : keysFunc(value);
|
32087 | arrayEach(props || value, function (subValue, key) {
|
32088 | if (props) {
|
32089 | key = subValue;
|
32090 | subValue = value[key];
|
32091 | }
|
32092 |
|
32093 | assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
32094 | });
|
32095 | return result;
|
32096 | }
|
32097 |
|
32098 | module.exports = baseClone;
|
32099 |
|
32100 | }),
|
32101 |
|
32102 | (function(module, exports, __webpack_require__) {
|
32103 |
|
32104 | var copyObject = __webpack_require__(23),
|
32105 | keys = __webpack_require__(11);
|
32106 |
|
32107 |
|
32108 |
|
32109 |
|
32110 |
|
32111 |
|
32112 |
|
32113 |
|
32114 |
|
32115 |
|
32116 | function baseAssign(object, source) {
|
32117 | return object && copyObject(source, keys(source), object);
|
32118 | }
|
32119 |
|
32120 | module.exports = baseAssign;
|
32121 |
|
32122 | }),
|
32123 |
|
32124 | (function(module, exports, __webpack_require__) {
|
32125 |
|
32126 | var copyObject = __webpack_require__(23),
|
32127 | keysIn = __webpack_require__(103);
|
32128 |
|
32129 |
|
32130 |
|
32131 |
|
32132 |
|
32133 |
|
32134 |
|
32135 |
|
32136 |
|
32137 |
|
32138 | function baseAssignIn(object, source) {
|
32139 | return object && copyObject(source, keysIn(source), object);
|
32140 | }
|
32141 |
|
32142 | module.exports = baseAssignIn;
|
32143 |
|
32144 | }),
|
32145 |
|
32146 | (function(module, exports, __webpack_require__) {
|
32147 |
|
32148 | var isObject = __webpack_require__(7),
|
32149 | isPrototype = __webpack_require__(18),
|
32150 | nativeKeysIn = __webpack_require__(239);
|
32151 |
|
32152 |
|
32153 | var objectProto = Object.prototype;
|
32154 |
|
32155 |
|
32156 | var hasOwnProperty = objectProto.hasOwnProperty;
|
32157 |
|
32158 |
|
32159 |
|
32160 |
|
32161 |
|
32162 |
|
32163 |
|
32164 |
|
32165 | function baseKeysIn(object) {
|
32166 | if (!isObject(object)) {
|
32167 | return nativeKeysIn(object);
|
32168 | }
|
32169 | var isProto = isPrototype(object),
|
32170 | result = [];
|
32171 |
|
32172 | for (var key in object) {
|
32173 | if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
32174 | result.push(key);
|
32175 | }
|
32176 | }
|
32177 | return result;
|
32178 | }
|
32179 |
|
32180 | module.exports = baseKeysIn;
|
32181 |
|
32182 | }),
|
32183 |
|
32184 | (function(module, exports) {
|
32185 |
|
32186 |
|
32187 |
|
32188 |
|
32189 |
|
32190 |
|
32191 |
|
32192 |
|
32193 |
|
32194 |
|
32195 | function nativeKeysIn(object) {
|
32196 | var result = [];
|
32197 | if (object != null) {
|
32198 | for (var key in Object(object)) {
|
32199 | result.push(key);
|
32200 | }
|
32201 | }
|
32202 | return result;
|
32203 | }
|
32204 |
|
32205 | module.exports = nativeKeysIn;
|
32206 |
|
32207 | }),
|
32208 |
|
32209 | (function(module, exports, __webpack_require__) {
|
32210 |
|
32211 | (function(module) {var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
32212 |
|
32213 | var root = __webpack_require__(4);
|
32214 |
|
32215 |
|
32216 | var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
|
32217 |
|
32218 |
|
32219 | var freeModule = freeExports && ( false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
|
32220 |
|
32221 |
|
32222 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
32223 |
|
32224 |
|
32225 | var Buffer = moduleExports ? root.Buffer : undefined,
|
32226 | allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
32227 |
|
32228 |
|
32229 |
|
32230 |
|
32231 |
|
32232 |
|
32233 |
|
32234 |
|
32235 |
|
32236 | function cloneBuffer(buffer, isDeep) {
|
32237 | if (isDeep) {
|
32238 | return buffer.slice();
|
32239 | }
|
32240 | var length = buffer.length,
|
32241 | result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
32242 |
|
32243 | buffer.copy(result);
|
32244 | return result;
|
32245 | }
|
32246 |
|
32247 | module.exports = cloneBuffer;
|
32248 | }.call(exports, __webpack_require__(26)(module)))
|
32249 |
|
32250 | }),
|
32251 |
|
32252 | (function(module, exports, __webpack_require__) {
|
32253 |
|
32254 | var copyObject = __webpack_require__(23),
|
32255 | getSymbols = __webpack_require__(55);
|
32256 |
|
32257 |
|
32258 |
|
32259 |
|
32260 |
|
32261 |
|
32262 |
|
32263 |
|
32264 |
|
32265 | function copySymbols(source, object) {
|
32266 | return copyObject(source, getSymbols(source), object);
|
32267 | }
|
32268 |
|
32269 | module.exports = copySymbols;
|
32270 |
|
32271 | }),
|
32272 |
|
32273 | (function(module, exports, __webpack_require__) {
|
32274 |
|
32275 | var copyObject = __webpack_require__(23),
|
32276 | getSymbolsIn = __webpack_require__(104);
|
32277 |
|
32278 |
|
32279 |
|
32280 |
|
32281 |
|
32282 |
|
32283 |
|
32284 |
|
32285 |
|
32286 | function copySymbolsIn(source, object) {
|
32287 | return copyObject(source, getSymbolsIn(source), object);
|
32288 | }
|
32289 |
|
32290 | module.exports = copySymbolsIn;
|
32291 |
|
32292 | }),
|
32293 |
|
32294 | (function(module, exports, __webpack_require__) {
|
32295 |
|
32296 | var baseGetAllKeys = __webpack_require__(82),
|
32297 | getSymbolsIn = __webpack_require__(104),
|
32298 | keysIn = __webpack_require__(103);
|
32299 |
|
32300 |
|
32301 |
|
32302 |
|
32303 |
|
32304 |
|
32305 |
|
32306 |
|
32307 |
|
32308 | function getAllKeysIn(object) {
|
32309 | return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
32310 | }
|
32311 |
|
32312 | module.exports = getAllKeysIn;
|
32313 |
|
32314 | }),
|
32315 |
|
32316 | (function(module, exports) {
|
32317 |
|
32318 |
|
32319 | var objectProto = Object.prototype;
|
32320 |
|
32321 |
|
32322 | var hasOwnProperty = objectProto.hasOwnProperty;
|
32323 |
|
32324 |
|
32325 |
|
32326 |
|
32327 |
|
32328 |
|
32329 |
|
32330 |
|
32331 | function initCloneArray(array) {
|
32332 | var length = array.length,
|
32333 | result = array.constructor(length);
|
32334 |
|
32335 |
|
32336 | if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
|
32337 | result.index = array.index;
|
32338 | result.input = array.input;
|
32339 | }
|
32340 | return result;
|
32341 | }
|
32342 |
|
32343 | module.exports = initCloneArray;
|
32344 |
|
32345 | }),
|
32346 |
|
32347 | (function(module, exports, __webpack_require__) {
|
32348 |
|
32349 | var cloneArrayBuffer = __webpack_require__(62),
|
32350 | cloneDataView = __webpack_require__(246),
|
32351 | cloneMap = __webpack_require__(247),
|
32352 | cloneRegExp = __webpack_require__(249),
|
32353 | cloneSet = __webpack_require__(250),
|
32354 | cloneSymbol = __webpack_require__(252),
|
32355 | cloneTypedArray = __webpack_require__(253);
|
32356 |
|
32357 |
|
32358 | var boolTag = '[object Boolean]',
|
32359 | dateTag = '[object Date]',
|
32360 | mapTag = '[object Map]',
|
32361 | numberTag = '[object Number]',
|
32362 | regexpTag = '[object RegExp]',
|
32363 | setTag = '[object Set]',
|
32364 | stringTag = '[object String]',
|
32365 | symbolTag = '[object Symbol]';
|
32366 |
|
32367 | var arrayBufferTag = '[object ArrayBuffer]',
|
32368 | dataViewTag = '[object DataView]',
|
32369 | float32Tag = '[object Float32Array]',
|
32370 | float64Tag = '[object Float64Array]',
|
32371 | int8Tag = '[object Int8Array]',
|
32372 | int16Tag = '[object Int16Array]',
|
32373 | int32Tag = '[object Int32Array]',
|
32374 | uint8Tag = '[object Uint8Array]',
|
32375 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
32376 | uint16Tag = '[object Uint16Array]',
|
32377 | uint32Tag = '[object Uint32Array]';
|
32378 |
|
32379 |
|
32380 |
|
32381 |
|
32382 |
|
32383 |
|
32384 |
|
32385 |
|
32386 |
|
32387 |
|
32388 |
|
32389 |
|
32390 |
|
32391 |
|
32392 | function initCloneByTag(object, tag, cloneFunc, isDeep) {
|
32393 | var Ctor = object.constructor;
|
32394 | switch (tag) {
|
32395 | case arrayBufferTag:
|
32396 | return cloneArrayBuffer(object);
|
32397 |
|
32398 | case boolTag:
|
32399 | case dateTag:
|
32400 | return new Ctor(+object);
|
32401 |
|
32402 | case dataViewTag:
|
32403 | return cloneDataView(object, isDeep);
|
32404 |
|
32405 | case float32Tag:case float64Tag:
|
32406 | case int8Tag:case int16Tag:case int32Tag:
|
32407 | case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:
|
32408 | return cloneTypedArray(object, isDeep);
|
32409 |
|
32410 | case mapTag:
|
32411 | return cloneMap(object, isDeep, cloneFunc);
|
32412 |
|
32413 | case numberTag:
|
32414 | case stringTag:
|
32415 | return new Ctor(object);
|
32416 |
|
32417 | case regexpTag:
|
32418 | return cloneRegExp(object);
|
32419 |
|
32420 | case setTag:
|
32421 | return cloneSet(object, isDeep, cloneFunc);
|
32422 |
|
32423 | case symbolTag:
|
32424 | return cloneSymbol(object);
|
32425 | }
|
32426 | }
|
32427 |
|
32428 | module.exports = initCloneByTag;
|
32429 |
|
32430 | }),
|
32431 |
|
32432 | (function(module, exports, __webpack_require__) {
|
32433 |
|
32434 | var cloneArrayBuffer = __webpack_require__(62);
|
32435 |
|
32436 |
|
32437 |
|
32438 |
|
32439 |
|
32440 |
|
32441 |
|
32442 |
|
32443 |
|
32444 | function cloneDataView(dataView, isDeep) {
|
32445 | var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
32446 | return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
32447 | }
|
32448 |
|
32449 | module.exports = cloneDataView;
|
32450 |
|
32451 | }),
|
32452 |
|
32453 | (function(module, exports, __webpack_require__) {
|
32454 |
|
32455 | var addMapEntry = __webpack_require__(248),
|
32456 | arrayReduce = __webpack_require__(58),
|
32457 | mapToArray = __webpack_require__(53);
|
32458 |
|
32459 |
|
32460 | var CLONE_DEEP_FLAG = 1;
|
32461 |
|
32462 |
|
32463 |
|
32464 |
|
32465 |
|
32466 |
|
32467 |
|
32468 |
|
32469 |
|
32470 |
|
32471 | function cloneMap(map, isDeep, cloneFunc) {
|
32472 | var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
|
32473 | return arrayReduce(array, addMapEntry, new map.constructor());
|
32474 | }
|
32475 |
|
32476 | module.exports = cloneMap;
|
32477 |
|
32478 | }),
|
32479 |
|
32480 | (function(module, exports) {
|
32481 |
|
32482 |
|
32483 |
|
32484 |
|
32485 |
|
32486 |
|
32487 |
|
32488 |
|
32489 |
|
32490 | function addMapEntry(map, pair) {
|
32491 |
|
32492 | map.set(pair[0], pair[1]);
|
32493 | return map;
|
32494 | }
|
32495 |
|
32496 | module.exports = addMapEntry;
|
32497 |
|
32498 | }),
|
32499 |
|
32500 | (function(module, exports) {
|
32501 |
|
32502 |
|
32503 | var reFlags = /\w*$/;
|
32504 |
|
32505 |
|
32506 |
|
32507 |
|
32508 |
|
32509 |
|
32510 |
|
32511 |
|
32512 | function cloneRegExp(regexp) {
|
32513 | var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
32514 | result.lastIndex = regexp.lastIndex;
|
32515 | return result;
|
32516 | }
|
32517 |
|
32518 | module.exports = cloneRegExp;
|
32519 |
|
32520 | }),
|
32521 |
|
32522 | (function(module, exports, __webpack_require__) {
|
32523 |
|
32524 | var addSetEntry = __webpack_require__(251),
|
32525 | arrayReduce = __webpack_require__(58),
|
32526 | setToArray = __webpack_require__(20);
|
32527 |
|
32528 |
|
32529 | var CLONE_DEEP_FLAG = 1;
|
32530 |
|
32531 |
|
32532 |
|
32533 |
|
32534 |
|
32535 |
|
32536 |
|
32537 |
|
32538 |
|
32539 |
|
32540 | function cloneSet(set, isDeep, cloneFunc) {
|
32541 | var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
|
32542 | return arrayReduce(array, addSetEntry, new set.constructor());
|
32543 | }
|
32544 |
|
32545 | module.exports = cloneSet;
|
32546 |
|
32547 | /***/ }),
|
32548 | /* 251 */
|
32549 | /***/ (function(module, exports) {
|
32550 |
|
32551 |
|
32552 |
|
32553 |
|
32554 |
|
32555 |
|
32556 |
|
32557 |
|
32558 |
|
32559 | function addSetEntry(set, value) {
|
32560 |
|
32561 | set.add(value);
|
32562 | return set;
|
32563 | }
|
32564 |
|
32565 | module.exports = addSetEntry;
|
32566 |
|
32567 | /***/ }),
|
32568 | /* 252 */
|
32569 | /***/ (function(module, exports, __webpack_require__) {
|
32570 |
|
32571 | var _Symbol = __webpack_require__(12);
|
32572 |
|
32573 |
|
32574 | var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
32575 | symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
32576 |
|
32577 |
|
32578 |
|
32579 |
|
32580 |
|
32581 |
|
32582 |
|
32583 |
|
32584 | function cloneSymbol(symbol) {
|
32585 | return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
32586 | }
|
32587 |
|
32588 | module.exports = cloneSymbol;
|
32589 |
|
32590 | }),
|
32591 |
|
32592 | (function(module, exports, __webpack_require__) {
|
32593 |
|
32594 | var cloneArrayBuffer = __webpack_require__(62);
|
32595 |
|
32596 |
|
32597 |
|
32598 |
|
32599 |
|
32600 |
|
32601 |
|
32602 |
|
32603 |
|
32604 | function cloneTypedArray(typedArray, isDeep) {
|
32605 | var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
32606 | return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
32607 | }
|
32608 |
|
32609 | module.exports = cloneTypedArray;
|
32610 |
|
32611 | }),
|
32612 |
|
32613 | (function(module, exports, __webpack_require__) {
|
32614 |
|
32615 | var baseCreate = __webpack_require__(255),
|
32616 | getPrototype = __webpack_require__(59),
|
32617 | isPrototype = __webpack_require__(18);
|
32618 |
|
32619 |
|
32620 |
|
32621 |
|
32622 |
|
32623 |
|
32624 |
|
32625 |
|
32626 | function initCloneObject(object) {
|
32627 | return typeof object.constructor == 'function' && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
32628 | }
|
32629 |
|
32630 | module.exports = initCloneObject;
|
32631 |
|
32632 | }),
|
32633 |
|
32634 | (function(module, exports, __webpack_require__) {
|
32635 |
|
32636 | var isObject = __webpack_require__(7);
|
32637 |
|
32638 |
|
32639 | var objectCreate = Object.create;
|
32640 |
|
32641 |
|
32642 |
|
32643 |
|
32644 |
|
32645 |
|
32646 |
|
32647 |
|
32648 |
|
32649 | var baseCreate = function () {
|
32650 | function object() {}
|
32651 | return function (proto) {
|
32652 | if (!isObject(proto)) {
|
32653 | return {};
|
32654 | }
|
32655 | if (objectCreate) {
|
32656 | return objectCreate(proto);
|
32657 | }
|
32658 | object.prototype = proto;
|
32659 | var result = new object();
|
32660 | object.prototype = undefined;
|
32661 | return result;
|
32662 | };
|
32663 | }();
|
32664 |
|
32665 | module.exports = baseCreate;
|
32666 |
|
32667 | }),
|
32668 |
|
32669 | (function(module, exports, __webpack_require__) {
|
32670 |
|
32671 | var baseExtremum = __webpack_require__(105),
|
32672 | baseGt = __webpack_require__(257),
|
32673 | baseIteratee = __webpack_require__(19);
|
32674 |
|
32675 |
|
32676 |
|
32677 |
|
32678 |
|
32679 |
|
32680 |
|
32681 |
|
32682 |
|
32683 |
|
32684 |
|
32685 |
|
32686 |
|
32687 |
|
32688 |
|
32689 |
|
32690 |
|
32691 |
|
32692 |
|
32693 |
|
32694 |
|
32695 |
|
32696 |
|
32697 |
|
32698 | function maxBy(array, iteratee) {
|
32699 | return array && array.length ? baseExtremum(array, baseIteratee(iteratee, 2), baseGt) : undefined;
|
32700 | }
|
32701 |
|
32702 | module.exports = maxBy;
|
32703 |
|
32704 | }),
|
32705 |
|
32706 | (function(module, exports) {
|
32707 |
|
32708 |
|
32709 |
|
32710 |
|
32711 |
|
32712 |
|
32713 |
|
32714 |
|
32715 |
|
32716 |
|
32717 | function baseGt(value, other) {
|
32718 | return value > other;
|
32719 | }
|
32720 |
|
32721 | module.exports = baseGt;
|
32722 |
|
32723 | }),
|
32724 |
|
32725 | (function(module, exports, __webpack_require__) {
|
32726 |
|
32727 | var baseExtremum = __webpack_require__(105),
|
32728 | baseIteratee = __webpack_require__(19),
|
32729 | baseLt = __webpack_require__(259);
|
32730 |
|
32731 |
|
32732 |
|
32733 |
|
32734 |
|
32735 |
|
32736 |
|
32737 |
|
32738 |
|
32739 |
|
32740 |
|
32741 |
|
32742 |
|
32743 |
|
32744 |
|
32745 |
|
32746 |
|
32747 |
|
32748 |
|
32749 |
|
32750 |
|
32751 |
|
32752 |
|
32753 |
|
32754 | function minBy(array, iteratee) {
|
32755 | return array && array.length ? baseExtremum(array, baseIteratee(iteratee, 2), baseLt) : undefined;
|
32756 | }
|
32757 |
|
32758 | module.exports = minBy;
|
32759 |
|
32760 | }),
|
32761 |
|
32762 | (function(module, exports) {
|
32763 |
|
32764 |
|
32765 |
|
32766 |
|
32767 |
|
32768 |
|
32769 |
|
32770 |
|
32771 |
|
32772 |
|
32773 | function baseLt(value, other) {
|
32774 | return value < other;
|
32775 | }
|
32776 |
|
32777 | module.exports = baseLt;
|
32778 |
|
32779 | }),
|
32780 |
|
32781 | (function(module, exports, __webpack_require__) {
|
32782 |
|
32783 | var createRound = __webpack_require__(261);
|
32784 |
|
32785 |
|
32786 |
|
32787 |
|
32788 |
|
32789 |
|
32790 |
|
32791 |
|
32792 |
|
32793 |
|
32794 |
|
32795 |
|
32796 |
|
32797 |
|
32798 |
|
32799 |
|
32800 |
|
32801 |
|
32802 |
|
32803 |
|
32804 |
|
32805 |
|
32806 | var round = createRound('round');
|
32807 |
|
32808 | module.exports = round;
|
32809 |
|
32810 | }),
|
32811 |
|
32812 | (function(module, exports, __webpack_require__) {
|
32813 |
|
32814 | var toInteger = __webpack_require__(96),
|
32815 | toNumber = __webpack_require__(97),
|
32816 | toString = __webpack_require__(15);
|
32817 |
|
32818 |
|
32819 | var nativeMin = Math.min;
|
32820 |
|
32821 |
|
32822 |
|
32823 |
|
32824 |
|
32825 |
|
32826 |
|
32827 |
|
32828 | function createRound(methodName) {
|
32829 | var func = Math[methodName];
|
32830 | return function (number, precision) {
|
32831 | number = toNumber(number);
|
32832 | precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
32833 | if (precision) {
|
32834 |
|
32835 |
|
32836 | var pair = (toString(number) + 'e').split('e'),
|
32837 | value = func(pair[0] + 'e' + (+pair[1] + precision));
|
32838 |
|
32839 | pair = (toString(value) + 'e').split('e');
|
32840 | return +(pair[0] + 'e' + (+pair[1] - precision));
|
32841 | }
|
32842 | return func(number);
|
32843 | };
|
32844 | }
|
32845 |
|
32846 | module.exports = createRound;
|
32847 |
|
32848 | }),
|
32849 |
|
32850 | (function(module, exports, __webpack_require__) {
|
32851 |
|
32852 | var arrayFilter = __webpack_require__(83),
|
32853 | baseFilter = __webpack_require__(263),
|
32854 | baseIteratee = __webpack_require__(19),
|
32855 | isArray = __webpack_require__(3);
|
32856 |
|
32857 |
|
32858 |
|
32859 |
|
32860 |
|
32861 |
|
32862 |
|
32863 |
|
32864 |
|
32865 |
|
32866 |
|
32867 |
|
32868 |
|
32869 |
|
32870 |
|
32871 |
|
32872 |
|
32873 |
|
32874 |
|
32875 |
|
32876 |
|
32877 |
|
32878 |
|
32879 |
|
32880 |
|
32881 |
|
32882 |
|
32883 |
|
32884 |
|
32885 |
|
32886 |
|
32887 |
|
32888 |
|
32889 |
|
32890 |
|
32891 |
|
32892 |
|
32893 |
|
32894 | function filter(collection, predicate) {
|
32895 | var func = isArray(collection) ? arrayFilter : baseFilter;
|
32896 | return func(collection, baseIteratee(predicate, 3));
|
32897 | }
|
32898 |
|
32899 | module.exports = filter;
|
32900 |
|
32901 | }),
|
32902 |
|
32903 | (function(module, exports, __webpack_require__) {
|
32904 |
|
32905 | var baseEach = __webpack_require__(27);
|
32906 |
|
32907 |
|
32908 |
|
32909 |
|
32910 |
|
32911 |
|
32912 |
|
32913 |
|
32914 |
|
32915 | function baseFilter(collection, predicate) {
|
32916 | var result = [];
|
32917 | baseEach(collection, function (value, index, collection) {
|
32918 | if (predicate(value, index, collection)) {
|
32919 | result.push(value);
|
32920 | }
|
32921 | });
|
32922 | return result;
|
32923 | }
|
32924 |
|
32925 | module.exports = baseFilter;
|
32926 |
|
32927 | }),
|
32928 |
|
32929 | (function(module, exports, __webpack_require__) {
|
32930 |
|
32931 | var baseIsEqual = __webpack_require__(37);
|
32932 |
|
32933 |
|
32934 |
|
32935 |
|
32936 |
|
32937 |
|
32938 |
|
32939 |
|
32940 |
|
32941 |
|
32942 |
|
32943 |
|
32944 |
|
32945 |
|
32946 |
|
32947 |
|
32948 |
|
32949 |
|
32950 |
|
32951 |
|
32952 |
|
32953 |
|
32954 |
|
32955 |
|
32956 |
|
32957 |
|
32958 |
|
32959 |
|
32960 |
|
32961 |
|
32962 |
|
32963 |
|
32964 |
|
32965 | function isEqualWith(value, other, customizer) {
|
32966 | customizer = typeof customizer == 'function' ? customizer : undefined;
|
32967 | var result = customizer ? customizer(value, other) : undefined;
|
32968 | return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
|
32969 | }
|
32970 |
|
32971 | module.exports = isEqualWith;
|
32972 |
|
32973 | }),
|
32974 |
|
32975 | (function(module, exports, __webpack_require__) {
|
32976 |
|
32977 | var baseIsEqual = __webpack_require__(37);
|
32978 |
|
32979 |
|
32980 |
|
32981 |
|
32982 |
|
32983 |
|
32984 |
|
32985 |
|
32986 |
|
32987 |
|
32988 |
|
32989 |
|
32990 |
|
32991 |
|
32992 |
|
32993 |
|
32994 |
|
32995 |
|
32996 |
|
32997 |
|
32998 |
|
32999 |
|
33000 |
|
33001 |
|
33002 |
|
33003 |
|
33004 |
|
33005 |
|
33006 |
|
33007 | function isEqual(value, other) {
|
33008 | return baseIsEqual(value, other);
|
33009 | }
|
33010 |
|
33011 | module.exports = isEqual;
|
33012 |
|
33013 | }),
|
33014 |
|
33015 | (function(module, exports, __webpack_require__) {
|
33016 |
|
33017 | var toString = __webpack_require__(15);
|
33018 |
|
33019 |
|
33020 |
|
33021 |
|
33022 |
|
33023 |
|
33024 |
|
33025 |
|
33026 |
|
33027 |
|
33028 |
|
33029 |
|
33030 |
|
33031 |
|
33032 |
|
33033 |
|
33034 |
|
33035 |
|
33036 |
|
33037 |
|
33038 | function replace() {
|
33039 | var args = arguments,
|
33040 | string = toString(args[0]);
|
33041 |
|
33042 | return args.length < 3 ? string : string.replace(args[1], args[2]);
|
33043 | }
|
33044 |
|
33045 | module.exports = replace;
|
33046 |
|
33047 | }),
|
33048 |
|
33049 | (function(module, exports, __webpack_require__) {
|
33050 |
|
33051 | var baseFlatten = __webpack_require__(106),
|
33052 | baseRest = __webpack_require__(99),
|
33053 | baseUniq = __webpack_require__(107),
|
33054 | isArrayLikeObject = __webpack_require__(273);
|
33055 |
|
33056 |
|
33057 |
|
33058 |
|
33059 |
|
33060 |
|
33061 |
|
33062 |
|
33063 |
|
33064 |
|
33065 |
|
33066 |
|
33067 |
|
33068 |
|
33069 |
|
33070 |
|
33071 |
|
33072 | var union = baseRest(function (arrays) {
|
33073 | return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
|
33074 | });
|
33075 |
|
33076 | module.exports = union;
|
33077 |
|
33078 | }),
|
33079 |
|
33080 | (function(module, exports, __webpack_require__) {
|
33081 |
|
33082 | var _Symbol = __webpack_require__(12),
|
33083 | isArguments = __webpack_require__(28),
|
33084 | isArray = __webpack_require__(3);
|
33085 |
|
33086 |
|
33087 | var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
|
33088 |
|
33089 |
|
33090 |
|
33091 |
|
33092 |
|
33093 |
|
33094 |
|
33095 |
|
33096 | function isFlattenable(value) {
|
33097 | return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
33098 | }
|
33099 |
|
33100 | module.exports = isFlattenable;
|
33101 |
|
33102 | }),
|
33103 |
|
33104 | (function(module, exports, __webpack_require__) {
|
33105 |
|
33106 | var baseIndexOf = __webpack_require__(95);
|
33107 |
|
33108 |
|
33109 |
|
33110 |
|
33111 |
|
33112 |
|
33113 |
|
33114 |
|
33115 |
|
33116 |
|
33117 | function arrayIncludes(array, value) {
|
33118 | var length = array == null ? 0 : array.length;
|
33119 | return !!length && baseIndexOf(array, value, 0) > -1;
|
33120 | }
|
33121 |
|
33122 | module.exports = arrayIncludes;
|
33123 |
|
33124 | }),
|
33125 |
|
33126 | (function(module, exports) {
|
33127 |
|
33128 |
|
33129 |
|
33130 |
|
33131 |
|
33132 |
|
33133 |
|
33134 |
|
33135 |
|
33136 |
|
33137 | function arrayIncludesWith(array, value, comparator) {
|
33138 | var index = -1,
|
33139 | length = array == null ? 0 : array.length;
|
33140 |
|
33141 | while (++index < length) {
|
33142 | if (comparator(value, array[index])) {
|
33143 | return true;
|
33144 | }
|
33145 | }
|
33146 | return false;
|
33147 | }
|
33148 |
|
33149 | module.exports = arrayIncludesWith;
|
33150 |
|
33151 | }),
|
33152 |
|
33153 | (function(module, exports, __webpack_require__) {
|
33154 |
|
33155 | var Set = __webpack_require__(85),
|
33156 | noop = __webpack_require__(272),
|
33157 | setToArray = __webpack_require__(20);
|
33158 |
|
33159 |
|
33160 | var INFINITY = 1 / 0;
|
33161 |
|
33162 |
|
33163 |
|
33164 |
|
33165 |
|
33166 |
|
33167 |
|
33168 |
|
33169 | var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function (values) {
|
33170 | return new Set(values);
|
33171 | };
|
33172 |
|
33173 | module.exports = createSet;
|
33174 |
|
33175 | }),
|
33176 |
|
33177 | (function(module, exports) {
|
33178 |
|
33179 |
|
33180 |
|
33181 |
|
33182 |
|
33183 |
|
33184 |
|
33185 |
|
33186 |
|
33187 |
|
33188 |
|
33189 |
|
33190 |
|
33191 | function noop() {
|
33192 |
|
33193 | }
|
33194 |
|
33195 | module.exports = noop;
|
33196 |
|
33197 | }),
|
33198 |
|
33199 | (function(module, exports, __webpack_require__) {
|
33200 |
|
33201 | var isArrayLike = __webpack_require__(8),
|
33202 | isObjectLike = __webpack_require__(5);
|
33203 |
|
33204 |
|
33205 |
|
33206 |
|
33207 |
|
33208 |
|
33209 |
|
33210 |
|
33211 |
|
33212 |
|
33213 |
|
33214 |
|
33215 |
|
33216 |
|
33217 |
|
33218 |
|
33219 |
|
33220 |
|
33221 |
|
33222 |
|
33223 |
|
33224 |
|
33225 |
|
33226 |
|
33227 |
|
33228 |
|
33229 | function isArrayLikeObject(value) {
|
33230 | return isObjectLike(value) && isArrayLike(value);
|
33231 | }
|
33232 |
|
33233 | module.exports = isArrayLikeObject;
|
33234 |
|
33235 | }),
|
33236 |
|
33237 | (function(module, exports, __webpack_require__) {
|
33238 |
|
33239 | var basePick = __webpack_require__(275),
|
33240 | flatRest = __webpack_require__(278);
|
33241 |
|
33242 |
|
33243 |
|
33244 |
|
33245 |
|
33246 |
|
33247 |
|
33248 |
|
33249 |
|
33250 |
|
33251 |
|
33252 |
|
33253 |
|
33254 |
|
33255 |
|
33256 |
|
33257 |
|
33258 |
|
33259 | var pick = flatRest(function (object, paths) {
|
33260 | return object == null ? {} : basePick(object, paths);
|
33261 | });
|
33262 |
|
33263 | module.exports = pick;
|
33264 |
|
33265 | }),
|
33266 |
|
33267 | (function(module, exports, __webpack_require__) {
|
33268 |
|
33269 | var basePickBy = __webpack_require__(276),
|
33270 | hasIn = __webpack_require__(88);
|
33271 |
|
33272 |
|
33273 |
|
33274 |
|
33275 |
|
33276 |
|
33277 |
|
33278 |
|
33279 |
|
33280 |
|
33281 | function basePick(object, paths) {
|
33282 | return basePickBy(object, paths, function (value, path) {
|
33283 | return hasIn(object, path);
|
33284 | });
|
33285 | }
|
33286 |
|
33287 | module.exports = basePick;
|
33288 |
|
33289 | }),
|
33290 |
|
33291 | (function(module, exports, __webpack_require__) {
|
33292 |
|
33293 | var baseGet = __webpack_require__(56),
|
33294 | baseSet = __webpack_require__(277),
|
33295 | castPath = __webpack_require__(39);
|
33296 |
|
33297 |
|
33298 |
|
33299 |
|
33300 |
|
33301 |
|
33302 |
|
33303 |
|
33304 |
|
33305 |
|
33306 | function basePickBy(object, paths, predicate) {
|
33307 | var index = -1,
|
33308 | length = paths.length,
|
33309 | result = {};
|
33310 |
|
33311 | while (++index < length) {
|
33312 | var path = paths[index],
|
33313 | value = baseGet(object, path);
|
33314 |
|
33315 | if (predicate(value, path)) {
|
33316 | baseSet(result, castPath(path, object), value);
|
33317 | }
|
33318 | }
|
33319 | return result;
|
33320 | }
|
33321 |
|
33322 | module.exports = basePickBy;
|
33323 |
|
33324 | }),
|
33325 |
|
33326 | (function(module, exports, __webpack_require__) {
|
33327 |
|
33328 | var assignValue = __webpack_require__(40),
|
33329 | castPath = __webpack_require__(39),
|
33330 | isIndex = __webpack_require__(30),
|
33331 | isObject = __webpack_require__(7),
|
33332 | toKey = __webpack_require__(22);
|
33333 |
|
33334 |
|
33335 |
|
33336 |
|
33337 |
|
33338 |
|
33339 |
|
33340 |
|
33341 |
|
33342 |
|
33343 |
|
33344 | function baseSet(object, path, value, customizer) {
|
33345 | if (!isObject(object)) {
|
33346 | return object;
|
33347 | }
|
33348 | path = castPath(path, object);
|
33349 |
|
33350 | var index = -1,
|
33351 | length = path.length,
|
33352 | lastIndex = length - 1,
|
33353 | nested = object;
|
33354 |
|
33355 | while (nested != null && ++index < length) {
|
33356 | var key = toKey(path[index]),
|
33357 | newValue = value;
|
33358 |
|
33359 | if (index != lastIndex) {
|
33360 | var objValue = nested[key];
|
33361 | newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
33362 | if (newValue === undefined) {
|
33363 | newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
|
33364 | }
|
33365 | }
|
33366 | assignValue(nested, key, newValue);
|
33367 | nested = nested[key];
|
33368 | }
|
33369 | return object;
|
33370 | }
|
33371 |
|
33372 | module.exports = baseSet;
|
33373 |
|
33374 | }),
|
33375 |
|
33376 | (function(module, exports, __webpack_require__) {
|
33377 |
|
33378 | var flatten = __webpack_require__(279),
|
33379 | overRest = __webpack_require__(100),
|
33380 | setToString = __webpack_require__(101);
|
33381 |
|
33382 |
|
33383 |
|
33384 |
|
33385 |
|
33386 |
|
33387 |
|
33388 |
|
33389 | function flatRest(func) {
|
33390 | return setToString(overRest(func, undefined, flatten), func + '');
|
33391 | }
|
33392 |
|
33393 | module.exports = flatRest;
|
33394 |
|
33395 | }),
|
33396 |
|
33397 | (function(module, exports, __webpack_require__) {
|
33398 |
|
33399 | var baseFlatten = __webpack_require__(106);
|
33400 |
|
33401 |
|
33402 |
|
33403 |
|
33404 |
|
33405 |
|
33406 |
|
33407 |
|
33408 |
|
33409 |
|
33410 |
|
33411 |
|
33412 |
|
33413 |
|
33414 |
|
33415 | function flatten(array) {
|
33416 | var length = array == null ? 0 : array.length;
|
33417 | return length ? baseFlatten(array, 1) : [];
|
33418 | }
|
33419 |
|
33420 | module.exports = flatten;
|
33421 |
|
33422 | }),
|
33423 |
|
33424 | (function(module, exports, __webpack_require__) {
|
33425 |
|
33426 | var baseUniq = __webpack_require__(107);
|
33427 |
|
33428 |
|
33429 |
|
33430 |
|
33431 |
|
33432 |
|
33433 |
|
33434 |
|
33435 |
|
33436 |
|
33437 |
|
33438 |
|
33439 |
|
33440 |
|
33441 |
|
33442 |
|
33443 |
|
33444 |
|
33445 |
|
33446 | function uniq(array) {
|
33447 | return array && array.length ? baseUniq(array) : [];
|
33448 | }
|
33449 |
|
33450 | module.exports = uniq;
|
33451 |
|
33452 | }),
|
33453 |
|
33454 | (function(module, exports, __webpack_require__) {
|
33455 |
|
33456 |
|
33457 |
|
33458 |
|
33459 |
|
33460 | var Util = __webpack_require__(0);
|
33461 | var G = __webpack_require__(2);
|
33462 | var PathUtil = G.PathUtil;
|
33463 |
|
33464 | function getClip(coord) {
|
33465 | var start = coord.start;
|
33466 | var end = coord.end;
|
33467 | var width = coord.getWidth();
|
33468 | var height = coord.getHeight();
|
33469 | var margin = 200;
|
33470 | var startAngle = void 0;
|
33471 | var endAngle = void 0;
|
33472 | var center = void 0;
|
33473 | var radius = void 0;
|
33474 | var clip = void 0;
|
33475 |
|
33476 | if (coord.isPolar) {
|
33477 | radius = coord.getRadius();
|
33478 | center = coord.getCenter();
|
33479 | startAngle = coord.startAngle;
|
33480 | endAngle = coord.endAngle;
|
33481 | clip = new G.Fan({
|
33482 | attrs: {
|
33483 | x: center.x,
|
33484 | y: center.y,
|
33485 | rs: 0,
|
33486 | re: radius + margin,
|
33487 | startAngle: startAngle,
|
33488 | endAngle: startAngle
|
33489 | }
|
33490 | });
|
33491 | clip.endState = {
|
33492 | endAngle: endAngle
|
33493 | };
|
33494 | } else {
|
33495 | clip = new G.Rect({
|
33496 | attrs: {
|
33497 | x: start.x - margin,
|
33498 | y: end.y - margin,
|
33499 | width: coord.isTransposed ? width + margin * 2 : 0,
|
33500 | height: coord.isTransposed ? 0 : height + margin * 2
|
33501 | }
|
33502 | });
|
33503 |
|
33504 | if (coord.isTransposed) {
|
33505 | clip.endState = {
|
33506 | height: height + margin * 2
|
33507 | };
|
33508 | } else {
|
33509 | clip.endState = {
|
33510 | width: width + margin * 2
|
33511 | };
|
33512 | }
|
33513 | }
|
33514 | clip.isClip = true;
|
33515 | return clip;
|
33516 | }
|
33517 |
|
33518 |
|
33519 | function getPointsBox(points) {
|
33520 | if (Util.isEmpty(points)) {
|
33521 | return null;
|
33522 | }
|
33523 |
|
33524 | var minX = points[0].x;
|
33525 | var maxX = points[0].x;
|
33526 | var minY = points[0].y;
|
33527 | var maxY = points[0].y;
|
33528 | Util.each(points, function (point) {
|
33529 | minX = minX > point.x ? point.x : minX;
|
33530 | maxX = maxX < point.x ? point.x : maxX;
|
33531 | minY = minY > point.y ? point.y : minY;
|
33532 | maxY = maxY < point.y ? point.y : maxY;
|
33533 | });
|
33534 | return {
|
33535 | minX: minX,
|
33536 | maxX: maxX,
|
33537 | minY: minY,
|
33538 | maxY: maxY,
|
33539 | centerX: (minX + maxX) / 2,
|
33540 | centerY: (minY + maxY) / 2
|
33541 | };
|
33542 | }
|
33543 |
|
33544 | function getAngle(shape, coord) {
|
33545 | var points = shape.points || shape.get('origin').points;
|
33546 | var box = getPointsBox(points);
|
33547 | var endAngle = void 0;
|
33548 | var startAngle = void 0;
|
33549 | var coordStartAngle = coord.startAngle;
|
33550 | var coordEndAngle = coord.endAngle;
|
33551 | var diffAngle = coordEndAngle - coordStartAngle;
|
33552 |
|
33553 | if (coord.isTransposed) {
|
33554 | endAngle = box.maxY * diffAngle;
|
33555 | startAngle = box.minY * diffAngle;
|
33556 | } else {
|
33557 | endAngle = box.maxX * diffAngle;
|
33558 | startAngle = box.minX * diffAngle;
|
33559 | }
|
33560 | endAngle += coordStartAngle;
|
33561 | startAngle += coordStartAngle;
|
33562 | return {
|
33563 | startAngle: startAngle,
|
33564 | endAngle: endAngle
|
33565 | };
|
33566 | }
|
33567 |
|
33568 | function getAnimateParam(animateCfg, index, id) {
|
33569 | var result = {};
|
33570 | if (animateCfg.delay) {
|
33571 | result.delay = Util.isFunction(animateCfg.delay) ? animateCfg.delay(index, id) : animateCfg.delay;
|
33572 | }
|
33573 | result.easing = Util.isFunction(animateCfg.easing) ? animateCfg.easing(index, id) : animateCfg.easing;
|
33574 | result.duration = Util.isFunction(animateCfg.duration) ? animateCfg.duration(index, id) : animateCfg.duration;
|
33575 | result.callback = animateCfg.callback;
|
33576 | return result;
|
33577 | }
|
33578 |
|
33579 | function scaleInY(shape, animateCfg) {
|
33580 | var id = shape._id;
|
33581 | var index = shape.get('index');
|
33582 | var box = shape.getBBox();
|
33583 | var points = shape.get('origin').points;
|
33584 | var x = (box.minX + box.maxX) / 2;
|
33585 | var y = void 0;
|
33586 |
|
33587 | if (points[0].y - points[1].y <= 0) {
|
33588 |
|
33589 | y = box.maxY;
|
33590 | } else {
|
33591 | y = box.minY;
|
33592 | }
|
33593 | var v = [x, y, 1];
|
33594 | shape.apply(v);
|
33595 | shape.attr('transform', [['t', -x, -y], ['s', 1, 0.01], ['t', x, y]]);
|
33596 | var endState = {
|
33597 | transform: [['t', -x, -y], ['s', 1, 100], ['t', x, y]]
|
33598 | };
|
33599 | var animateParam = getAnimateParam(animateCfg, index, id, endState);
|
33600 | shape.animate(endState, animateParam.duration, animateParam.easing, animateParam.callback, animateParam.delay);
|
33601 | }
|
33602 |
|
33603 | function scaleInX(shape, animateCfg) {
|
33604 | var id = shape._id;
|
33605 | var index = shape.get('index');
|
33606 | var box = shape.getBBox();
|
33607 | var points = shape.get('origin').points;
|
33608 | var x = void 0;
|
33609 | var y = (box.minY + box.maxY) / 2;
|
33610 |
|
33611 | if (points[0].y - points[1].y > 0) {
|
33612 |
|
33613 | x = box.maxX;
|
33614 | } else {
|
33615 | x = box.minX;
|
33616 | }
|
33617 | var v = [x, y, 1];
|
33618 | shape.apply(v);
|
33619 | shape.attr({
|
33620 | transform: [['t', -x, -y], ['s', 0.01, 1], ['t', x, y]]
|
33621 | });
|
33622 | var endState = {
|
33623 | transform: [['t', -x, -y], ['s', 100, 1], ['t', x, y]]
|
33624 | };
|
33625 | var animateParam = getAnimateParam(animateCfg, index, id, endState);
|
33626 | shape.animate(endState, animateParam.duration, animateParam.easing, animateParam.callback, animateParam.delay);
|
33627 | }
|
33628 |
|
33629 | function lineWidthOut(shape, animateCfg) {
|
33630 | var endState = {
|
33631 | lineWidth: 0,
|
33632 | opacity: 0
|
33633 | };
|
33634 | var id = shape._id;
|
33635 | var index = shape.get('index');
|
33636 | var animateParam = getAnimateParam(animateCfg, index, id, endState);
|
33637 | shape.animate(endState, animateParam.duration, animateParam.easing, function () {
|
33638 | shape.remove();
|
33639 | }, animateParam.delay);
|
33640 | }
|
33641 |
|
33642 | function zoomIn(shape, animateCfg, coord) {
|
33643 | var id = shape._id;
|
33644 | var index = shape.get('index');
|
33645 | var x = void 0;
|
33646 | var y = void 0;
|
33647 | if (coord.isPolar && shape.name !== 'point') {
|
33648 | x = coord.getCenter().x;
|
33649 | y = coord.getCenter().y;
|
33650 | } else {
|
33651 | var box = shape.getBBox();
|
33652 | x = (box.minX + box.maxX) / 2;
|
33653 | y = (box.minY + box.maxY) / 2;
|
33654 | }
|
33655 | var v = [x, y, 1];
|
33656 | shape.apply(v);
|
33657 | shape.attr({
|
33658 | transform: [['t', -x, -y], ['s', 0.01, 0.01], ['t', x, y]]
|
33659 | });
|
33660 | var endState = {
|
33661 | transform: [['t', -x, -y], ['s', 100, 100], ['t', x, y]]
|
33662 | };
|
33663 | var animateParam = getAnimateParam(animateCfg, index, id, endState);
|
33664 | shape.animate(endState, animateParam.duration, animateParam.easing, animateParam.callback, animateParam.delay);
|
33665 | }
|
33666 |
|
33667 | function zoomOut(shape, animateCfg, coord) {
|
33668 | var id = shape._id;
|
33669 | var index = shape.get('index');
|
33670 | var x = void 0;
|
33671 | var y = void 0;
|
33672 | if (coord.isPolar && shape.name !== 'point') {
|
33673 | x = coord.getCenter().x;
|
33674 | y = coord.getCenter().y;
|
33675 | } else {
|
33676 | var box = shape.getBBox();
|
33677 | x = (box.minX + box.maxX) / 2;
|
33678 | y = (box.minY + box.maxY) / 2;
|
33679 | }
|
33680 | var v = [x, y, 1];
|
33681 | shape.apply(v);
|
33682 | var endState = {
|
33683 | transform: [['t', -x, -y], ['s', 0.01, 0.01], ['t', x, y]]
|
33684 | };
|
33685 | var animateParam = getAnimateParam(animateCfg, index, id, endState);
|
33686 | shape.animate(endState, animateParam.duration, animateParam.easing, function () {
|
33687 | shape.remove();
|
33688 | }, animateParam.delay);
|
33689 | }
|
33690 |
|
33691 | function pathIn(shape, animateCfg) {
|
33692 | if (shape.get('type') !== 'path') return;
|
33693 | var id = shape._id;
|
33694 | var index = shape.get('index');
|
33695 | var path = PathUtil.pathToAbsolute(shape.attr('path'));
|
33696 | shape.attr('path', [path[0]]);
|
33697 | var endState = {
|
33698 | path: path
|
33699 | };
|
33700 | var animateParam = getAnimateParam(animateCfg, index, id, endState);
|
33701 | shape.animate(endState, animateParam.duration, animateParam.easing, animateParam.callback, animateParam.delay);
|
33702 | }
|
33703 |
|
33704 | function pathOut(shape, animateCfg) {
|
33705 | if (shape.get('type') !== 'path') return;
|
33706 | var id = shape._id;
|
33707 | var index = shape.get('index');
|
33708 | var path = PathUtil.pathToAbsolute(shape.attr('path'));
|
33709 | var endState = {
|
33710 | path: [path[0]]
|
33711 | };
|
33712 | var animateParam = getAnimateParam(animateCfg, index, id, endState);
|
33713 | shape.animate(endState, animateParam.duration, animateParam.easing, function () {
|
33714 | shape.remove();
|
33715 | }, animateParam.delay);
|
33716 | }
|
33717 |
|
33718 | function clipIn(shape, animateCfg, coord, startAngle, endAngle) {
|
33719 | var clip = getClip(coord);
|
33720 | var canvas = shape.get('canvas');
|
33721 | var id = shape._id;
|
33722 | var index = shape.get('index');
|
33723 | var endState = void 0;
|
33724 | if (startAngle) {
|
33725 | clip.attr('startAngle', startAngle);
|
33726 | clip.attr('endAngle', startAngle);
|
33727 | endState = {
|
33728 | endAngle: endAngle
|
33729 | };
|
33730 | } else {
|
33731 | endState = clip.endState;
|
33732 | }
|
33733 | clip.set('canvas', canvas);
|
33734 | shape.attr('clip', clip);
|
33735 | shape.setSilent('animating', true);
|
33736 | var animateParam = getAnimateParam(animateCfg, index, id, endState);
|
33737 | clip.animate(endState, animateParam.duration, animateParam.easing, function () {
|
33738 | if (shape && !shape.get('destroyed')) {
|
33739 | shape.attr('clip', null);
|
33740 | shape.setSilent('cacheShape', null);
|
33741 | shape.setSilent('animating', false);
|
33742 | clip.remove();
|
33743 | }
|
33744 | }, animateParam.delay);
|
33745 | }
|
33746 |
|
33747 | function fadeIn(shape, animateCfg) {
|
33748 | var id = shape._id;
|
33749 | var index = shape.get('index');
|
33750 | var fillOpacity = Util.isNil(shape.attr('fillOpacity')) ? 1 : shape.attr('fillOpacity');
|
33751 | var strokeOpacity = Util.isNil(shape.attr('strokeOpacity')) ? 1 : shape.attr('strokeOpacity');
|
33752 | shape.attr('fillOpacity', 0);
|
33753 | shape.attr('strokeOpacity', 0);
|
33754 | var endState = {
|
33755 | fillOpacity: fillOpacity,
|
33756 | strokeOpacity: strokeOpacity
|
33757 | };
|
33758 | var animateParam = getAnimateParam(animateCfg, index, id, endState);
|
33759 | shape.animate(endState, animateParam.duration, animateParam.easing, animateParam.callback, animateParam.delay);
|
33760 | }
|
33761 |
|
33762 | function fadeOut(shape, animateCfg) {
|
33763 | var id = shape._id;
|
33764 | var index = shape.get('index');
|
33765 | var endState = {
|
33766 | fillOpacity: 0,
|
33767 | strokeOpacity: 0
|
33768 | };
|
33769 | var animateParam = getAnimateParam(animateCfg, index, id, endState);
|
33770 | shape.animate(endState, animateParam.duration, animateParam.easing, function () {
|
33771 | shape.remove();
|
33772 | }, animateParam.delay);
|
33773 | }
|
33774 |
|
33775 | function fanIn(shape, animateCfg, coord) {
|
33776 | var angle = getAngle(shape, coord);
|
33777 | var endAngle = angle.endAngle;
|
33778 | var startAngle = angle.startAngle;
|
33779 | clipIn(shape, animateCfg, coord, startAngle, endAngle);
|
33780 | }
|
33781 |
|
33782 |
|
33783 | module.exports = {
|
33784 | enter: {
|
33785 | clipIn: clipIn,
|
33786 | zoomIn: zoomIn,
|
33787 | pathIn: pathIn,
|
33788 | scaleInY: scaleInY,
|
33789 | scaleInX: scaleInX,
|
33790 | fanIn: fanIn,
|
33791 | fadeIn: fadeIn
|
33792 | },
|
33793 | leave: {
|
33794 | lineWidthOut: lineWidthOut,
|
33795 | zoomOut: zoomOut,
|
33796 | pathOut: pathOut,
|
33797 | fadeOut: fadeOut
|
33798 | },
|
33799 | appear: {
|
33800 | clipIn: clipIn,
|
33801 | zoomIn: zoomIn,
|
33802 | pathIn: pathIn,
|
33803 | scaleInY: scaleInY,
|
33804 | scaleInX: scaleInX,
|
33805 | fanIn: fanIn,
|
33806 | fadeIn: fadeIn
|
33807 | },
|
33808 | update: {
|
33809 | fadeIn: fadeIn,
|
33810 | fanIn: fanIn
|
33811 | }
|
33812 | };
|
33813 |
|
33814 | }),
|
33815 |
|
33816 | (function(module, exports, __webpack_require__) {
|
33817 |
|
33818 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
33819 |
|
33820 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
33821 |
|
33822 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
33823 |
|
33824 |
|
33825 |
|
33826 |
|
33827 |
|
33828 |
|
33829 | var Util = __webpack_require__(0);
|
33830 | var View = __webpack_require__(283);
|
33831 | var G = __webpack_require__(2);
|
33832 | var Canvas = G.Canvas;
|
33833 | var DomUtil = G.DomUtil;
|
33834 | var Component = __webpack_require__(25);
|
33835 | var Controller = __webpack_require__(115);
|
33836 | var Facets = __webpack_require__(360);
|
33837 | var Global = __webpack_require__(1);
|
33838 |
|
33839 | function _isScaleExist(scales, compareScale) {
|
33840 | var flag = false;
|
33841 | Util.each(scales, function (scale) {
|
33842 | var scaleValues = [].concat(scale.values);
|
33843 | var compareScaleValues = [].concat(compareScale.values);
|
33844 | if (scale.type === compareScale.type && scale.field === compareScale.field && scaleValues.sort().toString() === compareScaleValues.sort().toString()) {
|
33845 | flag = true;
|
33846 | return;
|
33847 | }
|
33848 | });
|
33849 |
|
33850 | return flag;
|
33851 | }
|
33852 |
|
33853 |
|
33854 |
|
33855 |
|
33856 |
|
33857 |
|
33858 | var Chart = function (_View) {
|
33859 | _inherits(Chart, _View);
|
33860 |
|
33861 | function Chart() {
|
33862 | _classCallCheck(this, Chart);
|
33863 |
|
33864 | return _possibleConstructorReturn(this, _View.apply(this, arguments));
|
33865 | }
|
33866 |
|
33867 | |
33868 |
|
33869 |
|
33870 |
|
33871 |
|
33872 | Chart.prototype.getDefaultCfg = function getDefaultCfg() {
|
33873 | var viewCfg = _View.prototype.getDefaultCfg.call(this);
|
33874 | return Util.mix(viewCfg, {
|
33875 | id: null,
|
33876 | forceFit: false,
|
33877 | container: null,
|
33878 | wrapperEl: null,
|
33879 | canvas: null,
|
33880 | width: 500,
|
33881 | height: 500,
|
33882 | pixelRatio: null,
|
33883 | padding: Global.plotCfg.padding,
|
33884 | backPlot: null,
|
33885 | frontPlot: null,
|
33886 | plotBackground: null,
|
33887 | background: null,
|
33888 | views: []
|
33889 | });
|
33890 | };
|
33891 |
|
33892 | Chart.prototype.init = function init() {
|
33893 | this._initCanvas();
|
33894 | this._initPlot();
|
33895 | this._initEvents();
|
33896 | _View.prototype.init.call(this);
|
33897 |
|
33898 | var tooltipController = new Controller.Tooltip({
|
33899 | chart: this,
|
33900 | options: {}
|
33901 | });
|
33902 | this.set('tooltipController', tooltipController);
|
33903 |
|
33904 | var legendController = new Controller.Legend({
|
33905 | chart: this
|
33906 | });
|
33907 | this.set('legendController', legendController);
|
33908 | this.set('_id', 'chart');
|
33909 | this.emit('afterinit');
|
33910 | };
|
33911 |
|
33912 |
|
33913 |
|
33914 | Chart.prototype._initCanvas = function _initCanvas() {
|
33915 | var container = this.get('container');
|
33916 | var id = this.get('id');
|
33917 |
|
33918 | if (!container && id) {
|
33919 | container = id;
|
33920 | this.set('container', id);
|
33921 | }
|
33922 | var width = this.get('width');
|
33923 | var height = this.get('height');
|
33924 | if (Util.isString(container)) {
|
33925 | container = document.getElementById(container);
|
33926 | if (!container) {
|
33927 | throw new Error('Please specify the container for the chart!');
|
33928 | }
|
33929 | this.set('container', container);
|
33930 | }
|
33931 | var wrapperEl = DomUtil.createDom('<div style="position:relative;"></div>');
|
33932 | container.appendChild(wrapperEl);
|
33933 | this.set('wrapperEl', wrapperEl);
|
33934 | if (this.get('forceFit')) {
|
33935 | width = DomUtil.getWidth(container);
|
33936 | this.set('width', width);
|
33937 | }
|
33938 | var canvas = new Canvas({
|
33939 | containerDOM: wrapperEl,
|
33940 | width: width,
|
33941 | height: height,
|
33942 | pixelRatio: this.get('pixelRatio')
|
33943 | });
|
33944 | this.set('canvas', canvas);
|
33945 | };
|
33946 |
|
33947 |
|
33948 |
|
33949 |
|
33950 | Chart.prototype._initPlot = function _initPlot() {
|
33951 | this._initPlotBack();
|
33952 | var canvas = this.get('canvas');
|
33953 | var backPlot = canvas.addGroup({
|
33954 | zIndex: 1
|
33955 | });
|
33956 | var plotContainer = canvas.addGroup({
|
33957 | zIndex: 2
|
33958 | });
|
33959 | var frontPlot = canvas.addGroup({
|
33960 | zIndex: 3
|
33961 | });
|
33962 |
|
33963 | this.set('backPlot', backPlot);
|
33964 | this.set('middlePlot', plotContainer);
|
33965 | this.set('frontPlot', frontPlot);
|
33966 | };
|
33967 |
|
33968 |
|
33969 |
|
33970 |
|
33971 | Chart.prototype._initPlotBack = function _initPlotBack() {
|
33972 | var canvas = this.get('canvas');
|
33973 | var plot = canvas.addGroup(Component.Plot, {
|
33974 | padding: this.get('padding'),
|
33975 | plotBackground: Util.mix({}, Global.plotBackground, this.get('plotBackground')),
|
33976 | background: Util.mix({}, Global.background, this.get('background'))
|
33977 | });
|
33978 | this.set('plot', plot);
|
33979 | this.set('plotRange', plot.get('plotRange'));
|
33980 | };
|
33981 |
|
33982 | Chart.prototype._initEvents = function _initEvents() {
|
33983 | if (this.get('forceFit')) {
|
33984 | window.addEventListener('resize', Util.wrapBehavior(this, '_initForceFitEvent'));
|
33985 | }
|
33986 | };
|
33987 |
|
33988 | Chart.prototype._initForceFitEvent = function _initForceFitEvent() {
|
33989 | var timer = setTimeout(Util.wrapBehavior(this, 'forceFit'), 200);
|
33990 | clearTimeout(this.get('resizeTimer'));
|
33991 | this.set('resizeTimer', timer);
|
33992 | };
|
33993 |
|
33994 |
|
33995 |
|
33996 |
|
33997 | Chart.prototype._renderLegends = function _renderLegends() {
|
33998 | var options = this.get('options');
|
33999 | var legendOptions = options.legends;
|
34000 | if (Util.isNil(legendOptions) || legendOptions !== false) {
|
34001 |
|
34002 | var legendController = this.get('legendController');
|
34003 | legendController.options = legendOptions || {};
|
34004 | legendController.plotRange = this.get('plotRange');
|
34005 |
|
34006 | if (legendOptions && legendOptions.custom) {
|
34007 |
|
34008 | legendController.addCustomLegend();
|
34009 | } else {
|
34010 | var geoms = this.getAllGeoms();
|
34011 | var scales = [];
|
34012 | Util.each(geoms, function (geom) {
|
34013 | var view = geom.get('view');
|
34014 | var attrs = geom.getAttrsForLegend();
|
34015 | Util.each(attrs, function (attr) {
|
34016 | var type = attr.type;
|
34017 | var scale = attr.getScale(type);
|
34018 | if (scale.type !== 'identity' && !_isScaleExist(scales, scale)) {
|
34019 | scales.push(scale);
|
34020 | var filteredValues = view.getFilteredValues(scale.field);
|
34021 | legendController.addLegend(scale, attr, geom, filteredValues);
|
34022 | }
|
34023 | });
|
34024 | });
|
34025 | }
|
34026 |
|
34027 | legendController.alignLegends();
|
34028 | }
|
34029 | };
|
34030 |
|
34031 |
|
34032 |
|
34033 |
|
34034 | Chart.prototype._renderTooltips = function _renderTooltips() {
|
34035 | var options = this.get('options');
|
34036 | if (Util.isNil(options.tooltip) || options.tooltip !== false) {
|
34037 |
|
34038 | var tooltipController = this.get('tooltipController');
|
34039 | tooltipController.options = options.tooltip || {};
|
34040 | tooltipController.renderTooltip();
|
34041 | }
|
34042 | };
|
34043 |
|
34044 | |
34045 |
|
34046 |
|
34047 |
|
34048 |
|
34049 |
|
34050 | Chart.prototype.getAllGeoms = function getAllGeoms() {
|
34051 | var geoms = [];
|
34052 | geoms = geoms.concat(this.get('geoms'));
|
34053 |
|
34054 | var views = this.get('views');
|
34055 | Util.each(views, function (view) {
|
34056 | geoms = geoms.concat(view.get('geoms'));
|
34057 | });
|
34058 |
|
34059 | return geoms;
|
34060 | };
|
34061 |
|
34062 | |
34063 |
|
34064 |
|
34065 |
|
34066 |
|
34067 |
|
34068 |
|
34069 | Chart.prototype.forceFit = function forceFit() {
|
34070 | var self = this;
|
34071 | var container = self.get('container');
|
34072 | var width = DomUtil.getWidth(container);
|
34073 | if (width !== this.get('width')) {
|
34074 | var height = this.get('height');
|
34075 | this.changeSize(width, height);
|
34076 | }
|
34077 | return self;
|
34078 | };
|
34079 |
|
34080 | |
34081 |
|
34082 |
|
34083 |
|
34084 |
|
34085 |
|
34086 |
|
34087 |
|
34088 | Chart.prototype.changeSize = function changeSize(width, height) {
|
34089 | var self = this;
|
34090 | var canvas = self.get('canvas');
|
34091 | canvas.changeSize(width, height);
|
34092 |
|
34093 | self.set('width', width);
|
34094 | self.set('height', height);
|
34095 | var plot = self.get('plot');
|
34096 | plot.repaint();
|
34097 |
|
34098 | self.repaint();
|
34099 | this.emit('afterchangesize');
|
34100 | return self;
|
34101 | };
|
34102 | |
34103 |
|
34104 |
|
34105 |
|
34106 |
|
34107 |
|
34108 |
|
34109 | Chart.prototype.changeWidth = function changeWidth(width) {
|
34110 | return this.changeSize(width, this.get('height'));
|
34111 | };
|
34112 | |
34113 |
|
34114 |
|
34115 |
|
34116 |
|
34117 |
|
34118 |
|
34119 | Chart.prototype.changeHeight = function changeHeight(height) {
|
34120 | return this.changeSize(this.get('width'), height);
|
34121 | };
|
34122 |
|
34123 | Chart.prototype.facet = function facet(type, cfg) {
|
34124 | var cls = Facets[Util.upperFirst(type)];
|
34125 | if (!cls) {
|
34126 | throw new Error('Not support such type of facets as: ' + type);
|
34127 | }
|
34128 | var preFacets = this.get('facets');
|
34129 | if (preFacets) {
|
34130 | preFacets.destroy();
|
34131 | }
|
34132 | cfg.chart = this;
|
34133 | var facets = new cls(cfg);
|
34134 | this.set('facets', facets);
|
34135 | };
|
34136 |
|
34137 | |
34138 |
|
34139 |
|
34140 |
|
34141 |
|
34142 |
|
34143 |
|
34144 | Chart.prototype.view = function view(cfg) {
|
34145 | cfg = cfg || {};
|
34146 | cfg.parent = this;
|
34147 | cfg.backPlot = this.get('backPlot');
|
34148 | cfg.middlePlot = this.get('middlePlot');
|
34149 | cfg.frontPlot = this.get('frontPlot');
|
34150 | cfg.canvas = this.get('canvas');
|
34151 | if (Util.isNil(cfg.animate)) {
|
34152 | cfg.animate = this.get('animate');
|
34153 | }
|
34154 | cfg.options = Util.mix({}, this._getSharedOptions(), cfg.options);
|
34155 | var view = new View(cfg);
|
34156 | view.set('_id', 'view' + this.get('views').length);
|
34157 | this.get('views').push(view);
|
34158 | this.emit('addview', { view: view });
|
34159 | return view;
|
34160 | };
|
34161 |
|
34162 | Chart.prototype.isShapeInView = function isShapeInView() {
|
34163 | return true;
|
34164 | };
|
34165 |
|
34166 | Chart.prototype.removeView = function removeView(view) {
|
34167 | var views = this.get('views');
|
34168 | Util.Array.remove(views, view);
|
34169 | view.destroy();
|
34170 | };
|
34171 |
|
34172 | Chart.prototype._getSharedOptions = function _getSharedOptions() {
|
34173 | var options = this.get('options');
|
34174 | var sharedOptions = {};
|
34175 | Util.each(['scales', 'coord', 'axes'], function (name) {
|
34176 | sharedOptions[name] = Util.cloneDeep(options[name]);
|
34177 | });
|
34178 | return sharedOptions;
|
34179 | };
|
34180 |
|
34181 | |
34182 |
|
34183 |
|
34184 |
|
34185 |
|
34186 |
|
34187 | Chart.prototype.getViewRegion = function getViewRegion() {
|
34188 | var plotRange = this.get('plotRange');
|
34189 | return {
|
34190 | start: plotRange.bl,
|
34191 | end: plotRange.tr
|
34192 | };
|
34193 | };
|
34194 |
|
34195 | |
34196 |
|
34197 |
|
34198 |
|
34199 |
|
34200 |
|
34201 |
|
34202 |
|
34203 | Chart.prototype.legend = function legend(field, cfg) {
|
34204 | var options = this.get('options');
|
34205 | if (!options.legends) {
|
34206 | options.legends = {};
|
34207 | }
|
34208 |
|
34209 | var legends = {};
|
34210 | if (field === false) {
|
34211 | options.legends = false;
|
34212 | } else if (Util.isObject(field)) {
|
34213 | legends = field;
|
34214 | } else if (Util.isString(field)) {
|
34215 | legends[field] = cfg;
|
34216 | } else {
|
34217 | legends = cfg;
|
34218 | }
|
34219 | Util.mix(options.legends, legends);
|
34220 |
|
34221 | return this;
|
34222 | };
|
34223 |
|
34224 | |
34225 |
|
34226 |
|
34227 |
|
34228 |
|
34229 |
|
34230 |
|
34231 |
|
34232 | Chart.prototype.tooltip = function tooltip(visible, cfg) {
|
34233 | var options = this.get('options');
|
34234 | if (!options.tooltip) {
|
34235 | options.tooltip = {};
|
34236 | }
|
34237 |
|
34238 | if (visible === false) {
|
34239 | options.tooltip = false;
|
34240 | } else if (Util.isObject(visible)) {
|
34241 | Util.mix(options.tooltip, visible);
|
34242 | } else {
|
34243 | Util.mix(options.tooltip, cfg);
|
34244 | }
|
34245 |
|
34246 | return this;
|
34247 | };
|
34248 |
|
34249 | |
34250 |
|
34251 |
|
34252 |
|
34253 |
|
34254 |
|
34255 | Chart.prototype.clear = function clear() {
|
34256 | this.emit('beforeclear');
|
34257 | var views = this.get('views');
|
34258 | while (views.length > 0) {
|
34259 | var view = views.shift();
|
34260 | view.destroy();
|
34261 | }
|
34262 | _View.prototype.clear.call(this);
|
34263 | var canvas = this.get('canvas');
|
34264 | canvas.draw();
|
34265 | this.emit('afterclear');
|
34266 | return this;
|
34267 | };
|
34268 |
|
34269 | Chart.prototype.clearInner = function clearInner() {
|
34270 | var views = this.get('views');
|
34271 | Util.each(views, function (view) {
|
34272 | view.clearInner();
|
34273 | });
|
34274 |
|
34275 | var tooltipController = this.get('tooltipController');
|
34276 | tooltipController && tooltipController.clear();
|
34277 |
|
34278 | if (!this.get('keepLegend')) {
|
34279 | var legendController = this.get('legendController');
|
34280 | legendController && legendController.clear();
|
34281 | }
|
34282 |
|
34283 | _View.prototype.clearInner.call(this);
|
34284 | };
|
34285 |
|
34286 | |
34287 |
|
34288 |
|
34289 |
|
34290 |
|
34291 |
|
34292 | Chart.prototype.paint = function paint() {
|
34293 | _View.prototype.paint.call(this);
|
34294 | !this.get('keepLegend') && this._renderLegends();
|
34295 | this._renderTooltips();
|
34296 | this.set('keepLegend', false);
|
34297 | };
|
34298 |
|
34299 | |
34300 |
|
34301 |
|
34302 |
|
34303 |
|
34304 |
|
34305 | Chart.prototype.changeVisible = function changeVisible(visible) {
|
34306 | var wrapperEl = this.get('wrapperEl');
|
34307 | var visibleStr = visible ? '' : 'none';
|
34308 | wrapperEl.style.display = visibleStr;
|
34309 | };
|
34310 |
|
34311 | |
34312 |
|
34313 |
|
34314 |
|
34315 |
|
34316 |
|
34317 | Chart.prototype.toDataURL = function toDataURL() {
|
34318 | var canvas = this.get('canvas');
|
34319 | var canvasDom = canvas.get('el');
|
34320 | var dataURL = canvasDom.toDataURL('image/png');
|
34321 | return dataURL;
|
34322 | };
|
34323 |
|
34324 | |
34325 |
|
34326 |
|
34327 |
|
34328 |
|
34329 |
|
34330 |
|
34331 | Chart.prototype.downloadImage = function downloadImage(name) {
|
34332 | var dataURL = this.toDataURL();
|
34333 | var link = document.createElement('a');
|
34334 | link.download = (name || 'chart') + '.png';
|
34335 | link.href = dataURL.replace('image/png', 'image/octet-stream');
|
34336 | link.click();
|
34337 | return dataURL;
|
34338 | };
|
34339 |
|
34340 | |
34341 |
|
34342 |
|
34343 |
|
34344 |
|
34345 |
|
34346 |
|
34347 | Chart.prototype.showTooltip = function showTooltip(point) {
|
34348 | var views = this.getViewsByPoint(point);
|
34349 | if (views.length) {
|
34350 | var tooltipController = this.get('tooltipController');
|
34351 | tooltipController.showTooltip(point, views);
|
34352 | }
|
34353 | return this;
|
34354 | };
|
34355 |
|
34356 | |
34357 |
|
34358 |
|
34359 |
|
34360 |
|
34361 |
|
34362 | Chart.prototype.hideTooltip = function hideTooltip() {
|
34363 | var tooltipController = this.get('tooltipController');
|
34364 | tooltipController.hideTooltip();
|
34365 | return this;
|
34366 | };
|
34367 |
|
34368 | |
34369 |
|
34370 |
|
34371 |
|
34372 |
|
34373 |
|
34374 |
|
34375 | Chart.prototype.getTooltipItems = function getTooltipItems(point) {
|
34376 | var self = this;
|
34377 | var views = self.getViewsByPoint(point);
|
34378 | var rst = [];
|
34379 | Util.each(views, function (view) {
|
34380 | var geoms = view.get('geoms');
|
34381 | Util.each(geoms, function (geom) {
|
34382 | var dataArray = geom.get('dataArray');
|
34383 | var items = [];
|
34384 | Util.each(dataArray, function (data) {
|
34385 | var tmpPoint = geom.findPoint(point, data);
|
34386 | if (tmpPoint) {
|
34387 | var subItems = geom.getTipItems(tmpPoint);
|
34388 | items = items.concat(subItems);
|
34389 | }
|
34390 | });
|
34391 | rst = rst.concat(items);
|
34392 | });
|
34393 | });
|
34394 | return rst;
|
34395 | };
|
34396 |
|
34397 | |
34398 |
|
34399 |
|
34400 |
|
34401 |
|
34402 |
|
34403 | Chart.prototype.destroy = function destroy() {
|
34404 | this.emit('beforedestroy');
|
34405 | var canvas = this.get('canvas');
|
34406 | var wrapperEl = this.get('wrapperEl');
|
34407 | wrapperEl.parentNode.removeChild(wrapperEl);
|
34408 | _View.prototype.destroy.call(this);
|
34409 | canvas.destroy();
|
34410 | window.removeEventListener('resize', Util.getWrapBehavior(this, '_initForceFitEvent'));
|
34411 | this.emit('afterdestroy');
|
34412 | };
|
34413 |
|
34414 | return Chart;
|
34415 | }(View);
|
34416 |
|
34417 | module.exports = Chart;
|
34418 |
|
34419 | }),
|
34420 |
|
34421 | (function(module, exports, __webpack_require__) {
|
34422 |
|
34423 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34424 |
|
34425 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
34426 |
|
34427 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
34428 |
|
34429 |
|
34430 |
|
34431 |
|
34432 |
|
34433 |
|
34434 | var Base = __webpack_require__(63);
|
34435 | var Geom = __webpack_require__(285);
|
34436 | var Util = __webpack_require__(0);
|
34437 | var Controller = __webpack_require__(115);
|
34438 | var Global = __webpack_require__(1);
|
34439 | var FIELD_ORIGIN = '_origin';
|
34440 | var Animate = __webpack_require__(359);
|
34441 |
|
34442 | function isFullCircle(coord) {
|
34443 | var startAngle = coord.startAngle;
|
34444 | var endAngle = coord.endAngle;
|
34445 | if (!Util.isNil(startAngle) && !Util.isNil(endAngle) && endAngle - startAngle < Math.PI * 2) {
|
34446 | return false;
|
34447 | }
|
34448 | return true;
|
34449 | }
|
34450 |
|
34451 | function isBetween(value, start, end) {
|
34452 | var tmp = (value - start) / (end - start);
|
34453 | return tmp >= 0 && tmp <= 1;
|
34454 | }
|
34455 |
|
34456 | function isPointInCoord(coord, point) {
|
34457 | var result = false;
|
34458 | if (coord) {
|
34459 | var type = coord.type;
|
34460 | if (type === 'theta') {
|
34461 | var start = coord.start;
|
34462 | var end = coord.end;
|
34463 | result = isBetween(point.x, start.x, end.x) && isBetween(point.y, start.y, end.y);
|
34464 | } else {
|
34465 | var invertPoint = coord.invert(point);
|
34466 | result = invertPoint.x >= 0 && invertPoint.y >= 0 && invertPoint.x <= 1 && invertPoint.y <= 1;
|
34467 | }
|
34468 | }
|
34469 | return result;
|
34470 | }
|
34471 |
|
34472 | var ViewGeoms = {};
|
34473 | Util.each(Geom, function (geomConstructor, className) {
|
34474 | var methodName = Util.lowerFirst(className);
|
34475 | ViewGeoms[methodName] = function (cfg) {
|
34476 | var geom = new geomConstructor(cfg);
|
34477 | this.addGeom(geom);
|
34478 | return geom;
|
34479 | };
|
34480 | });
|
34481 |
|
34482 |
|
34483 |
|
34484 |
|
34485 |
|
34486 |
|
34487 | var View = function (_Base) {
|
34488 | _inherits(View, _Base);
|
34489 |
|
34490 | |
34491 |
|
34492 |
|
34493 |
|
34494 |
|
34495 | View.prototype.getDefaultCfg = function getDefaultCfg() {
|
34496 | return {
|
34497 | viewContainer: null,
|
34498 | coord: null,
|
34499 | start: { x: 0, y: 0 },
|
34500 | end: { x: 1, y: 1 },
|
34501 | geoms: [],
|
34502 | scales: {},
|
34503 | options: {},
|
34504 | scaleController: null,
|
34505 | padding: 0,
|
34506 | parent: null,
|
34507 | tooltipEnable: true,
|
34508 | animate: true
|
34509 | };
|
34510 | };
|
34511 |
|
34512 | function View(cfg) {
|
34513 | _classCallCheck(this, View);
|
34514 |
|
34515 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
34516 |
|
34517 | Util.mix(_this, ViewGeoms);
|
34518 | _this.init();
|
34519 | return _this;
|
34520 | }
|
34521 |
|
34522 | |
34523 |
|
34524 |
|
34525 |
|
34526 |
|
34527 |
|
34528 | View.prototype.init = function init() {
|
34529 | this._initViewPlot();
|
34530 | if (this.get('data')) {
|
34531 | this._initData(this.get('data'));
|
34532 | }
|
34533 | this._initOptions();
|
34534 | this._initControllers();
|
34535 | this._bindEvents();
|
34536 | };
|
34537 |
|
34538 |
|
34539 |
|
34540 |
|
34541 | View.prototype._initOptions = function _initOptions() {
|
34542 | var self = this;
|
34543 | var options = Util.mix({}, self.get('options'));
|
34544 | if (!options.scales) {
|
34545 | options.scales = {};
|
34546 | }
|
34547 | if (!options.coord) {
|
34548 | options.coord = {};
|
34549 | }
|
34550 |
|
34551 | if (options.animate === false) {
|
34552 | this.set('animate', false);
|
34553 | }
|
34554 |
|
34555 | if (options.tooltip === false || Util.isNull(options.tooltip)) {
|
34556 |
|
34557 | this.set('tooltipEnable', false);
|
34558 | }
|
34559 |
|
34560 | if (options.geoms && options.geoms.length) {
|
34561 | Util.each(options.geoms, function (geomOption) {
|
34562 | self._createGeom(geomOption);
|
34563 | });
|
34564 | }
|
34565 | var scaleController = self.get('scaleController');
|
34566 | if (scaleController) {
|
34567 | scaleController.defs = options.scales;
|
34568 | }
|
34569 | var coordController = self.get('coordController');
|
34570 | if (coordController) {
|
34571 | coordController.reset(options.coord);
|
34572 | }
|
34573 | this.set('options', options);
|
34574 | };
|
34575 |
|
34576 | View.prototype._createGeom = function _createGeom(cfg) {
|
34577 | var type = cfg.type;
|
34578 | var geom = void 0;
|
34579 | if (this[type]) {
|
34580 | geom = this[type]();
|
34581 | Util.each(cfg, function (v, k) {
|
34582 | if (geom[k]) {
|
34583 |
|
34584 | if (Util.isObject(v) && v.field) {
|
34585 |
|
34586 | if (v === 'label') {
|
34587 | geom[k](v.field, v.callback, v.cfg);
|
34588 | } else {
|
34589 | var _cfg = void 0;
|
34590 | Util.each(v, function (value, key) {
|
34591 | if (key !== 'field') {
|
34592 | _cfg = value;
|
34593 | }
|
34594 | });
|
34595 | geom[k](v.field, _cfg);
|
34596 | }
|
34597 | } else {
|
34598 | geom[k](v);
|
34599 | }
|
34600 | }
|
34601 | });
|
34602 | }
|
34603 | };
|
34604 |
|
34605 |
|
34606 |
|
34607 |
|
34608 | View.prototype._initControllers = function _initControllers() {
|
34609 | var options = this.get('options');
|
34610 |
|
34611 | var scaleController = new Controller.Scale({
|
34612 | defs: options.scales
|
34613 | });
|
34614 | var coordController = new Controller.Coord(options.coord);
|
34615 | this.set('scaleController', scaleController);
|
34616 | this.set('coordController', coordController);
|
34617 |
|
34618 | var axisController = new Controller.Axis();
|
34619 | this.set('axisController', axisController);
|
34620 |
|
34621 | var guideController = new Controller.Guide({
|
34622 | options: options.guides || []
|
34623 | });
|
34624 | this.set('guideController', guideController);
|
34625 | };
|
34626 |
|
34627 | View.prototype._initViewPlot = function _initViewPlot() {
|
34628 | if (!this.get('viewContainer')) {
|
34629 |
|
34630 | this.set('viewContainer', this.get('middlePlot'));
|
34631 | }
|
34632 | };
|
34633 |
|
34634 | View.prototype._initGeoms = function _initGeoms() {
|
34635 | var geoms = this.get('geoms');
|
34636 | var filteredData = this.get('filteredData');
|
34637 | var coord = this.get('coord');
|
34638 | var viewId = this.get('_id');
|
34639 | for (var i = 0; i < geoms.length; i++) {
|
34640 | var geom = geoms[i];
|
34641 | geom.set('data', filteredData);
|
34642 | geom.set('coord', coord);
|
34643 | geom.set('_id', viewId + '-geom' + i);
|
34644 | geom.set('keyFields', this.get('keyFields'));
|
34645 | geom.init();
|
34646 | }
|
34647 | };
|
34648 |
|
34649 | View.prototype._clearGeoms = function _clearGeoms() {
|
34650 | var self = this;
|
34651 | var geoms = self.get('geoms');
|
34652 | for (var i = 0; i < geoms.length; i++) {
|
34653 | var geom = geoms[i];
|
34654 | geom.clear();
|
34655 | }
|
34656 | };
|
34657 |
|
34658 | View.prototype._removeGeoms = function _removeGeoms() {
|
34659 | var self = this;
|
34660 | var geoms = self.get('geoms');
|
34661 | while (geoms.length > 0) {
|
34662 | var geom = geoms.shift();
|
34663 | geom.destroy();
|
34664 | }
|
34665 | };
|
34666 |
|
34667 | View.prototype._drawGeoms = function _drawGeoms() {
|
34668 | var geoms = this.get('geoms');
|
34669 | var coord = this.get('coord');
|
34670 | for (var i = 0; i < geoms.length; i++) {
|
34671 | var geom = geoms[i];
|
34672 | geom.setCoord(coord);
|
34673 | geom.paint();
|
34674 | }
|
34675 | };
|
34676 |
|
34677 | View.prototype.isShapeInView = function isShapeInView(shape) {
|
34678 | var id = this.get('_id');
|
34679 | var shapeId = shape._id;
|
34680 | if (!shapeId) {
|
34681 | return shape.get('parent').get('viewId') === id;
|
34682 | }
|
34683 | return shapeId.split('-')[0] === id;
|
34684 | };
|
34685 |
|
34686 | |
34687 |
|
34688 |
|
34689 |
|
34690 |
|
34691 |
|
34692 |
|
34693 | View.prototype.getViewRegion = function getViewRegion() {
|
34694 | var self = this;
|
34695 | var parent = self.get('parent');
|
34696 | var start = void 0;
|
34697 | var end = void 0;
|
34698 | if (parent) {
|
34699 | var region = parent.getViewRegion();
|
34700 | var viewRegion = self._getViewRegion(region.start, region.end);
|
34701 | start = viewRegion.start;
|
34702 | end = viewRegion.end;
|
34703 | } else {
|
34704 | start = self.get('start');
|
34705 | end = self.get('end');
|
34706 | }
|
34707 | return {
|
34708 | start: start,
|
34709 | end: end
|
34710 | };
|
34711 | };
|
34712 |
|
34713 |
|
34714 |
|
34715 |
|
34716 | View.prototype._getViewRegion = function _getViewRegion(plotStart, plotEnd) {
|
34717 | var start = this.get('start');
|
34718 | var end = this.get('end');
|
34719 | var startX = start.x;
|
34720 | var startY = 1 - end.y;
|
34721 | var endX = end.x;
|
34722 | var endY = 1 - start.y;
|
34723 | var padding = this.get('padding');
|
34724 |
|
34725 | var allPadding = Util.toAllPadding(padding);
|
34726 | var top = allPadding[0];
|
34727 | var right = allPadding[1];
|
34728 | var bottom = allPadding[2];
|
34729 | var left = allPadding[3];
|
34730 |
|
34731 | var startPoint = {
|
34732 | x: startX * (plotEnd.x - plotStart.x) + plotStart.x + left,
|
34733 | y: startY * (plotEnd.y - plotStart.y) + plotStart.y - bottom
|
34734 |
|
34735 | };
|
34736 | var endPoint = {
|
34737 | x: endX * (plotEnd.x - plotStart.x) + plotStart.x - right,
|
34738 | y: endY * (plotEnd.y - plotStart.y) + plotStart.y + top
|
34739 | };
|
34740 |
|
34741 | return {
|
34742 | start: startPoint,
|
34743 | end: endPoint
|
34744 | };
|
34745 | };
|
34746 |
|
34747 | View.prototype._createCoord = function _createCoord() {
|
34748 | var coordController = this.get('coordController');
|
34749 | var region = this.getViewRegion();
|
34750 | var coord = coordController.createCoord(region.start, region.end);
|
34751 | this.set('coord', coord);
|
34752 | };
|
34753 |
|
34754 | View.prototype._renderAxes = function _renderAxes() {
|
34755 | var options = this.get('options');
|
34756 | var axesOptions = options.axes;
|
34757 | if (axesOptions === false) {
|
34758 |
|
34759 | return;
|
34760 | }
|
34761 | var axisController = this.get('axisController');
|
34762 | axisController.container = this.get('backPlot');
|
34763 | axisController.coord = this.get('coord');
|
34764 | axisController.options = axesOptions || {};
|
34765 | var xScale = this.getXScale();
|
34766 | var yScales = this.getYScales();
|
34767 | var viewId = this.get('_id');
|
34768 | axisController.createAxis(xScale, yScales, viewId);
|
34769 | };
|
34770 |
|
34771 | View.prototype._renderGuides = function _renderGuides() {
|
34772 | var guideController = this.get('guideController');
|
34773 | if (!Util.isEmpty(guideController.options)) {
|
34774 | var coord = this.get('coord');
|
34775 | guideController.backContainer = this.get('backPlot');
|
34776 | guideController.frontContainer = this.get('frontPlot');
|
34777 | guideController.xScales = this._getScales('x');
|
34778 | guideController.yScales = this._getScales('y');
|
34779 | guideController.render(coord);
|
34780 | }
|
34781 | };
|
34782 |
|
34783 |
|
34784 |
|
34785 | View.prototype._bindEvents = function _bindEvents() {
|
34786 | var eventController = new Controller.Event({
|
34787 | view: this,
|
34788 | canvas: this.get('canvas')
|
34789 | });
|
34790 | eventController.bindEvents();
|
34791 | this.set('eventController', eventController);
|
34792 | };
|
34793 |
|
34794 |
|
34795 |
|
34796 | View.prototype._clearEvents = function _clearEvents() {
|
34797 | var eventController = this.get('eventController');
|
34798 | eventController && eventController.clearEvents();
|
34799 | };
|
34800 |
|
34801 | View.prototype._getScales = function _getScales(dimType) {
|
34802 | var geoms = this.get('geoms');
|
34803 | var result = {};
|
34804 | for (var i = 0; i < geoms.length; i++) {
|
34805 | var geom = geoms[i];
|
34806 | var scale = dimType === 'x' ? geom.getXScale() : geom.getYScale();
|
34807 | if (scale && !result[scale.field]) {
|
34808 | result[scale.field] = scale;
|
34809 | }
|
34810 | }
|
34811 | return result;
|
34812 | };
|
34813 |
|
34814 | View.prototype._adjustScale = function _adjustScale() {
|
34815 | this._setCatScalesRange();
|
34816 | var geoms = this.get('geoms');
|
34817 | var scaleController = this.get('scaleController');
|
34818 | var colDefs = scaleController.defs;
|
34819 |
|
34820 | for (var i = 0; i < geoms.length; i++) {
|
34821 | var geom = geoms[i];
|
34822 | if (geom.get('type') === 'interval') {
|
34823 | var yScale = geom.getYScale();
|
34824 | var field = yScale.field;
|
34825 | if (!(colDefs[field] && colDefs[field].min) && yScale.min > 0) {
|
34826 | yScale.change({
|
34827 | min: 0
|
34828 | });
|
34829 | }
|
34830 | }
|
34831 | }
|
34832 | };
|
34833 |
|
34834 | View.prototype._setCatScalesRange = function _setCatScalesRange() {
|
34835 | var self = this;
|
34836 | var coord = self.get('coord');
|
34837 | var xScale = self.getXScale();
|
34838 | var yScales = self.getYScales();
|
34839 | var scales = [];
|
34840 |
|
34841 | xScale && scales.push(xScale);
|
34842 | scales = scales.concat(yScales);
|
34843 | var inFullCircle = coord.isPolar && isFullCircle(coord);
|
34844 | var scaleController = self.get('scaleController');
|
34845 | var colDefs = scaleController.defs;
|
34846 | Util.each(scales, function (scale) {
|
34847 | if ((scale.isCategory || scale.isIdentity) && scale.values && !(colDefs[scale.field] && colDefs[scale.field].range)) {
|
34848 | var count = scale.values.length;
|
34849 | var range = void 0;
|
34850 | if (count === 1) {
|
34851 | range = [0.5, 1];
|
34852 | } else {
|
34853 | var widthRatio = 1;
|
34854 | var offset = 0;
|
34855 | if (inFullCircle) {
|
34856 | if (!coord.isTransposed) {
|
34857 | range = [0, 1 - 1 / count];
|
34858 | } else {
|
34859 | widthRatio = Global.widthRatio.multiplePie;
|
34860 | offset = 1 / count * widthRatio;
|
34861 | range = [offset / 2, 1 - offset / 2];
|
34862 | }
|
34863 | } else {
|
34864 | offset = 1 / count * 1 / 2;
|
34865 | range = [offset, 1 - offset];
|
34866 | }
|
34867 | }
|
34868 | scale.range = range;
|
34869 | }
|
34870 | });
|
34871 | };
|
34872 |
|
34873 | View.prototype.getXScale = function getXScale() {
|
34874 | var geoms = this.get('geoms').filter(function (geom) {
|
34875 | return geom.get('visible');
|
34876 | });
|
34877 | var xScale = null;
|
34878 | if (!Util.isEmpty(geoms)) {
|
34879 | xScale = geoms[0].getXScale();
|
34880 | }
|
34881 | return xScale;
|
34882 | };
|
34883 |
|
34884 | View.prototype.getYScales = function getYScales() {
|
34885 | var geoms = this.get('geoms').filter(function (geom) {
|
34886 | return geom.get('visible');
|
34887 | });
|
34888 | var rst = [];
|
34889 |
|
34890 | for (var i = 0; i < geoms.length; i++) {
|
34891 | var geom = geoms[i];
|
34892 | var yScale = geom.getYScale();
|
34893 | if (yScale && Util.indexOf(rst, yScale) === -1) {
|
34894 | rst.push(yScale);
|
34895 | }
|
34896 | }
|
34897 | return rst;
|
34898 | };
|
34899 |
|
34900 | |
34901 |
|
34902 |
|
34903 |
|
34904 |
|
34905 |
|
34906 |
|
34907 | View.prototype.getXY = function getXY(item) {
|
34908 | var self = this;
|
34909 | var coord = self.get('coord');
|
34910 | var xScales = self._getScales('x');
|
34911 | var yScales = self._getScales('y');
|
34912 | var x = void 0;
|
34913 | var y = void 0;
|
34914 |
|
34915 | for (var field in item) {
|
34916 | if (xScales[field]) {
|
34917 | x = xScales[field].scale(item[field]);
|
34918 | }
|
34919 | if (yScales[field]) {
|
34920 | y = yScales[field].scale(item[field]);
|
34921 | }
|
34922 | }
|
34923 |
|
34924 | if (!Util.isNil(x) && !Util.isNil(y)) {
|
34925 | return coord.convert({
|
34926 | x: x,
|
34927 | y: y
|
34928 | });
|
34929 | }
|
34930 |
|
34931 | return null;
|
34932 | };
|
34933 |
|
34934 | |
34935 |
|
34936 |
|
34937 |
|
34938 |
|
34939 |
|
34940 |
|
34941 | View.prototype.getSnapRecords = function getSnapRecords(point) {
|
34942 | var self = this;
|
34943 | var geoms = self.get('geoms');
|
34944 | var rst = [];
|
34945 | Util.each(geoms, function (geom) {
|
34946 | var dataArray = geom.get('dataArray');
|
34947 | var record = void 0;
|
34948 | Util.each(dataArray, function (data) {
|
34949 | record = geom.findPoint(point, data);
|
34950 | record && rst.push(record);
|
34951 | });
|
34952 | });
|
34953 | return rst;
|
34954 | };
|
34955 |
|
34956 | |
34957 |
|
34958 |
|
34959 |
|
34960 |
|
34961 |
|
34962 |
|
34963 | View.prototype.addGeom = function addGeom(geom) {
|
34964 | var self = this;
|
34965 | var geoms = self.get('geoms');
|
34966 | geoms.push(geom);
|
34967 | geom.set('view', self);
|
34968 | var container = self.get('viewContainer');
|
34969 | geom.set('container', container);
|
34970 | geom.set('animate', self.get('animate'));
|
34971 | geom.bindEvents();
|
34972 | };
|
34973 |
|
34974 | |
34975 |
|
34976 |
|
34977 |
|
34978 |
|
34979 |
|
34980 |
|
34981 | View.prototype.removeGeom = function removeGeom(geom) {
|
34982 | var geoms = this.get('geoms');
|
34983 | Util.Array.remove(geoms, geom);
|
34984 | geom.destroy();
|
34985 | };
|
34986 |
|
34987 | View.prototype.createScale = function createScale(field, data) {
|
34988 | var scales = this.get('scales');
|
34989 | var parent = this.get('parent');
|
34990 | var scale = scales[field];
|
34991 |
|
34992 | if (!data) {
|
34993 | var filteredData = this.get('filteredData');
|
34994 | var legendFields = this._getFieldsForLegend();
|
34995 |
|
34996 |
|
34997 | if (filteredData.length && legendFields.indexOf(field) === -1) {
|
34998 | data = filteredData;
|
34999 | } else {
|
35000 | data = this.get('data');
|
35001 | }
|
35002 | }
|
35003 | var scaleController = this.get('scaleController');
|
35004 | if (!scale) {
|
35005 | scale = scaleController.createScale(field, data);
|
35006 | if (scale.sync && parent) {
|
35007 | var parentScale = parent.createScale(field, data);
|
35008 | scale = this._getSyncScale(parentScale, scale);
|
35009 | }
|
35010 | scales[field] = scale;
|
35011 | } else if (scale.sync) {
|
35012 |
|
35013 | var newScale = scaleController.createScale(field, data);
|
35014 | this._syncScale(scale, newScale);
|
35015 | }
|
35016 | return scale;
|
35017 | };
|
35018 |
|
35019 | View.prototype._getFieldsForLegend = function _getFieldsForLegend() {
|
35020 | var fields = [];
|
35021 | var geoms = this.get('geoms');
|
35022 | Util.each(geoms, function (geom) {
|
35023 | var geomFields = geom.getFieldsForLegend();
|
35024 | fields = fields.concat(geomFields);
|
35025 | });
|
35026 | return Util.uniq(fields);
|
35027 | };
|
35028 |
|
35029 |
|
35030 |
|
35031 |
|
35032 | View.prototype._getSyncScale = function _getSyncScale(parentScale, scale) {
|
35033 | if (parentScale.type !== scale.type) {
|
35034 | return scale;
|
35035 | }
|
35036 | this._syncScale(parentScale, scale);
|
35037 | return parentScale;
|
35038 | };
|
35039 |
|
35040 | View.prototype._syncScale = function _syncScale(distScale, sourceScale) {
|
35041 | var mergeValues = Util.union(distScale.values, sourceScale.values);
|
35042 | if (sourceScale.isLinear) {
|
35043 | var max = Math.max(distScale.max, sourceScale.max);
|
35044 | var min = Math.min(distScale.min, sourceScale.min);
|
35045 | if (distScale.max !== max || distScale.min !== min) {
|
35046 | distScale.change({
|
35047 | min: min,
|
35048 | max: max,
|
35049 | values: mergeValues
|
35050 | });
|
35051 | }
|
35052 | }
|
35053 |
|
35054 | if (mergeValues.length !== distScale.values.length) {
|
35055 | distScale.change({
|
35056 | values: mergeValues
|
35057 | });
|
35058 | }
|
35059 | };
|
35060 |
|
35061 | View.prototype.getFilteredValues = function getFilteredValues(field) {
|
35062 | var scale = this.get('scales')[field];
|
35063 | var values = scale.values;
|
35064 | var filters = this._getFilters();
|
35065 | var rst = void 0;
|
35066 | if (filters && filters[field]) {
|
35067 | rst = values.filter(filters[field]);
|
35068 | } else {
|
35069 | rst = values.slice(0);
|
35070 | }
|
35071 | return rst;
|
35072 | };
|
35073 |
|
35074 | View.prototype.filter = function filter(field, condition) {
|
35075 | var options = this.get('options');
|
35076 | if (!options.filters) {
|
35077 | options.filters = {};
|
35078 | }
|
35079 | options.filters[field] = condition;
|
35080 | };
|
35081 |
|
35082 |
|
35083 |
|
35084 |
|
35085 | View.prototype._getFilters = function _getFilters() {
|
35086 | var options = this.get('options');
|
35087 | return options.filters;
|
35088 | };
|
35089 |
|
35090 |
|
35091 |
|
35092 |
|
35093 | View.prototype.execFilter = function execFilter(data) {
|
35094 | var self = this;
|
35095 | var filters = self._getFilters();
|
35096 | if (filters) {
|
35097 | data = data.filter(function (obj) {
|
35098 | var rst = true;
|
35099 | Util.each(filters, function (fn, k) {
|
35100 | if (fn) {
|
35101 | rst = fn(obj[k], obj);
|
35102 | if (!rst) {
|
35103 | return false;
|
35104 | }
|
35105 | }
|
35106 | });
|
35107 | return rst;
|
35108 | });
|
35109 | }
|
35110 | return data;
|
35111 | };
|
35112 |
|
35113 | View.prototype.axis = function axis(field, cfg) {
|
35114 | var options = this.get('options');
|
35115 | if (field === false) {
|
35116 | options.axes = false;
|
35117 | } else {
|
35118 | if (!options.axes) {
|
35119 | options.axes = {};
|
35120 | }
|
35121 | var axisOptions = options.axes;
|
35122 | axisOptions[field] = cfg;
|
35123 | }
|
35124 |
|
35125 | return this;
|
35126 | };
|
35127 |
|
35128 | View.prototype.guide = function guide() {
|
35129 | return this.get('guideController');
|
35130 | };
|
35131 |
|
35132 | View.prototype._getKeyFields = function _getKeyFields(scaleDefs) {
|
35133 | var keyFields = [];
|
35134 | Util.each(scaleDefs, function (def, field) {
|
35135 | if (def.key) {
|
35136 | keyFields.push(field);
|
35137 | }
|
35138 | });
|
35139 | this.set('keyFields', keyFields);
|
35140 | };
|
35141 |
|
35142 | View.prototype.scale = function scale(field, cfg) {
|
35143 | var options = this.get('options');
|
35144 | var scaleDefs = options.scales;
|
35145 | if (Util.isObject(field)) {
|
35146 | Util.mix(scaleDefs, field);
|
35147 | } else {
|
35148 | scaleDefs[field] = cfg;
|
35149 | }
|
35150 |
|
35151 | this._getKeyFields(scaleDefs);
|
35152 | return this;
|
35153 | };
|
35154 |
|
35155 | View.prototype.tooltip = function tooltip(visible) {
|
35156 | this.set('tooltipEnable', visible);
|
35157 | return this;
|
35158 | };
|
35159 |
|
35160 | View.prototype.animate = function animate(enable) {
|
35161 | var options = this.get('options');
|
35162 | options.animate = enable;
|
35163 | this.set('animate', enable);
|
35164 | return this;
|
35165 | };
|
35166 |
|
35167 | View.prototype.changeOptions = function changeOptions(options) {
|
35168 | this.set('options', options);
|
35169 | this._initOptions(options);
|
35170 | return this;
|
35171 | };
|
35172 |
|
35173 | |
35174 |
|
35175 |
|
35176 |
|
35177 |
|
35178 |
|
35179 |
|
35180 | View.prototype.getViewsByPoint = function getViewsByPoint(point) {
|
35181 | var rst = [];
|
35182 | var views = this.get('views');
|
35183 |
|
35184 | if (isPointInCoord(this.get('coord'), point)) {
|
35185 | rst.push(this);
|
35186 | }
|
35187 |
|
35188 | Util.each(views, function (view) {
|
35189 | if (view.get('visible') && isPointInCoord(view.get('coord'), point)) {
|
35190 | rst.push(view);
|
35191 | }
|
35192 | });
|
35193 | return rst;
|
35194 | };
|
35195 |
|
35196 | |
35197 |
|
35198 |
|
35199 |
|
35200 |
|
35201 |
|
35202 |
|
35203 | View.prototype.eachShape = function eachShape(fn) {
|
35204 | var self = this;
|
35205 | var views = self.get('views');
|
35206 | var canvas = self.get('canvas');
|
35207 | Util.each(views, function (view) {
|
35208 | view.eachShape(fn);
|
35209 | });
|
35210 | var geoms = this.get('geoms');
|
35211 | Util.each(geoms, function (geom) {
|
35212 | var shapes = geom.getShapes();
|
35213 | Util.each(shapes, function (shape) {
|
35214 | var origin = shape.get('origin');
|
35215 | if (Util.isArray(origin)) {
|
35216 | var arr = origin.map(function (subOrigin) {
|
35217 | return subOrigin[FIELD_ORIGIN];
|
35218 | });
|
35219 | fn(arr, shape, geom, self);
|
35220 | } else {
|
35221 | var obj = origin[FIELD_ORIGIN];
|
35222 | fn(obj, shape, geom, self);
|
35223 | }
|
35224 | });
|
35225 | });
|
35226 | canvas.draw();
|
35227 | return this;
|
35228 | };
|
35229 |
|
35230 | |
35231 |
|
35232 |
|
35233 |
|
35234 |
|
35235 |
|
35236 |
|
35237 | View.prototype.filterShape = function filterShape(fn) {
|
35238 | var callback = function callback(record, shape, geom, view) {
|
35239 | if (!fn(record, shape, geom, view)) {
|
35240 | shape.set('visible', false);
|
35241 | } else {
|
35242 | shape.set('visible', true);
|
35243 | }
|
35244 | };
|
35245 | this.eachShape(callback);
|
35246 | return this;
|
35247 | };
|
35248 |
|
35249 | View.prototype.clearInner = function clearInner() {
|
35250 | this.set('scales', {});
|
35251 | var options = this.get('options');
|
35252 | options.geoms = null;
|
35253 | this._clearGeoms();
|
35254 |
|
35255 | this.get('guideController') && this.get('guideController').reset();
|
35256 |
|
35257 | this.get('axisController') && this.get('axisController').clear();
|
35258 | };
|
35259 |
|
35260 | |
35261 |
|
35262 |
|
35263 |
|
35264 |
|
35265 |
|
35266 | View.prototype.clear = function clear() {
|
35267 | var options = this.get('options');
|
35268 | options.filters = null;
|
35269 | this._removeGeoms();
|
35270 |
|
35271 |
|
35272 | this.clearInner();
|
35273 | this.get('guideController') && this.get('guideController').clear();
|
35274 | this.set('isUpdate', false);
|
35275 | this.set('keyFields', []);
|
35276 | return this;
|
35277 | };
|
35278 |
|
35279 | |
35280 |
|
35281 |
|
35282 |
|
35283 |
|
35284 |
|
35285 |
|
35286 |
|
35287 | View.prototype.coord = function coord(type, cfg) {
|
35288 | var coordController = this.get('coordController');
|
35289 | coordController.reset({
|
35290 | type: type,
|
35291 | cfg: cfg
|
35292 | });
|
35293 | return coordController;
|
35294 | };
|
35295 |
|
35296 | |
35297 |
|
35298 |
|
35299 |
|
35300 |
|
35301 |
|
35302 | View.prototype.resetCoord = function resetCoord() {
|
35303 | this._createCoord();
|
35304 | };
|
35305 |
|
35306 | |
35307 |
|
35308 |
|
35309 |
|
35310 |
|
35311 |
|
35312 | View.prototype.beforeDraw = function beforeDraw() {};
|
35313 |
|
35314 | View.prototype.source = function source(data, scales) {
|
35315 | this._initData(data);
|
35316 | if (scales) {
|
35317 | this.scale(scales);
|
35318 | }
|
35319 | this.emit('setdata');
|
35320 | return this;
|
35321 | };
|
35322 |
|
35323 | View.prototype.changeData = function changeData(data) {
|
35324 | this.emit('beforechangedata');
|
35325 | this._initData(data);
|
35326 | this.emit('afterchangedata');
|
35327 | this.repaint();
|
35328 | return this;
|
35329 | };
|
35330 |
|
35331 | View.prototype._initData = function _initData(data) {
|
35332 | var dataView = this.get('dataView');
|
35333 | if (dataView) {
|
35334 | dataView.off('change', Util.getWrapBehavior(this, '_onViewChange'));
|
35335 | this.set('dataView', null);
|
35336 | }
|
35337 | if (data && data.isDataView) {
|
35338 | data.on('change', Util.wrapBehavior(this, '_onViewChange'));
|
35339 | this.set('dataView', data);
|
35340 | data = data.rows;
|
35341 | }
|
35342 | this.set('data', data);
|
35343 | };
|
35344 |
|
35345 | View.prototype._onViewChange = function _onViewChange() {
|
35346 | this.emit('beforechangedata');
|
35347 | var dataView = this.get('dataView');
|
35348 | var rows = dataView.rows;
|
35349 | this.set('data', rows);
|
35350 | this.emit('afterchangedata');
|
35351 | this.repaint();
|
35352 | };
|
35353 |
|
35354 | View.prototype.render = function render(stopDraw) {
|
35355 | this.emit('beforerender');
|
35356 | var views = this.get('views');
|
35357 | var animate = this.get('animate');
|
35358 |
|
35359 | Util.each(views, function (view) {
|
35360 | view.initView();
|
35361 | });
|
35362 | this.initView();
|
35363 | this.emit('beforepaint');
|
35364 |
|
35365 | Util.each(views, function (view) {
|
35366 | view.paint();
|
35367 | });
|
35368 | this.paint();
|
35369 | this.emit('afterpaint');
|
35370 | if (!stopDraw) {
|
35371 | var backPlot = this.get('backPlot');
|
35372 | backPlot.sort();
|
35373 | var canvas = this.get('canvas');
|
35374 |
|
35375 | if (animate) {
|
35376 | var isUpdate = this.get('isUpdate');
|
35377 | Util.each(views, function (view) {
|
35378 | Animate.execAnimation(view, isUpdate);
|
35379 | });
|
35380 | Animate.execAnimation(this, isUpdate);
|
35381 | } else {
|
35382 | canvas.draw();
|
35383 | }
|
35384 | }
|
35385 | this.emit('afterrender');
|
35386 | return this;
|
35387 | };
|
35388 |
|
35389 | View.prototype.initView = function initView() {
|
35390 | var data = this.get('data') || [];
|
35391 | var filteredData = this.execFilter(data);
|
35392 | this.set('filteredData', filteredData);
|
35393 |
|
35394 | this._createCoord();
|
35395 | this._initGeoms();
|
35396 | this._adjustScale();
|
35397 |
|
35398 | };
|
35399 |
|
35400 | View.prototype.paint = function paint() {
|
35401 | var data = this.get('data');
|
35402 | if (!Util.isEmpty(data)) {
|
35403 | this.beforeDraw();
|
35404 | this._drawGeoms();
|
35405 | this._renderGuides();
|
35406 | }
|
35407 | this._renderAxes();
|
35408 | };
|
35409 |
|
35410 | View.prototype.changeVisible = function changeVisible(visible) {
|
35411 | var geoms = this.get('geoms');
|
35412 | Util.each(geoms, function (geom) {
|
35413 | if (geom.get('visible')) {
|
35414 |
|
35415 | geom.changeVisible(visible, true);
|
35416 | }
|
35417 | });
|
35418 | this.get('axisController') && this.get('axisController').changeVisible(visible);
|
35419 | this.get('guideController') && this.get('guideController').changeVisible(visible);
|
35420 | var canvas = this.get('canvas');
|
35421 |
|
35422 | canvas.draw();
|
35423 | };
|
35424 |
|
35425 | View.prototype.repaint = function repaint() {
|
35426 | this.set('isUpdate', true);
|
35427 | this.clearInner();
|
35428 | this.render();
|
35429 | };
|
35430 |
|
35431 | View.prototype.destroy = function destroy() {
|
35432 | this._clearEvents();
|
35433 | var dataView = this.get('dataView');
|
35434 | dataView && dataView.off('change', Util.getWrapBehavior(this, '_onViewChange'));
|
35435 | this.clear();
|
35436 | _Base.prototype.destroy.call(this);
|
35437 | };
|
35438 |
|
35439 | return View;
|
35440 | }(Base);
|
35441 |
|
35442 | module.exports = View;
|
35443 |
|
35444 | }),
|
35445 |
|
35446 | (function(module, exports, __webpack_require__) {
|
35447 |
|
35448 | var __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
35449 |
|
35450 |
|
35451 |
|
35452 |
|
35453 |
|
35454 |
|
35455 |
|
35456 |
|
35457 | ;(function (exports) {
|
35458 | 'use strict';
|
35459 |
|
35460 | |
35461 |
|
35462 |
|
35463 |
|
35464 |
|
35465 |
|
35466 |
|
35467 | function EventEmitter() {}
|
35468 |
|
35469 |
|
35470 | var proto = EventEmitter.prototype;
|
35471 | var originalGlobalValue = exports.EventEmitter;
|
35472 |
|
35473 | |
35474 |
|
35475 |
|
35476 |
|
35477 |
|
35478 |
|
35479 |
|
35480 |
|
35481 | function indexOfListener(listeners, listener) {
|
35482 | var i = listeners.length;
|
35483 | while (i--) {
|
35484 | if (listeners[i].listener === listener) {
|
35485 | return i;
|
35486 | }
|
35487 | }
|
35488 |
|
35489 | return -1;
|
35490 | }
|
35491 |
|
35492 | |
35493 |
|
35494 |
|
35495 |
|
35496 |
|
35497 |
|
35498 |
|
35499 | function alias(name) {
|
35500 | return function aliasClosure() {
|
35501 | return this[name].apply(this, arguments);
|
35502 | };
|
35503 | }
|
35504 |
|
35505 | |
35506 |
|
35507 |
|
35508 |
|
35509 |
|
35510 |
|
35511 |
|
35512 |
|
35513 |
|
35514 | proto.getListeners = function getListeners(evt) {
|
35515 | var events = this._getEvents();
|
35516 | var response;
|
35517 | var key;
|
35518 |
|
35519 |
|
35520 |
|
35521 | if (evt instanceof RegExp) {
|
35522 | response = {};
|
35523 | for (key in events) {
|
35524 | if (events.hasOwnProperty(key) && evt.test(key)) {
|
35525 | response[key] = events[key];
|
35526 | }
|
35527 | }
|
35528 | } else {
|
35529 | response = events[evt] || (events[evt] = []);
|
35530 | }
|
35531 |
|
35532 | return response;
|
35533 | };
|
35534 |
|
35535 | |
35536 |
|
35537 |
|
35538 |
|
35539 |
|
35540 |
|
35541 | proto.flattenListeners = function flattenListeners(listeners) {
|
35542 | var flatListeners = [];
|
35543 | var i;
|
35544 |
|
35545 | for (i = 0; i < listeners.length; i += 1) {
|
35546 | flatListeners.push(listeners[i].listener);
|
35547 | }
|
35548 |
|
35549 | return flatListeners;
|
35550 | };
|
35551 |
|
35552 | |
35553 |
|
35554 |
|
35555 |
|
35556 |
|
35557 |
|
35558 | proto.getListenersAsObject = function getListenersAsObject(evt) {
|
35559 | var listeners = this.getListeners(evt);
|
35560 | var response;
|
35561 |
|
35562 | if (listeners instanceof Array) {
|
35563 | response = {};
|
35564 | response[evt] = listeners;
|
35565 | }
|
35566 |
|
35567 | return response || listeners;
|
35568 | };
|
35569 |
|
35570 | function isValidListener(listener) {
|
35571 | if (typeof listener === 'function' || listener instanceof RegExp) {
|
35572 | return true;
|
35573 | } else if (listener && (typeof listener === 'undefined' ? 'undefined' : _typeof(listener)) === 'object') {
|
35574 | return isValidListener(listener.listener);
|
35575 | } else {
|
35576 | return false;
|
35577 | }
|
35578 | }
|
35579 |
|
35580 | |
35581 |
|
35582 |
|
35583 |
|
35584 |
|
35585 |
|
35586 |
|
35587 |
|
35588 |
|
35589 |
|
35590 | proto.addListener = function addListener(evt, listener) {
|
35591 | if (!isValidListener(listener)) {
|
35592 | throw new TypeError('listener must be a function');
|
35593 | }
|
35594 |
|
35595 | var listeners = this.getListenersAsObject(evt);
|
35596 | var listenerIsWrapped = (typeof listener === 'undefined' ? 'undefined' : _typeof(listener)) === 'object';
|
35597 | var key;
|
35598 |
|
35599 | for (key in listeners) {
|
35600 | if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
|
35601 | listeners[key].push(listenerIsWrapped ? listener : {
|
35602 | listener: listener,
|
35603 | once: false
|
35604 | });
|
35605 | }
|
35606 | }
|
35607 |
|
35608 | return this;
|
35609 | };
|
35610 |
|
35611 | |
35612 |
|
35613 |
|
35614 | proto.on = alias('addListener');
|
35615 |
|
35616 | |
35617 |
|
35618 |
|
35619 |
|
35620 |
|
35621 |
|
35622 |
|
35623 |
|
35624 | proto.addOnceListener = function addOnceListener(evt, listener) {
|
35625 | return this.addListener(evt, {
|
35626 | listener: listener,
|
35627 | once: true
|
35628 | });
|
35629 | };
|
35630 |
|
35631 | |
35632 |
|
35633 |
|
35634 | proto.once = alias('addOnceListener');
|
35635 |
|
35636 | |
35637 |
|
35638 |
|
35639 |
|
35640 |
|
35641 |
|
35642 |
|
35643 | proto.defineEvent = function defineEvent(evt) {
|
35644 | this.getListeners(evt);
|
35645 | return this;
|
35646 | };
|
35647 |
|
35648 | |
35649 |
|
35650 |
|
35651 |
|
35652 |
|
35653 |
|
35654 | proto.defineEvents = function defineEvents(evts) {
|
35655 | for (var i = 0; i < evts.length; i += 1) {
|
35656 | this.defineEvent(evts[i]);
|
35657 | }
|
35658 | return this;
|
35659 | };
|
35660 |
|
35661 | |
35662 |
|
35663 |
|
35664 |
|
35665 |
|
35666 |
|
35667 |
|
35668 |
|
35669 | proto.removeListener = function removeListener(evt, listener) {
|
35670 | var listeners = this.getListenersAsObject(evt);
|
35671 | var index;
|
35672 | var key;
|
35673 |
|
35674 | for (key in listeners) {
|
35675 | if (listeners.hasOwnProperty(key)) {
|
35676 | index = indexOfListener(listeners[key], listener);
|
35677 |
|
35678 | if (index !== -1) {
|
35679 | listeners[key].splice(index, 1);
|
35680 | }
|
35681 | }
|
35682 | }
|
35683 |
|
35684 | return this;
|
35685 | };
|
35686 |
|
35687 | |
35688 |
|
35689 |
|
35690 | proto.off = alias('removeListener');
|
35691 |
|
35692 | |
35693 |
|
35694 |
|
35695 |
|
35696 |
|
35697 |
|
35698 |
|
35699 |
|
35700 |
|
35701 |
|
35702 | proto.addListeners = function addListeners(evt, listeners) {
|
35703 |
|
35704 | return this.manipulateListeners(false, evt, listeners);
|
35705 | };
|
35706 |
|
35707 | |
35708 |
|
35709 |
|
35710 |
|
35711 |
|
35712 |
|
35713 |
|
35714 |
|
35715 |
|
35716 |
|
35717 | proto.removeListeners = function removeListeners(evt, listeners) {
|
35718 |
|
35719 | return this.manipulateListeners(true, evt, listeners);
|
35720 | };
|
35721 |
|
35722 | |
35723 |
|
35724 |
|
35725 |
|
35726 |
|
35727 |
|
35728 |
|
35729 |
|
35730 |
|
35731 |
|
35732 |
|
35733 |
|
35734 | proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
|
35735 | var i;
|
35736 | var value;
|
35737 | var single = remove ? this.removeListener : this.addListener;
|
35738 | var multiple = remove ? this.removeListeners : this.addListeners;
|
35739 |
|
35740 |
|
35741 | if ((typeof evt === 'undefined' ? 'undefined' : _typeof(evt)) === 'object' && !(evt instanceof RegExp)) {
|
35742 | for (i in evt) {
|
35743 | if (evt.hasOwnProperty(i) && (value = evt[i])) {
|
35744 |
|
35745 | if (typeof value === 'function') {
|
35746 | single.call(this, i, value);
|
35747 | } else {
|
35748 |
|
35749 | multiple.call(this, i, value);
|
35750 | }
|
35751 | }
|
35752 | }
|
35753 | } else {
|
35754 |
|
35755 |
|
35756 |
|
35757 | i = listeners.length;
|
35758 | while (i--) {
|
35759 | single.call(this, evt, listeners[i]);
|
35760 | }
|
35761 | }
|
35762 |
|
35763 | return this;
|
35764 | };
|
35765 |
|
35766 | |
35767 |
|
35768 |
|
35769 |
|
35770 |
|
35771 |
|
35772 |
|
35773 |
|
35774 |
|
35775 | proto.removeEvent = function removeEvent(evt) {
|
35776 | var type = typeof evt === 'undefined' ? 'undefined' : _typeof(evt);
|
35777 | var events = this._getEvents();
|
35778 | var key;
|
35779 |
|
35780 |
|
35781 | if (type === 'string') {
|
35782 |
|
35783 | delete events[evt];
|
35784 | } else if (evt instanceof RegExp) {
|
35785 |
|
35786 | for (key in events) {
|
35787 | if (events.hasOwnProperty(key) && evt.test(key)) {
|
35788 | delete events[key];
|
35789 | }
|
35790 | }
|
35791 | } else {
|
35792 |
|
35793 | delete this._events;
|
35794 | }
|
35795 |
|
35796 | return this;
|
35797 | };
|
35798 |
|
35799 | |
35800 |
|
35801 |
|
35802 |
|
35803 |
|
35804 | proto.removeAllListeners = alias('removeEvent');
|
35805 |
|
35806 | |
35807 |
|
35808 |
|
35809 |
|
35810 |
|
35811 |
|
35812 |
|
35813 |
|
35814 |
|
35815 |
|
35816 |
|
35817 |
|
35818 | proto.emitEvent = function emitEvent(evt, args) {
|
35819 | var listenersMap = this.getListenersAsObject(evt);
|
35820 | var listeners;
|
35821 | var listener;
|
35822 | var i;
|
35823 | var key;
|
35824 | var response;
|
35825 |
|
35826 | for (key in listenersMap) {
|
35827 | if (listenersMap.hasOwnProperty(key)) {
|
35828 | listeners = listenersMap[key].slice(0);
|
35829 |
|
35830 | for (i = 0; i < listeners.length; i++) {
|
35831 |
|
35832 |
|
35833 | listener = listeners[i];
|
35834 |
|
35835 | if (listener.once === true) {
|
35836 | this.removeListener(evt, listener.listener);
|
35837 | }
|
35838 |
|
35839 | response = listener.listener.apply(this, args || []);
|
35840 |
|
35841 | if (response === this._getOnceReturnValue()) {
|
35842 | this.removeListener(evt, listener.listener);
|
35843 | }
|
35844 | }
|
35845 | }
|
35846 | }
|
35847 |
|
35848 | return this;
|
35849 | };
|
35850 |
|
35851 | |
35852 |
|
35853 |
|
35854 | proto.trigger = alias('emitEvent');
|
35855 |
|
35856 | |
35857 |
|
35858 |
|
35859 |
|
35860 |
|
35861 |
|
35862 |
|
35863 |
|
35864 | proto.emit = function emit(evt) {
|
35865 | var args = Array.prototype.slice.call(arguments, 1);
|
35866 | return this.emitEvent(evt, args);
|
35867 | };
|
35868 |
|
35869 | |
35870 |
|
35871 |
|
35872 |
|
35873 |
|
35874 |
|
35875 |
|
35876 |
|
35877 | proto.setOnceReturnValue = function setOnceReturnValue(value) {
|
35878 | this._onceReturnValue = value;
|
35879 | return this;
|
35880 | };
|
35881 |
|
35882 | |
35883 |
|
35884 |
|
35885 |
|
35886 |
|
35887 |
|
35888 |
|
35889 |
|
35890 | proto._getOnceReturnValue = function _getOnceReturnValue() {
|
35891 | if (this.hasOwnProperty('_onceReturnValue')) {
|
35892 | return this._onceReturnValue;
|
35893 | } else {
|
35894 | return true;
|
35895 | }
|
35896 | };
|
35897 |
|
35898 | |
35899 |
|
35900 |
|
35901 |
|
35902 |
|
35903 |
|
35904 | proto._getEvents = function _getEvents() {
|
35905 | return this._events || (this._events = {});
|
35906 | };
|
35907 |
|
35908 | |
35909 |
|
35910 |
|
35911 |
|
35912 |
|
35913 | EventEmitter.noConflict = function noConflict() {
|
35914 | exports.EventEmitter = originalGlobalValue;
|
35915 | return EventEmitter;
|
35916 | };
|
35917 |
|
35918 |
|
35919 | if (true) {
|
35920 | !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
|
35921 | return EventEmitter;
|
35922 | }).call(exports, __webpack_require__, exports, module),
|
35923 | __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
35924 | } else if ((typeof module === 'undefined' ? 'undefined' : _typeof(module)) === 'object' && module.exports) {
|
35925 | module.exports = EventEmitter;
|
35926 | } else {
|
35927 | exports.EventEmitter = EventEmitter;
|
35928 | }
|
35929 | })(this || {});
|
35930 |
|
35931 | }),
|
35932 |
|
35933 | (function(module, exports, __webpack_require__) {
|
35934 |
|
35935 |
|
35936 | var Geom = __webpack_require__(9);
|
35937 | Geom.Point = __webpack_require__(313);
|
35938 | Geom.PointJitter = Geom.Point.Jitter;
|
35939 | Geom.Path = __webpack_require__(112);
|
35940 | Geom.Line = __webpack_require__(314);
|
35941 | Geom.LineStack = Geom.Line.Stack;
|
35942 | Geom.Interval = __webpack_require__(315);
|
35943 | Geom.IntervalStack = Geom.Interval.Stack;
|
35944 | Geom.IntervalDodge = Geom.Interval.Dodge;
|
35945 | Geom.IntervalSymmetric = Geom.Interval.Symmetric;
|
35946 |
|
35947 | Geom.Area = __webpack_require__(316);
|
35948 | Geom.AreaStack = Geom.Area.Stack;
|
35949 | Geom.Polygon = __webpack_require__(317);
|
35950 | Geom.Schema = __webpack_require__(318);
|
35951 | Geom.SchemaDodge = Geom.Schema.Dodge;
|
35952 | Geom.Edge = __webpack_require__(319);
|
35953 | Geom.Heatmap = __webpack_require__(320);
|
35954 |
|
35955 | module.exports = Geom;
|
35956 |
|
35957 | }),
|
35958 |
|
35959 | (function(module, exports, __webpack_require__) {
|
35960 |
|
35961 |
|
35962 | var Base = __webpack_require__(16);
|
35963 | Base.Color = __webpack_require__(287);
|
35964 | Base.Size = __webpack_require__(288);
|
35965 | Base.Opacity = __webpack_require__(289);
|
35966 | Base.Shape = __webpack_require__(290);
|
35967 | Base.Position = __webpack_require__(291);
|
35968 | module.exports = Base;
|
35969 |
|
35970 | }),
|
35971 |
|
35972 | (function(module, exports, __webpack_require__) {
|
35973 |
|
35974 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35975 |
|
35976 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
35977 |
|
35978 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
35979 |
|
35980 |
|
35981 |
|
35982 |
|
35983 |
|
35984 |
|
35985 | var ColorUtil = __webpack_require__(64);
|
35986 | var Base = __webpack_require__(16);
|
35987 | var Util = __webpack_require__(0);
|
35988 |
|
35989 |
|
35990 |
|
35991 |
|
35992 |
|
35993 |
|
35994 | var Color = function (_Base) {
|
35995 | _inherits(Color, _Base);
|
35996 |
|
35997 | function Color(cfg) {
|
35998 | _classCallCheck(this, Color);
|
35999 |
|
36000 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
36001 |
|
36002 | _this.names = ['color'];
|
36003 | _this.type = 'color';
|
36004 | _this.gradient = null;
|
36005 | if (Util.isString(_this.values)) {
|
36006 | _this.linear = true;
|
36007 | }
|
36008 | return _this;
|
36009 | }
|
36010 |
|
36011 | |
36012 |
|
36013 |
|
36014 |
|
36015 |
|
36016 | Color.prototype.getLinearValue = function getLinearValue(percent) {
|
36017 | var gradient = this.gradient;
|
36018 | if (!gradient) {
|
36019 | var values = this.values;
|
36020 | gradient = ColorUtil.gradient(values);
|
36021 | this.gradient = gradient;
|
36022 | }
|
36023 | return gradient(percent);
|
36024 | };
|
36025 |
|
36026 | return Color;
|
36027 | }(Base);
|
36028 |
|
36029 | module.exports = Color;
|
36030 |
|
36031 | }),
|
36032 |
|
36033 | (function(module, exports, __webpack_require__) {
|
36034 |
|
36035 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36036 |
|
36037 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
36038 |
|
36039 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
36040 |
|
36041 |
|
36042 |
|
36043 |
|
36044 |
|
36045 |
|
36046 | var Base = __webpack_require__(16);
|
36047 |
|
36048 |
|
36049 |
|
36050 |
|
36051 |
|
36052 |
|
36053 | var Size = function (_Base) {
|
36054 | _inherits(Size, _Base);
|
36055 |
|
36056 | function Size(cfg) {
|
36057 | _classCallCheck(this, Size);
|
36058 |
|
36059 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
36060 |
|
36061 | _this.names = ['size'];
|
36062 | _this.type = 'size';
|
36063 | _this.gradient = null;
|
36064 | return _this;
|
36065 | }
|
36066 |
|
36067 | return Size;
|
36068 | }(Base);
|
36069 |
|
36070 | module.exports = Size;
|
36071 |
|
36072 | }),
|
36073 |
|
36074 | (function(module, exports, __webpack_require__) {
|
36075 |
|
36076 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36077 |
|
36078 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
36079 |
|
36080 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
36081 |
|
36082 |
|
36083 |
|
36084 |
|
36085 |
|
36086 |
|
36087 | var Base = __webpack_require__(16);
|
36088 |
|
36089 |
|
36090 |
|
36091 |
|
36092 |
|
36093 |
|
36094 | var Opacity = function (_Base) {
|
36095 | _inherits(Opacity, _Base);
|
36096 |
|
36097 | function Opacity(cfg) {
|
36098 | _classCallCheck(this, Opacity);
|
36099 |
|
36100 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
36101 |
|
36102 | _this.names = ['opacity'];
|
36103 | _this.type = 'opacity';
|
36104 | _this.gradient = null;
|
36105 | return _this;
|
36106 | }
|
36107 |
|
36108 | return Opacity;
|
36109 | }(Base);
|
36110 |
|
36111 | module.exports = Opacity;
|
36112 |
|
36113 | }),
|
36114 |
|
36115 | (function(module, exports, __webpack_require__) {
|
36116 |
|
36117 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36118 |
|
36119 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
36120 |
|
36121 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
36122 |
|
36123 |
|
36124 |
|
36125 |
|
36126 |
|
36127 |
|
36128 | var Base = __webpack_require__(16);
|
36129 |
|
36130 |
|
36131 |
|
36132 |
|
36133 |
|
36134 |
|
36135 | var Shape = function (_Base) {
|
36136 | _inherits(Shape, _Base);
|
36137 |
|
36138 | function Shape(cfg) {
|
36139 | _classCallCheck(this, Shape);
|
36140 |
|
36141 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
36142 |
|
36143 | _this.names = ['shape'];
|
36144 | _this.type = 'shape';
|
36145 | _this.gradient = null;
|
36146 | return _this;
|
36147 | }
|
36148 |
|
36149 | |
36150 |
|
36151 |
|
36152 |
|
36153 |
|
36154 | Shape.prototype.getLinearValue = function getLinearValue(percent) {
|
36155 | var values = this.values;
|
36156 | var index = Math.round((values.length - 1) * percent);
|
36157 | return values[index];
|
36158 | };
|
36159 |
|
36160 | return Shape;
|
36161 | }(Base);
|
36162 |
|
36163 | module.exports = Shape;
|
36164 |
|
36165 | }),
|
36166 |
|
36167 | (function(module, exports, __webpack_require__) {
|
36168 |
|
36169 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36170 |
|
36171 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
36172 |
|
36173 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
36174 |
|
36175 |
|
36176 |
|
36177 |
|
36178 |
|
36179 |
|
36180 | var Util = __webpack_require__(0);
|
36181 | var Base = __webpack_require__(16);
|
36182 |
|
36183 | var Position = function (_Base) {
|
36184 | _inherits(Position, _Base);
|
36185 |
|
36186 | function Position(cfg) {
|
36187 | _classCallCheck(this, Position);
|
36188 |
|
36189 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
36190 |
|
36191 | _this.names = ['x', 'y'];
|
36192 | _this.type = 'position';
|
36193 | return _this;
|
36194 | }
|
36195 |
|
36196 | Position.prototype.mapping = function mapping(x, y) {
|
36197 | var scales = this.scales;
|
36198 | var coord = this.coord;
|
36199 | var scaleX = scales[0];
|
36200 | var scaleY = scales[1];
|
36201 | var rstX = void 0;
|
36202 | var rstY = void 0;
|
36203 | var obj = void 0;
|
36204 | if (Util.isNil(x) || Util.isNil(y)) {
|
36205 | return [];
|
36206 | }
|
36207 | if (Util.isArray(y) && Util.isArray(x)) {
|
36208 | rstX = [];
|
36209 | rstY = [];
|
36210 | for (var i = 0, j = 0; i < x.length && j < y.length; i++, j++) {
|
36211 | obj = coord.convertPoint({
|
36212 | x: scaleX.scale(x[i]),
|
36213 | y: scaleY.scale(y[j])
|
36214 | });
|
36215 | rstX.push(obj.x);
|
36216 | rstY.push(obj.y);
|
36217 | }
|
36218 | } else if (Util.isArray(y)) {
|
36219 | x = scaleX.scale(x);
|
36220 | rstY = [];
|
36221 | Util.each(y, function (yVal) {
|
36222 | yVal = scaleY.scale(yVal);
|
36223 | obj = coord.convertPoint({
|
36224 | x: x,
|
36225 | y: yVal
|
36226 | });
|
36227 | if (rstX && rstX !== obj.x) {
|
36228 | if (!Util.isArray(rstX)) {
|
36229 | rstX = [rstX];
|
36230 | }
|
36231 | rstX.push(obj.x);
|
36232 | } else {
|
36233 | rstX = obj.x;
|
36234 | }
|
36235 | rstY.push(obj.y);
|
36236 | });
|
36237 | } else if (Util.isArray(x)) {
|
36238 | y = scaleY.scale(y);
|
36239 | rstX = [];
|
36240 | Util.each(x, function (xVal) {
|
36241 | xVal = scaleX.scale(xVal);
|
36242 | obj = coord.convertPoint({
|
36243 | x: xVal,
|
36244 | y: y
|
36245 | });
|
36246 | if (rstY && rstY !== obj.y) {
|
36247 | if (!Util.isArray(rstY)) {
|
36248 | rstY = [rstY];
|
36249 | }
|
36250 | rstY.push(obj.y);
|
36251 | } else {
|
36252 | rstY = obj.y;
|
36253 | }
|
36254 | rstX.push(obj.x);
|
36255 | });
|
36256 | } else {
|
36257 | x = scaleX.scale(x);
|
36258 | y = scaleY.scale(y);
|
36259 | var point = coord.convertPoint({
|
36260 | x: x,
|
36261 | y: y
|
36262 | });
|
36263 | rstX = point.x;
|
36264 | rstY = point.y;
|
36265 | }
|
36266 | return [rstX, rstY];
|
36267 | };
|
36268 |
|
36269 | return Position;
|
36270 | }(Base);
|
36271 |
|
36272 | module.exports = Position;
|
36273 |
|
36274 | }),
|
36275 |
|
36276 | (function(module, exports, __webpack_require__) {
|
36277 |
|
36278 |
|
36279 |
|
36280 |
|
36281 |
|
36282 | var Theme = {
|
36283 | default: __webpack_require__(108),
|
36284 | dark: __webpack_require__(293)
|
36285 | };
|
36286 |
|
36287 | module.exports = Theme;
|
36288 |
|
36289 | }),
|
36290 |
|
36291 | (function(module, exports, __webpack_require__) {
|
36292 |
|
36293 | var _html, _tooltip;
|
36294 |
|
36295 |
|
36296 |
|
36297 |
|
36298 |
|
36299 | var Util = __webpack_require__(0);
|
36300 | var BasicTheme = __webpack_require__(108);
|
36301 |
|
36302 |
|
36303 | var TOOLTIP_CONTAINER_CLASS = 'g2-tooltip';
|
36304 | var LEGEND_CONTAINER_CLASS = 'g2-legend';
|
36305 |
|
36306 | var DarkTheme = Util.deepMix({}, BasicTheme, {
|
36307 | background: {
|
36308 | fill: '#1F1F1F',
|
36309 | radius: 2
|
36310 | },
|
36311 | plotBackground: {
|
36312 | fill: '#1F1F1F'
|
36313 | },
|
36314 | axis: {
|
36315 | top: {
|
36316 | label: {
|
36317 | textStyle: {
|
36318 | fill: '#A6A6A6'
|
36319 | }
|
36320 | },
|
36321 | line: {
|
36322 | stroke: '#737373'
|
36323 | },
|
36324 | tickLine: {
|
36325 | stroke: '#737373'
|
36326 | }
|
36327 | },
|
36328 | bottom: {
|
36329 | label: {
|
36330 | textStyle: {
|
36331 | fill: '#A6A6A6'
|
36332 | }
|
36333 | },
|
36334 | line: {
|
36335 | stroke: '#737373'
|
36336 | },
|
36337 | tickLine: {
|
36338 | stroke: '#737373'
|
36339 | }
|
36340 | },
|
36341 | left: {
|
36342 | label: {
|
36343 | textStyle: {
|
36344 | fill: '#A6A6A6'
|
36345 | }
|
36346 | },
|
36347 | grid: {
|
36348 | lineStyle: {
|
36349 | stroke: '#404040'
|
36350 | }
|
36351 | }
|
36352 | },
|
36353 | right: {
|
36354 | label: {
|
36355 | textStyle: {
|
36356 | fill: '#A6A6A6'
|
36357 | }
|
36358 | },
|
36359 | grid: {
|
36360 | lineStyle: {
|
36361 | stroke: '#404040'
|
36362 | }
|
36363 | }
|
36364 | },
|
36365 | circle: {
|
36366 | label: {
|
36367 | textStyle: {
|
36368 | fill: '#A6A6A6'
|
36369 | }
|
36370 | },
|
36371 | line: {
|
36372 | stroke: '#737373'
|
36373 | },
|
36374 | tickLine: {
|
36375 | stroke: '#737373'
|
36376 | },
|
36377 | grid: {
|
36378 | lineStyle: {
|
36379 | stroke: '#404040'
|
36380 | }
|
36381 | }
|
36382 | },
|
36383 | radius: {
|
36384 | label: {
|
36385 | textStyle: {
|
36386 | fill: '#A6A6A6'
|
36387 | }
|
36388 | },
|
36389 | line: {
|
36390 | stroke: '#737373'
|
36391 | },
|
36392 | tickLine: {
|
36393 | stroke: '#737373'
|
36394 | },
|
36395 | grid: {
|
36396 | lineStyle: {
|
36397 | stroke: '#404040'
|
36398 | }
|
36399 | }
|
36400 | },
|
36401 | helix: {
|
36402 | line: {
|
36403 | stroke: '#737373'
|
36404 | },
|
36405 | tickLine: {
|
36406 | stroke: '#737373'
|
36407 | }
|
36408 | }
|
36409 | },
|
36410 | label: {
|
36411 | textStyle: {
|
36412 | fill: '#A6A6A6'
|
36413 | }
|
36414 | },
|
36415 | legend: {
|
36416 | right: {
|
36417 | textStyle: {
|
36418 | fill: '#737373'
|
36419 | },
|
36420 | unCheckColor: '#bfbfbf'
|
36421 | },
|
36422 | left: {
|
36423 | textStyle: {
|
36424 | fill: '#737373'
|
36425 | },
|
36426 | unCheckColor: '#bfbfbf'
|
36427 | },
|
36428 | top: {
|
36429 | textStyle: {
|
36430 | fill: '#737373'
|
36431 | },
|
36432 | unCheckColor: '#bfbfbf'
|
36433 | },
|
36434 | bottom: {
|
36435 | textStyle: {
|
36436 | fill: '#737373'
|
36437 | },
|
36438 | unCheckColor: '#bfbfbf'
|
36439 | },
|
36440 | html: (_html = {}, _html['' + LEGEND_CONTAINER_CLASS] = {
|
36441 | color: '#D9D9D9'
|
36442 | }, _html),
|
36443 | gradient: {
|
36444 | textStyle: {
|
36445 | fill: '#D9D9D9'
|
36446 | },
|
36447 | lineStyle: {
|
36448 | stroke: '#404040'
|
36449 | }
|
36450 | }
|
36451 | },
|
36452 | tooltip: (_tooltip = {}, _tooltip['' + TOOLTIP_CONTAINER_CLASS] = {
|
36453 | color: '#D9D9D9'
|
36454 | }, _tooltip),
|
36455 | tooltipCrosshairsRect: {
|
36456 | type: 'rect',
|
36457 | style: {
|
36458 | fill: '#fff',
|
36459 | opacity: 0.1
|
36460 | }
|
36461 | },
|
36462 | tooltipCrosshairsLine: {
|
36463 | style: {
|
36464 | stroke: 'rgba(255, 255, 255, 0.45)'
|
36465 | }
|
36466 | },
|
36467 | guide: {
|
36468 | line: {
|
36469 | text: {
|
36470 | style: {
|
36471 | fill: '#A6A6A6'
|
36472 | }
|
36473 | }
|
36474 | },
|
36475 | text: {
|
36476 | style: {
|
36477 | fill: '#A6A6A6'
|
36478 | }
|
36479 | },
|
36480 | region: {
|
36481 |
|
36482 | style: {
|
36483 | lineWidth: 0,
|
36484 | fill: '#000',
|
36485 | fillOpacity: 0.04
|
36486 |
|
36487 | } }
|
36488 | }
|
36489 | });
|
36490 |
|
36491 | module.exports = DarkTheme;
|
36492 |
|
36493 | }),
|
36494 |
|
36495 | (function(module, exports, __webpack_require__) {
|
36496 |
|
36497 |
|
36498 | var Adjust = __webpack_require__(24);
|
36499 | Adjust.Stack = __webpack_require__(295);
|
36500 | Adjust.Jitter = __webpack_require__(296);
|
36501 | Adjust.Symmetric = __webpack_require__(297);
|
36502 | Adjust.Dodge = __webpack_require__(298);
|
36503 |
|
36504 | module.exports = Adjust;
|
36505 |
|
36506 | }),
|
36507 |
|
36508 | (function(module, exports, __webpack_require__) {
|
36509 |
|
36510 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36511 |
|
36512 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
36513 |
|
36514 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
36515 |
|
36516 |
|
36517 |
|
36518 |
|
36519 |
|
36520 |
|
36521 | var Util = __webpack_require__(0);
|
36522 | var Adjust = __webpack_require__(24);
|
36523 |
|
36524 |
|
36525 |
|
36526 |
|
36527 |
|
36528 |
|
36529 | var Stack = function (_Adjust) {
|
36530 | _inherits(Stack, _Adjust);
|
36531 |
|
36532 | function Stack() {
|
36533 | _classCallCheck(this, Stack);
|
36534 |
|
36535 | return _possibleConstructorReturn(this, _Adjust.apply(this, arguments));
|
36536 | }
|
36537 |
|
36538 | |
36539 |
|
36540 |
|
36541 | Stack.prototype.getDefaultCfg = function getDefaultCfg() {
|
36542 | var cfg = _Adjust.prototype.getDefaultCfg.call(this);
|
36543 | return Util.assign(cfg, {
|
36544 | |
36545 |
|
36546 |
|
36547 |
|
36548 | height: null,
|
36549 | |
36550 |
|
36551 |
|
36552 |
|
36553 | size: 10,
|
36554 | |
36555 |
|
36556 |
|
36557 |
|
36558 | reverseOrder: false,
|
36559 |
|
36560 | |
36561 |
|
36562 |
|
36563 | adjustNames: ['y']
|
36564 | });
|
36565 | };
|
36566 |
|
36567 | Stack.prototype.processOneDimStack = function processOneDimStack(dataArray) {
|
36568 | var self = this;
|
36569 | var xField = self.xField;
|
36570 | var yField = self.yField || 'y';
|
36571 | var height = self.height;
|
36572 |
|
36573 | var stackY = {};
|
36574 |
|
36575 | if (self.reverseOrder) {
|
36576 | dataArray = dataArray.slice(0).reverse();
|
36577 | }
|
36578 | for (var i = 0; i < dataArray.length; i++) {
|
36579 |
|
36580 | var data = dataArray[i];
|
36581 |
|
36582 | for (var j = 0; j < data.length; j++) {
|
36583 | var item = data[j];
|
36584 | var size = item.size || self.size;
|
36585 | var stackHeight = size * 2 / height;
|
36586 | var x = item[xField];
|
36587 | if (!stackY[x]) {
|
36588 | stackY[x] = stackHeight / 2;
|
36589 | }
|
36590 | item[yField] = stackY[x];
|
36591 | stackY[x] += stackHeight;
|
36592 | }
|
36593 | }
|
36594 | };
|
36595 |
|
36596 | Stack.prototype.processAdjust = function processAdjust(dataArray) {
|
36597 | var self = this;
|
36598 | if (self.yField) {
|
36599 | self.processStack(dataArray);
|
36600 | } else {
|
36601 | self.processOneDimStack(dataArray);
|
36602 | }
|
36603 | };
|
36604 |
|
36605 | Stack.prototype.processStack = function processStack(dataArray) {
|
36606 | var self = this;
|
36607 | var xField = self.xField;
|
36608 | var yField = self.yField;
|
36609 | var count = dataArray.length;
|
36610 | var stackCache = {
|
36611 | positive: {},
|
36612 | negative: {}
|
36613 | };
|
36614 |
|
36615 | if (self.reverseOrder) {
|
36616 | dataArray = dataArray.slice(0).reverse();
|
36617 | }
|
36618 | for (var i = 0; i < count; i++) {
|
36619 | var data = dataArray[i];
|
36620 | for (var j = 0; j < data.length; j++) {
|
36621 | var item = data[j];
|
36622 | var x = item[xField] || 0;
|
36623 | var y = item[yField] || 0;
|
36624 | var xkey = x.toString();
|
36625 | y = Util.isArray(y) ? y[1] : y;
|
36626 | var direction = y >= 0 ? 'positive' : 'negative';
|
36627 | if (!stackCache[direction][xkey]) {
|
36628 | stackCache[direction][xkey] = 0;
|
36629 | }
|
36630 | item[yField] = [stackCache[direction][xkey], y + stackCache[direction][xkey]];
|
36631 | stackCache[direction][xkey] += y;
|
36632 | }
|
36633 | }
|
36634 | };
|
36635 |
|
36636 | return Stack;
|
36637 | }(Adjust);
|
36638 |
|
36639 | module.exports = Stack;
|
36640 |
|
36641 | }),
|
36642 |
|
36643 | (function(module, exports, __webpack_require__) {
|
36644 |
|
36645 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36646 |
|
36647 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
36648 |
|
36649 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
36650 |
|
36651 |
|
36652 |
|
36653 |
|
36654 |
|
36655 |
|
36656 |
|
36657 | var Util = __webpack_require__(0);
|
36658 | var Adjust = __webpack_require__(24);
|
36659 |
|
36660 |
|
36661 |
|
36662 |
|
36663 |
|
36664 |
|
36665 | var Jitter = function (_Adjust) {
|
36666 | _inherits(Jitter, _Adjust);
|
36667 |
|
36668 | function Jitter() {
|
36669 | _classCallCheck(this, Jitter);
|
36670 |
|
36671 | return _possibleConstructorReturn(this, _Adjust.apply(this, arguments));
|
36672 | }
|
36673 |
|
36674 | Jitter.prototype.getAdjustOffset = function getAdjustOffset(pre, next) {
|
36675 | var r = Math.random();
|
36676 | var avg = next - pre;
|
36677 | var append = avg * 0.05;
|
36678 | return pre + append + avg * 0.9 * r;
|
36679 | };
|
36680 |
|
36681 |
|
36682 |
|
36683 |
|
36684 | Jitter.prototype._adjustGroup = function _adjustGroup(group, dim, key, values) {
|
36685 | var self = this;
|
36686 | var range = self.getAdjustRange(dim, key, values);
|
36687 |
|
36688 | Util.each(group, function (record) {
|
36689 | record[dim] = self.getAdjustOffset(range.pre, range.next);
|
36690 | });
|
36691 | };
|
36692 |
|
36693 | Jitter.prototype.adjustDim = function adjustDim(dim, values, data) {
|
36694 | var self = this;
|
36695 | var groupData = self.groupData(data, dim);
|
36696 | Util.each(groupData, function (group, key) {
|
36697 | key = parseFloat(key);
|
36698 | self._adjustGroup(group, dim, key, values);
|
36699 | });
|
36700 | };
|
36701 |
|
36702 | return Jitter;
|
36703 | }(Adjust);
|
36704 |
|
36705 | module.exports = Jitter;
|
36706 |
|
36707 | }),
|
36708 |
|
36709 | (function(module, exports, __webpack_require__) {
|
36710 |
|
36711 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36712 |
|
36713 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
36714 |
|
36715 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
36716 |
|
36717 |
|
36718 |
|
36719 |
|
36720 |
|
36721 |
|
36722 | var Util = __webpack_require__(0);
|
36723 | var Adjust = __webpack_require__(24);
|
36724 |
|
36725 |
|
36726 |
|
36727 |
|
36728 |
|
36729 |
|
36730 | var Symmetric = function (_Adjust) {
|
36731 | _inherits(Symmetric, _Adjust);
|
36732 |
|
36733 | function Symmetric() {
|
36734 | _classCallCheck(this, Symmetric);
|
36735 |
|
36736 | return _possibleConstructorReturn(this, _Adjust.apply(this, arguments));
|
36737 | }
|
36738 |
|
36739 | |
36740 |
|
36741 |
|
36742 | Symmetric.prototype.getDefaultCfg = function getDefaultCfg() {
|
36743 | var cfg = _Adjust.prototype.getDefaultCfg.call(this);
|
36744 | return Util.assign(cfg, {
|
36745 |
|
36746 | cacheMax: null,
|
36747 | |
36748 |
|
36749 |
|
36750 | adjustNames: ['y']
|
36751 | });
|
36752 | };
|
36753 |
|
36754 |
|
36755 |
|
36756 | Symmetric.prototype._getMax = function _getMax(dim) {
|
36757 | var self = this;
|
36758 | var mergeData = self.mergeData;
|
36759 | var maxRecord = Util.maxBy(mergeData, function (obj) {
|
36760 | var value = obj[dim];
|
36761 | if (Util.isArray(value)) {
|
36762 | return Math.max.apply(null, value);
|
36763 | }
|
36764 | return value;
|
36765 | });
|
36766 | var maxValue = maxRecord[dim];
|
36767 | var max = Util.isArray(maxValue) ? Math.max.apply(null, maxValue) : maxValue;
|
36768 | return max;
|
36769 | };
|
36770 |
|
36771 |
|
36772 |
|
36773 |
|
36774 | Symmetric.prototype._getXValuesMax = function _getXValuesMax() {
|
36775 | var self = this;
|
36776 | var yField = self.yField;
|
36777 | var xField = self.xField;
|
36778 | var cache = {};
|
36779 | var mergeData = self.mergeData;
|
36780 | Util.each(mergeData, function (obj) {
|
36781 | var xValue = obj[xField];
|
36782 | var yValue = obj[yField];
|
36783 | var max = Util.isArray(yValue) ? Math.max.apply(null, yValue) : yValue;
|
36784 | cache[xValue] = cache[xValue] || 0;
|
36785 | if (cache[xValue] < max) {
|
36786 | cache[xValue] = max;
|
36787 | }
|
36788 | });
|
36789 | return cache;
|
36790 | };
|
36791 |
|
36792 |
|
36793 |
|
36794 |
|
36795 | Symmetric.prototype.processAdjust = function processAdjust(dataArray) {
|
36796 | var self = this;
|
36797 | var mergeData = Util.Array.merge(dataArray);
|
36798 | self.mergeData = mergeData;
|
36799 | self._processSymmetric(dataArray);
|
36800 | self.mergeData = null;
|
36801 | };
|
36802 |
|
36803 |
|
36804 |
|
36805 |
|
36806 | Symmetric.prototype._processSymmetric = function _processSymmetric(dataArray) {
|
36807 | var self = this;
|
36808 | var xField = self.xField;
|
36809 | var yField = self.yField;
|
36810 | var max = self._getMax(yField);
|
36811 | var first = dataArray[0][0];
|
36812 |
|
36813 | var cache = void 0;
|
36814 | if (first && Util.isArray(first[yField])) {
|
36815 | cache = self._getXValuesMax();
|
36816 | }
|
36817 | Util.each(dataArray, function (data) {
|
36818 | Util.each(data, function (obj) {
|
36819 | var value = obj[yField];
|
36820 | var offset = void 0;
|
36821 | if (Util.isArray(value)) {
|
36822 | var xValue = obj[xField];
|
36823 | var valueMax = cache[xValue];
|
36824 | offset = (max - valueMax) / 2;
|
36825 | var tmp = [];
|
36826 |
|
36827 | Util.each(value, function (subVal) {
|
36828 |
|
36829 | tmp.push(offset + subVal);
|
36830 | });
|
36831 |
|
36832 | obj[yField] = tmp;
|
36833 | } else {
|
36834 | offset = (max - value) / 2;
|
36835 | obj[yField] = [offset, value + offset];
|
36836 | }
|
36837 | });
|
36838 | });
|
36839 | };
|
36840 |
|
36841 | return Symmetric;
|
36842 | }(Adjust);
|
36843 |
|
36844 | module.exports = Symmetric;
|
36845 |
|
36846 | }),
|
36847 |
|
36848 | (function(module, exports, __webpack_require__) {
|
36849 |
|
36850 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36851 |
|
36852 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
36853 |
|
36854 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
36855 |
|
36856 |
|
36857 |
|
36858 |
|
36859 |
|
36860 |
|
36861 | var Util = __webpack_require__(0);
|
36862 | var Adjust = __webpack_require__(24);
|
36863 | var Global = __webpack_require__(1);
|
36864 |
|
36865 |
|
36866 |
|
36867 |
|
36868 |
|
36869 | var Dodge = function (_Adjust) {
|
36870 | _inherits(Dodge, _Adjust);
|
36871 |
|
36872 | function Dodge() {
|
36873 | _classCallCheck(this, Dodge);
|
36874 |
|
36875 | return _possibleConstructorReturn(this, _Adjust.apply(this, arguments));
|
36876 | }
|
36877 |
|
36878 | Dodge.prototype.getDefaultCfg = function getDefaultCfg() {
|
36879 | var cfg = _Adjust.prototype.getDefaultCfg.call(this);
|
36880 | return Util.assign(cfg, {
|
36881 | |
36882 |
|
36883 |
|
36884 |
|
36885 | marginRatio: 1 / 2,
|
36886 |
|
36887 | |
36888 |
|
36889 |
|
36890 |
|
36891 | dodgeRatio: Global.widthRatio.column,
|
36892 |
|
36893 | dodgeBy: null
|
36894 | });
|
36895 | };
|
36896 |
|
36897 | |
36898 |
|
36899 |
|
36900 |
|
36901 |
|
36902 |
|
36903 | Dodge.prototype.processAdjust = function processAdjust(dataArray) {
|
36904 | var self = this;
|
36905 | var mergeData = Util.Array.merge(dataArray);
|
36906 | var dodgeDim = self.dodgeBy;
|
36907 | var adjDataArray = dataArray;
|
36908 | if (dodgeDim) {
|
36909 |
|
36910 | adjDataArray = Util.Array.group(mergeData, dodgeDim);
|
36911 | }
|
36912 | self.cacheMap = {};
|
36913 | self.adjDataArray = adjDataArray;
|
36914 | self.mergeData = mergeData;
|
36915 | self.adjustData(adjDataArray, mergeData);
|
36916 |
|
36917 | self.adjDataArray = null;
|
36918 | self.mergeData = null;
|
36919 | };
|
36920 |
|
36921 | Dodge.prototype.getDistribution = function getDistribution(dim) {
|
36922 | var self = this;
|
36923 | var dataArray = self.adjDataArray;
|
36924 | var cacheMap = self.cacheMap;
|
36925 | var map = cacheMap[dim];
|
36926 | if (!map) {
|
36927 | map = {};
|
36928 | Util.each(dataArray, function (data, index) {
|
36929 | var values = Util.Array.values(data, dim);
|
36930 | if (!values.length) {
|
36931 | values.push(0);
|
36932 | }
|
36933 | Util.each(values, function (val) {
|
36934 | if (!map[val]) {
|
36935 | map[val] = [];
|
36936 | }
|
36937 | map[val].push(index);
|
36938 | });
|
36939 | });
|
36940 | cacheMap[dim] = map;
|
36941 | }
|
36942 |
|
36943 | return map;
|
36944 | };
|
36945 |
|
36946 | Dodge.prototype.adjustDim = function adjustDim(dim, values, data, frameCount, frameIndex) {
|
36947 | var self = this;
|
36948 | var map = self.getDistribution(dim);
|
36949 | var groupData = self.groupData(data, dim);
|
36950 |
|
36951 | Util.each(groupData, function (group, key) {
|
36952 | key = parseFloat(key);
|
36953 | var range = void 0;
|
36954 | if (values.length === 1) {
|
36955 | range = {
|
36956 | pre: values[0] - 1,
|
36957 | next: values[0] + 1
|
36958 | };
|
36959 | } else {
|
36960 | range = self.getAdjustRange(dim, key, values);
|
36961 | }
|
36962 | Util.each(group, function (record) {
|
36963 | var value = record[dim];
|
36964 | var valueArr = map[value];
|
36965 | var valIndex = valueArr.indexOf(frameIndex);
|
36966 | record[dim] = self.getDodgeOffset(range, valIndex, valueArr.length);
|
36967 | });
|
36968 | });
|
36969 | };
|
36970 |
|
36971 | Dodge.prototype.getDodgeOffset = function getDodgeOffset(range, index, count) {
|
36972 | var self = this;
|
36973 | var pre = range.pre;
|
36974 | var next = range.next;
|
36975 | var tickLength = next - pre;
|
36976 | var dodgeRatio = self.dodgeRatio;
|
36977 | var width = tickLength * dodgeRatio / count;
|
36978 | var margin = self.marginRatio * width;
|
36979 | var offset = 1 / 2 * (tickLength - count * width - (count - 1) * margin) + ((index + 1) * width + index * margin) - 1 / 2 * width - 1 / 2 * tickLength;
|
36980 | return (pre + next) / 2 + offset;
|
36981 | };
|
36982 |
|
36983 | return Dodge;
|
36984 | }(Adjust);
|
36985 |
|
36986 | module.exports = Dodge;
|
36987 |
|
36988 | }),
|
36989 |
|
36990 | (function(module, exports, __webpack_require__) {
|
36991 |
|
36992 | var GeomLabels = __webpack_require__(109);
|
36993 | var PolarLabels = __webpack_require__(111);
|
36994 | var PieLabels = __webpack_require__(302);
|
36995 |
|
36996 | var Labels = {
|
36997 | getLabelsClass: function getLabelsClass(coordType) {
|
36998 | var rst = GeomLabels;
|
36999 | if (coordType === 'polar') {
|
37000 | rst = PolarLabels;
|
37001 | } else if (coordType === 'theta') {
|
37002 |
|
37003 | rst = PieLabels;
|
37004 | }
|
37005 | return rst;
|
37006 | }
|
37007 | };
|
37008 |
|
37009 | module.exports = Labels;
|
37010 |
|
37011 | }),
|
37012 |
|
37013 | (function(module, exports, __webpack_require__) {
|
37014 |
|
37015 |
|
37016 |
|
37017 |
|
37018 |
|
37019 | var Util = __webpack_require__(0);
|
37020 | var Labels = __webpack_require__(110);
|
37021 |
|
37022 | module.exports = {
|
37023 | renderLabels: function renderLabels() {
|
37024 | var labelCfg = this.get('label');
|
37025 |
|
37026 | if (Util.isNil(labelCfg)) {
|
37027 | return;
|
37028 | }
|
37029 |
|
37030 | if (Util.isNil(labelCfg.items)) {
|
37031 | labelCfg.items = [];
|
37032 | }
|
37033 |
|
37034 | var labelsGroup = this.addGroup(Labels, labelCfg);
|
37035 | this.set('labelsGroup', labelsGroup);
|
37036 | },
|
37037 | resetLabels: function resetLabels(items) {
|
37038 | var self = this;
|
37039 | var labelCfg = self.get('label');
|
37040 |
|
37041 | if (!labelCfg) {
|
37042 | return;
|
37043 | }
|
37044 |
|
37045 | var labelsGroup = self.get('labelsGroup');
|
37046 | var children = labelsGroup.getLabels();
|
37047 | var count = children.length;
|
37048 | items = items || labelCfg.items;
|
37049 | Util.each(items, function (item, index) {
|
37050 | if (index < count) {
|
37051 | var label = children[index];
|
37052 | labelsGroup.changeLabel(label, item);
|
37053 | } else {
|
37054 | var labelShape = self.addLabel(item.text, item);
|
37055 | if (labelShape) {
|
37056 | labelShape._id = item._id;
|
37057 | labelShape.set('coord', item.coord);
|
37058 | }
|
37059 | }
|
37060 | });
|
37061 | for (var i = count - 1; i >= items.length; i--) {
|
37062 | children[i].remove();
|
37063 | }
|
37064 | },
|
37065 | addLabel: function addLabel(value, offsetPoint) {
|
37066 | var self = this;
|
37067 | var labelsGroup = self.get('labelsGroup');
|
37068 | var label = {};
|
37069 | var rst = void 0;
|
37070 | if (labelsGroup) {
|
37071 | label.text = value;
|
37072 | label.x = offsetPoint.x;
|
37073 | label.y = offsetPoint.y;
|
37074 | label.point = offsetPoint;
|
37075 | label.textAlign = offsetPoint.textAlign;
|
37076 | if (offsetPoint.rotate) {
|
37077 | label.rotate = offsetPoint.rotate;
|
37078 | }
|
37079 | rst = labelsGroup.addLabel(label);
|
37080 | }
|
37081 | return rst;
|
37082 | },
|
37083 | removeLabels: function removeLabels() {
|
37084 | var labelsGroup = this.get('labelsGroup');
|
37085 | labelsGroup && labelsGroup.remove();
|
37086 | this.set('labelsGroup', null);
|
37087 | }
|
37088 | };
|
37089 |
|
37090 | }),
|
37091 |
|
37092 | (function(module, exports, __webpack_require__) {
|
37093 |
|
37094 | var MatrixUtil = __webpack_require__(2).MatrixUtil;
|
37095 | var Vector2 = MatrixUtil.vec2;
|
37096 |
|
37097 | function smoothBezier(points, smooth, isLoop, constraint) {
|
37098 | var cps = [];
|
37099 |
|
37100 | var prevPoint = void 0;
|
37101 | var nextPoint = void 0;
|
37102 | var hasConstraint = !!constraint;
|
37103 | var min = void 0,
|
37104 | max = void 0;
|
37105 | if (hasConstraint) {
|
37106 | min = [Infinity, Infinity];
|
37107 | max = [-Infinity, -Infinity];
|
37108 |
|
37109 | for (var i = 0, l = points.length; i < l; i++) {
|
37110 | var point = points[i];
|
37111 | min = Vector2.min([], min, point);
|
37112 | max = Vector2.max([], max, point);
|
37113 | }
|
37114 | min = Vector2.min([], min, constraint[0]);
|
37115 | max = Vector2.max([], max, constraint[1]);
|
37116 | }
|
37117 |
|
37118 | for (var _i = 0, len = points.length; _i < len; _i++) {
|
37119 | var _point = points[_i];
|
37120 | if (isLoop) {
|
37121 | prevPoint = points[_i ? _i - 1 : len - 1];
|
37122 | nextPoint = points[(_i + 1) % len];
|
37123 | } else {
|
37124 | if (_i === 0 || _i === len - 1) {
|
37125 | cps.push(_point);
|
37126 | continue;
|
37127 | } else {
|
37128 | prevPoint = points[_i - 1];
|
37129 | nextPoint = points[_i + 1];
|
37130 | }
|
37131 | }
|
37132 | var v = [];
|
37133 | v = Vector2.sub(v, nextPoint, prevPoint);
|
37134 | v = Vector2.scale(v, v, smooth);
|
37135 |
|
37136 | var d0 = Vector2.distance(_point, prevPoint);
|
37137 | var d1 = Vector2.distance(_point, nextPoint);
|
37138 |
|
37139 | var sum = d0 + d1;
|
37140 | if (sum !== 0) {
|
37141 | d0 /= sum;
|
37142 | d1 /= sum;
|
37143 | }
|
37144 |
|
37145 | var v1 = Vector2.scale([], v, -d0);
|
37146 | var v2 = Vector2.scale([], v, d1);
|
37147 |
|
37148 | var cp0 = Vector2.add([], _point, v1);
|
37149 | var cp1 = Vector2.add([], _point, v2);
|
37150 |
|
37151 | if (hasConstraint) {
|
37152 | cp0 = Vector2.max([], cp0, min);
|
37153 | cp0 = Vector2.min([], cp0, max);
|
37154 | cp1 = Vector2.max([], cp1, min);
|
37155 | cp1 = Vector2.min([], cp1, max);
|
37156 | }
|
37157 |
|
37158 | cps.push(cp0);
|
37159 | cps.push(cp1);
|
37160 | }
|
37161 |
|
37162 | if (isLoop) {
|
37163 | cps.push(cps.shift());
|
37164 | }
|
37165 | return cps;
|
37166 | }
|
37167 |
|
37168 | function catmullRom2bezier(crp, z, constraint) {
|
37169 | var isLoop = !!z;
|
37170 |
|
37171 | var pointList = [];
|
37172 |
|
37173 | for (var i = 0, l = crp.length; i < l; i += 2) {
|
37174 | pointList.push([crp[i], crp[i + 1]]);
|
37175 | }
|
37176 |
|
37177 | var controlPointList = smoothBezier(pointList, 0.4, isLoop, constraint);
|
37178 | var len = pointList.length;
|
37179 | var d1 = [];
|
37180 |
|
37181 | var cp1 = void 0;
|
37182 | var cp2 = void 0;
|
37183 | var p = void 0;
|
37184 |
|
37185 | for (var _i2 = 0; _i2 < len - 1; _i2++) {
|
37186 | cp1 = controlPointList[_i2 * 2];
|
37187 | cp2 = controlPointList[_i2 * 2 + 1];
|
37188 | p = pointList[_i2 + 1];
|
37189 |
|
37190 | d1.push(['C', cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]]);
|
37191 | }
|
37192 |
|
37193 | if (isLoop) {
|
37194 | cp1 = controlPointList[len];
|
37195 | cp2 = controlPointList[len + 1];
|
37196 | p = pointList[0];
|
37197 |
|
37198 | d1.push(['C', cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]]);
|
37199 | }
|
37200 | return d1;
|
37201 | }
|
37202 |
|
37203 | module.exports = {
|
37204 | catmullRom2bezier: catmullRom2bezier
|
37205 | };
|
37206 |
|
37207 | }),
|
37208 |
|
37209 | (function(module, exports, __webpack_require__) {
|
37210 |
|
37211 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
37212 |
|
37213 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
37214 |
|
37215 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
37216 |
|
37217 | var Util = __webpack_require__(0);
|
37218 | var PolarLabels = __webpack_require__(111);
|
37219 | var PathUtil = __webpack_require__(14);
|
37220 | var Global = __webpack_require__(1);
|
37221 | var MARGIN = 5;
|
37222 |
|
37223 | function getEndPoint(center, angle, r) {
|
37224 | return {
|
37225 | x: center.x + r * Math.cos(angle),
|
37226 | y: center.y + r * Math.sin(angle)
|
37227 | };
|
37228 | }
|
37229 |
|
37230 | function antiCollision(labels, lineHeight, plotRange, center, isRight) {
|
37231 |
|
37232 | var overlapping = true;
|
37233 | var start = plotRange.start;
|
37234 | var end = plotRange.end;
|
37235 | var startY = Math.min(start.y, end.y);
|
37236 | var totalHeight = Math.abs(start.y - end.y);
|
37237 | var i = void 0;
|
37238 |
|
37239 | var maxY = 0;
|
37240 | var minY = Number.MIN_VALUE;
|
37241 | var boxes = labels.map(function (label) {
|
37242 | if (label.y > maxY) {
|
37243 | maxY = label.y;
|
37244 | }
|
37245 | if (label.y < minY) {
|
37246 | minY = label.y;
|
37247 | }
|
37248 | return {
|
37249 | size: lineHeight,
|
37250 | targets: [label.y - startY]
|
37251 | };
|
37252 | });
|
37253 | minY -= startY;
|
37254 | if (maxY - startY > totalHeight) {
|
37255 | totalHeight = maxY - startY;
|
37256 | }
|
37257 |
|
37258 | while (overlapping) {
|
37259 |
|
37260 | boxes.forEach(function (box) {
|
37261 | var target = (Math.min.apply(minY, box.targets) + Math.max.apply(minY, box.targets)) / 2;
|
37262 | box.pos = Math.min(Math.max(minY, target - box.size / 2), totalHeight - box.size);
|
37263 |
|
37264 | });
|
37265 |
|
37266 |
|
37267 | overlapping = false;
|
37268 | i = boxes.length;
|
37269 | while (i--) {
|
37270 | if (i > 0) {
|
37271 | var previousBox = boxes[i - 1];
|
37272 | var box = boxes[i];
|
37273 | if (previousBox.pos + previousBox.size > box.pos) {
|
37274 |
|
37275 | previousBox.size += box.size;
|
37276 | previousBox.targets = previousBox.targets.concat(box.targets);
|
37277 |
|
37278 |
|
37279 | if (previousBox.pos + previousBox.size > totalHeight) {
|
37280 | previousBox.pos = totalHeight - previousBox.size;
|
37281 | }
|
37282 | boxes.splice(i, 1);
|
37283 | overlapping = true;
|
37284 | }
|
37285 | }
|
37286 | }
|
37287 | }
|
37288 |
|
37289 | i = 0;
|
37290 |
|
37291 | boxes.forEach(function (b) {
|
37292 | var posInCompositeBox = startY + lineHeight / 2;
|
37293 | b.targets.forEach(function () {
|
37294 | labels[i].y = b.pos + posInCompositeBox;
|
37295 | posInCompositeBox += lineHeight;
|
37296 | i++;
|
37297 | });
|
37298 | });
|
37299 |
|
37300 |
|
37301 | labels.forEach(function (label) {
|
37302 | var rPow2 = label.r * label.r;
|
37303 | var dyPow2 = Math.pow(Math.abs(label.y - center.y), 2);
|
37304 | if (rPow2 < dyPow2) {
|
37305 | label.x = center.x;
|
37306 | } else {
|
37307 | var dx = Math.sqrt(rPow2 - dyPow2);
|
37308 | if (!isRight) {
|
37309 |
|
37310 | label.x = center.x - dx;
|
37311 | } else {
|
37312 |
|
37313 | label.x = center.x + dx;
|
37314 | }
|
37315 | }
|
37316 | });
|
37317 | }
|
37318 |
|
37319 | var PieLabels = function (_PolarLabels) {
|
37320 | _inherits(PieLabels, _PolarLabels);
|
37321 |
|
37322 | function PieLabels() {
|
37323 | _classCallCheck(this, PieLabels);
|
37324 |
|
37325 | return _possibleConstructorReturn(this, _PolarLabels.apply(this, arguments));
|
37326 | }
|
37327 |
|
37328 | PieLabels.prototype.getDefaultCfg = function getDefaultCfg() {
|
37329 | return {
|
37330 | label: Global.thetaLabels
|
37331 | };
|
37332 | };
|
37333 |
|
37334 | |
37335 |
|
37336 |
|
37337 |
|
37338 |
|
37339 |
|
37340 |
|
37341 |
|
37342 | PieLabels.prototype.adjustItems = function adjustItems(items) {
|
37343 | var self = this;
|
37344 | var offset = self.getDefaultOffset();
|
37345 | if (offset > 0) {
|
37346 | items = self._distribute(items, offset);
|
37347 | }
|
37348 | return items;
|
37349 | };
|
37350 |
|
37351 | |
37352 |
|
37353 |
|
37354 |
|
37355 |
|
37356 |
|
37357 |
|
37358 |
|
37359 |
|
37360 | PieLabels.prototype._distribute = function _distribute(labels, offset) {
|
37361 | var self = this;
|
37362 | var coord = self.get('coord');
|
37363 |
|
37364 | var radius = coord.getRadius();
|
37365 | var lineHeight = self.get('label').labelHeight;
|
37366 | var center = coord.getCenter();
|
37367 | var totalR = radius + offset;
|
37368 | var totalHeight = totalR * 2 + lineHeight * 2;
|
37369 | var plotRange = {
|
37370 | start: coord.start,
|
37371 | end: coord.end
|
37372 | };
|
37373 | var geom = self.get('geom');
|
37374 | if (geom) {
|
37375 | var view = geom.get('view');
|
37376 | plotRange = view.getViewRegion();
|
37377 | }
|
37378 |
|
37379 |
|
37380 | var halves = [[],
|
37381 | []
|
37382 | ];
|
37383 | labels.forEach(function (label) {
|
37384 | if (label.textAlign === 'right') {
|
37385 |
|
37386 | halves[0].push(label);
|
37387 | } else {
|
37388 |
|
37389 | halves[1].push(label);
|
37390 | }
|
37391 | });
|
37392 |
|
37393 | halves.forEach(function (half, index) {
|
37394 |
|
37395 | var maxLabelsCountForOneSide = parseInt(totalHeight / lineHeight, 10);
|
37396 | if (half.length > maxLabelsCountForOneSide) {
|
37397 | half.sort(function (a, b) {
|
37398 |
|
37399 | return b['..percent'] - a['..percent'];
|
37400 | });
|
37401 | half.splice(maxLabelsCountForOneSide, half.length - maxLabelsCountForOneSide);
|
37402 | }
|
37403 |
|
37404 |
|
37405 | half.sort(function (a, b) {
|
37406 |
|
37407 | return a.y - b.y;
|
37408 | });
|
37409 | antiCollision(half, lineHeight, plotRange, center, index);
|
37410 | });
|
37411 |
|
37412 | return halves[0].concat(halves[1]);
|
37413 | };
|
37414 |
|
37415 |
|
37416 |
|
37417 |
|
37418 | PieLabels.prototype.lineToLabel = function lineToLabel(label, labelLine) {
|
37419 | var self = this;
|
37420 | var coord = self.get('coord');
|
37421 | var r = coord.getRadius();
|
37422 | var distance = self.getDefaultOffset();
|
37423 | var angle = label.orignAngle || label.angle;
|
37424 | var center = coord.getCenter();
|
37425 | var start = getEndPoint(center, angle, r + MARGIN / 2);
|
37426 | var inner = getEndPoint(center, angle, r + distance / 2);
|
37427 | var lineGroup = self.get('lineGroup');
|
37428 |
|
37429 | if (!lineGroup) {
|
37430 | lineGroup = self.addGroup({
|
37431 | elCls: 'x-line-group'
|
37432 | });
|
37433 | self.set('lineGroup', lineGroup);
|
37434 | }
|
37435 |
|
37436 | var lineShape = lineGroup.addShape('path', {
|
37437 | attrs: Util.mix({
|
37438 | path: ['M' + start.x, start.y + ' Q' + inner.x, inner.y + ' ' + label.x, label.y].join(','),
|
37439 | fill: null,
|
37440 | stroke: label.color
|
37441 | }, labelLine)
|
37442 | });
|
37443 |
|
37444 | lineShape.name = 'labelLine';
|
37445 | lineShape._id = label._id && label._id.replace('glabel', 'glabelline');
|
37446 | lineShape.set('coord', coord);
|
37447 | };
|
37448 |
|
37449 | |
37450 |
|
37451 |
|
37452 |
|
37453 |
|
37454 |
|
37455 |
|
37456 |
|
37457 |
|
37458 | PieLabels.prototype.getLabelRotate = function getLabelRotate(angle, offset) {
|
37459 | var rotate = void 0;
|
37460 | if (offset < 0) {
|
37461 | rotate = angle * 180 / Math.PI;
|
37462 | if (rotate > 90) {
|
37463 | rotate = rotate - 180;
|
37464 | }
|
37465 | if (rotate < -90) {
|
37466 | rotate = rotate + 180;
|
37467 | }
|
37468 | }
|
37469 | return rotate / 180 * Math.PI;
|
37470 | };
|
37471 |
|
37472 | |
37473 |
|
37474 |
|
37475 |
|
37476 |
|
37477 |
|
37478 |
|
37479 |
|
37480 | PieLabels.prototype.getLabelAlign = function getLabelAlign(point) {
|
37481 | var self = this;
|
37482 | var coord = self.get('coord');
|
37483 | var center = coord.getCenter();
|
37484 | var align = void 0;
|
37485 | if (point.angle <= Math.PI / 2 && point.x >= center.x) {
|
37486 | align = 'left';
|
37487 | } else {
|
37488 | align = 'right';
|
37489 | }
|
37490 |
|
37491 | var offset = self.getDefaultOffset();
|
37492 | if (offset <= 0) {
|
37493 | if (align === 'right') {
|
37494 | align = 'left';
|
37495 | } else {
|
37496 | align = 'right';
|
37497 | }
|
37498 | }
|
37499 | return align;
|
37500 | };
|
37501 |
|
37502 | PieLabels.prototype.getArcPoint = function getArcPoint(point) {
|
37503 | return point;
|
37504 | };
|
37505 |
|
37506 | PieLabels.prototype.getPointAngle = function getPointAngle(point) {
|
37507 | var self = this;
|
37508 | var coord = self.get('coord');
|
37509 | var startPoint = {
|
37510 | x: Util.isArray(point.x) ? point.x[0] : point.x,
|
37511 | y: point.y[0]
|
37512 | };
|
37513 | var endPoint = {
|
37514 | x: Util.isArray(point.x) ? point.x[1] : point.x,
|
37515 | y: point.y[1]
|
37516 | };
|
37517 | var angle = void 0;
|
37518 | var startAngle = PathUtil.getPointAngle(coord, startPoint);
|
37519 | if (point.points && point.points[0].y === point.points[1].y) {
|
37520 | angle = startAngle;
|
37521 | } else {
|
37522 | var endAngle = PathUtil.getPointAngle(coord, endPoint);
|
37523 | if (startAngle >= endAngle) {
|
37524 |
|
37525 | endAngle = endAngle + Math.PI * 2;
|
37526 | }
|
37527 | angle = startAngle + (endAngle - startAngle) / 2;
|
37528 | }
|
37529 | return angle;
|
37530 | };
|
37531 |
|
37532 | PieLabels.prototype.getCirclePoint = function getCirclePoint(angle, offset) {
|
37533 | var self = this;
|
37534 | var coord = self.get('coord');
|
37535 | var center = coord.getCenter();
|
37536 | var r = coord.getRadius() + offset;
|
37537 | var point = getEndPoint(center, angle, r);
|
37538 | point.angle = angle;
|
37539 | point.r = r;
|
37540 | return point;
|
37541 | };
|
37542 |
|
37543 | return PieLabels;
|
37544 | }(PolarLabels);
|
37545 |
|
37546 | module.exports = PieLabels;
|
37547 |
|
37548 | }),
|
37549 |
|
37550 | (function(module, exports, __webpack_require__) {
|
37551 |
|
37552 |
|
37553 |
|
37554 |
|
37555 |
|
37556 |
|
37557 |
|
37558 | var Util = __webpack_require__(0);
|
37559 | var Shape = __webpack_require__(10);
|
37560 | var PathUtil = __webpack_require__(14);
|
37561 | var Global = __webpack_require__(1);
|
37562 |
|
37563 | function getLineAttrs(cfg) {
|
37564 | var defaultAttrs = Global.shape.hollowArea;
|
37565 | var lineAttrs = Util.mix({}, defaultAttrs, {
|
37566 | stroke: cfg.color,
|
37567 | lineWidth: cfg.size,
|
37568 | strokeOpacity: cfg.opacity
|
37569 | }, cfg.style);
|
37570 | return lineAttrs;
|
37571 | }
|
37572 |
|
37573 | function getFillAttrs(cfg) {
|
37574 | var defaultAttrs = Global.shape.area;
|
37575 | var areaAttrs = Util.mix({}, defaultAttrs, {
|
37576 | fill: cfg.color,
|
37577 | stroke: cfg.color,
|
37578 | lineWidth: cfg.size,
|
37579 | fillOpacity: cfg.opacity
|
37580 | }, cfg.style);
|
37581 | return areaAttrs;
|
37582 | }
|
37583 |
|
37584 | function getPath(cfg, smooth, shape) {
|
37585 | var path = [];
|
37586 | var pointsArr = [];
|
37587 | var topLinePoints = [];
|
37588 | var bottomLinePoints = [];
|
37589 | var isInCircle = cfg.isInCircle;
|
37590 | Util.each(cfg.points, function (point) {
|
37591 | topLinePoints.push(point[1]);
|
37592 | bottomLinePoints.push(point[0]);
|
37593 | });
|
37594 | if (!isInCircle) {
|
37595 | bottomLinePoints = bottomLinePoints.reverse();
|
37596 | }
|
37597 | pointsArr.push(topLinePoints, bottomLinePoints);
|
37598 | Util.each(pointsArr, function (points, index) {
|
37599 | var subPath = [];
|
37600 | points = shape.parsePoints(points);
|
37601 | var p1 = points[0];
|
37602 | if (isInCircle) {
|
37603 | points.push({ x: p1.x, y: p1.y });
|
37604 | }
|
37605 | if (smooth) {
|
37606 | subPath = PathUtil.getSplinePath(points, false, cfg.constraint);
|
37607 | } else {
|
37608 | subPath = PathUtil.getLinePath(points, false);
|
37609 | }
|
37610 | if (!isInCircle && index > 0) {
|
37611 | subPath[0][0] = 'L';
|
37612 | }
|
37613 | path = path.concat(subPath);
|
37614 | });
|
37615 | path.push(['Z']);
|
37616 | return path;
|
37617 | }
|
37618 |
|
37619 |
|
37620 | function _getMarkerCfg(cfg) {
|
37621 | return {
|
37622 | symbol: function symbol(x, y, r, ctx) {
|
37623 |
|
37624 | ctx.save();
|
37625 | ctx.lineWidth = 2;
|
37626 | ctx.strokeStyle = ctx.fillStyle;
|
37627 | ctx.moveTo(x - 5.5, y - 4);
|
37628 | ctx.lineTo(x + 5.5, y - 4);
|
37629 | ctx.stroke();
|
37630 | ctx.restore();
|
37631 | ctx.moveTo(x - 5.5, y - 4);
|
37632 | ctx.lineTo(x + 5.5, y - 4);
|
37633 | ctx.lineTo(x + 5.5, y + 4);
|
37634 | ctx.lineTo(x - 5.5, y + 4);
|
37635 | ctx.closePath();
|
37636 | },
|
37637 |
|
37638 | radius: 5,
|
37639 | fill: cfg.color,
|
37640 | fillOpacity: 0.3
|
37641 | };
|
37642 | }
|
37643 |
|
37644 |
|
37645 | function _getActiveCfg(type, cfg) {
|
37646 | if (type === 'line' || type === 'smoothLine') {
|
37647 |
|
37648 | var lineWidth = cfg.lineWidth || 0;
|
37649 | return {
|
37650 | lineWidth: lineWidth + 1
|
37651 | };
|
37652 | }
|
37653 | var opacity = cfg.fillOpacity || cfg.opacity || 1;
|
37654 | return {
|
37655 | fillOpacity: opacity - 0.15,
|
37656 | strokeOpacity: opacity - 0.15
|
37657 | };
|
37658 | }
|
37659 |
|
37660 |
|
37661 | function drawPointShape(shapeObj, cfg, container) {
|
37662 | var coord = shapeObj._coord;
|
37663 | var point = coord.convertPoint(cfg.points[0][1]);
|
37664 | return container.addShape('circle', {
|
37665 | attrs: Util.mix({
|
37666 | x: point.x,
|
37667 | y: point.y,
|
37668 | r: 2,
|
37669 | fill: cfg.color
|
37670 | }, cfg.style)
|
37671 | });
|
37672 | }
|
37673 |
|
37674 | var Area = Shape.registerFactory('area', {
|
37675 | defaultShapeType: 'area',
|
37676 | |
37677 |
|
37678 |
|
37679 |
|
37680 |
|
37681 |
|
37682 | getDefaultPoints: function getDefaultPoints(pointInfo) {
|
37683 | var points = [];
|
37684 | var x = pointInfo.x;
|
37685 | var y = pointInfo.y;
|
37686 | var y0 = pointInfo.y0;
|
37687 | y = Util.isArray(y) ? y : [y0, y];
|
37688 |
|
37689 | Util.each(y, function (yItem) {
|
37690 | points.push({
|
37691 | x: x,
|
37692 | y: yItem
|
37693 | });
|
37694 | });
|
37695 | return points;
|
37696 | },
|
37697 |
|
37698 |
|
37699 | getActiveCfg: function getActiveCfg(type, cfg) {
|
37700 | return _getActiveCfg(type, cfg);
|
37701 | },
|
37702 | drawShape: function drawShape(type, cfg, container) {
|
37703 | var shape = this.getShape(type);
|
37704 | var gShape = void 0;
|
37705 | if (cfg.points.length === 1 && Global.showSinglePoint) {
|
37706 | gShape = drawPointShape(this, cfg, container);
|
37707 | } else {
|
37708 | gShape = shape.draw(cfg, container);
|
37709 | }
|
37710 | if (gShape) {
|
37711 | gShape.set('origin', cfg.origin);
|
37712 | gShape._id = cfg.splitedIndex ? cfg._id + cfg.splitedIndex : cfg._id;
|
37713 | gShape.name = this.name;
|
37714 | }
|
37715 | return gShape;
|
37716 | },
|
37717 | getSelectedCfg: function getSelectedCfg(type, cfg) {
|
37718 | if (cfg && cfg.style) {
|
37719 | return cfg.style;
|
37720 | }
|
37721 | return this.getActiveCfg(type, cfg);
|
37722 | }
|
37723 | });
|
37724 |
|
37725 |
|
37726 | Shape.registerShape('area', 'area', {
|
37727 | draw: function draw(cfg, container) {
|
37728 | var attrs = getFillAttrs(cfg);
|
37729 | var path = getPath(cfg, false, this);
|
37730 |
|
37731 | return container.addShape('path', {
|
37732 | attrs: Util.mix(attrs, {
|
37733 | path: path
|
37734 | })
|
37735 | });
|
37736 | },
|
37737 | getMarkerCfg: function getMarkerCfg(cfg) {
|
37738 | return _getMarkerCfg(cfg);
|
37739 | }
|
37740 | });
|
37741 |
|
37742 |
|
37743 | Shape.registerShape('area', 'smooth', {
|
37744 | draw: function draw(cfg, container) {
|
37745 | var attrs = getFillAttrs(cfg);
|
37746 | var coord = this._coord;
|
37747 |
|
37748 | cfg.constraint = [[coord.start.x, coord.end.y], [coord.end.x, coord.start.y]];
|
37749 | var path = getPath(cfg, true, this);
|
37750 |
|
37751 | return container.addShape('path', {
|
37752 | attrs: Util.mix(attrs, {
|
37753 | path: path
|
37754 | })
|
37755 | });
|
37756 | },
|
37757 | getMarkerCfg: function getMarkerCfg(cfg) {
|
37758 | return _getMarkerCfg(cfg);
|
37759 | }
|
37760 | });
|
37761 |
|
37762 |
|
37763 | Shape.registerShape('area', 'line', {
|
37764 | draw: function draw(cfg, container) {
|
37765 | var attrs = getLineAttrs(cfg);
|
37766 | var path = getPath(cfg, false, this);
|
37767 |
|
37768 | return container.addShape('path', {
|
37769 | attrs: Util.mix(attrs, {
|
37770 | path: path
|
37771 | })
|
37772 | });
|
37773 | },
|
37774 | getMarkerCfg: function getMarkerCfg(cfg) {
|
37775 | return _getMarkerCfg(cfg);
|
37776 | }
|
37777 | });
|
37778 |
|
37779 |
|
37780 | Shape.registerShape('area', 'smoothLine', {
|
37781 | draw: function draw(cfg, container) {
|
37782 | var attrs = getLineAttrs(cfg);
|
37783 | var path = getPath(cfg, true, this);
|
37784 | return container.addShape('path', {
|
37785 | attrs: Util.mix(attrs, {
|
37786 | path: path
|
37787 | })
|
37788 | });
|
37789 | },
|
37790 | getMarkerCfg: function getMarkerCfg(cfg) {
|
37791 | return _getMarkerCfg(cfg);
|
37792 | }
|
37793 | });
|
37794 |
|
37795 | Area.spline = Area.smooth;
|
37796 |
|
37797 | module.exports = Area;
|
37798 |
|
37799 | }),
|
37800 |
|
37801 | (function(module, exports, __webpack_require__) {
|
37802 |
|
37803 |
|
37804 |
|
37805 |
|
37806 |
|
37807 |
|
37808 | var Util = __webpack_require__(0);
|
37809 | var Shape = __webpack_require__(10);
|
37810 | var ShapeUtil = __webpack_require__(67);
|
37811 | var Global = __webpack_require__(1);
|
37812 | var PathUtil = __webpack_require__(14);
|
37813 | var CORNER_PERCENT = 1 / 3;
|
37814 |
|
37815 | function getAttrs(cfg) {
|
37816 | var defaultCfg = Global.shape.edge;
|
37817 | var shapeCfg = Util.mix({}, defaultCfg, {
|
37818 | stroke: cfg.color,
|
37819 | lineWidth: cfg.size,
|
37820 | strokeOpacity: cfg.opacity,
|
37821 | opacity: cfg.opacity
|
37822 | }, cfg.style);
|
37823 | return shapeCfg;
|
37824 | }
|
37825 |
|
37826 | var Edge = Shape.registerFactory('edge', {
|
37827 | defaultShapeType: 'line',
|
37828 | getDefaultPoints: function getDefaultPoints(pointInfo) {
|
37829 | return ShapeUtil.splitPoints(pointInfo);
|
37830 | },
|
37831 | getActiveCfg: function getActiveCfg(type, cfg) {
|
37832 | var lineWidth = cfg.lineWidth || 0;
|
37833 | return {
|
37834 | lineWidth: lineWidth + 1
|
37835 | };
|
37836 | }
|
37837 | });
|
37838 |
|
37839 | function getCPath(from, to) {
|
37840 | var points = [];
|
37841 | points.push({
|
37842 | x: from.x,
|
37843 | y: from.y * (1 - 1 / 2) + to.y * 1 / 2
|
37844 | });
|
37845 |
|
37846 | points.push({
|
37847 | y: from.y * (1 - 1 / 2) + to.y * 1 / 2,
|
37848 | x: to.x
|
37849 | });
|
37850 | points.push(to);
|
37851 | var sub = ['C'];
|
37852 |
|
37853 | Util.each(points, function (point) {
|
37854 | sub.push(point.x, point.y);
|
37855 | });
|
37856 | return sub;
|
37857 | }
|
37858 |
|
37859 | function getQPath(to, center) {
|
37860 | var points = [];
|
37861 | points.push({
|
37862 | x: center.x,
|
37863 | y: center.y
|
37864 | });
|
37865 | points.push(to);
|
37866 |
|
37867 | var sub = ['Q'];
|
37868 | Util.each(points, function (point) {
|
37869 | sub.push(point.x, point.y);
|
37870 | });
|
37871 | return sub;
|
37872 | }
|
37873 |
|
37874 | function createSmoothPath(from, to) {
|
37875 | var sub = getCPath(from, to);
|
37876 | var path = [['M', from.x, from.y]];
|
37877 |
|
37878 | path.push(sub);
|
37879 | return path;
|
37880 | }
|
37881 |
|
37882 | function createArcPath(from, to, center) {
|
37883 | var sub = getQPath(to, center);
|
37884 | var path = [['M', from.x, from.y]];
|
37885 | path.push(sub);
|
37886 | return path;
|
37887 | }
|
37888 |
|
37889 | function createArcWeightPath(points, center) {
|
37890 | var arc1 = getQPath(points[1], center);
|
37891 | var arc2 = getQPath(points[3], center);
|
37892 | var path = [['M', points[0].x, points[0].y]];
|
37893 | path.push(arc2);
|
37894 | path.push(['L', points[3].x, points[3].y]);
|
37895 | path.push(['L', points[2].x, points[2].y]);
|
37896 | path.push(arc1);
|
37897 | path.push(['L', points[1].x, points[1].y]);
|
37898 | path.push(['L', points[0].x, points[0].y]);
|
37899 | path.push(['Z']);
|
37900 | return path;
|
37901 | }
|
37902 |
|
37903 | function createRectPath(from, to) {
|
37904 | var points = [];
|
37905 | points.push({
|
37906 | y: from.y * (1 - CORNER_PERCENT) + to.y * CORNER_PERCENT,
|
37907 | x: from.x
|
37908 | });
|
37909 | points.push({
|
37910 | y: from.y * (1 - CORNER_PERCENT) + to.y * CORNER_PERCENT,
|
37911 | x: to.x
|
37912 | });
|
37913 | points.push(to);
|
37914 | var path = [['M', from.x, from.y]];
|
37915 | Util.each(points, function (point) {
|
37916 | path.push(['L', point.x, point.y]);
|
37917 | });
|
37918 | return path;
|
37919 | }
|
37920 |
|
37921 | Shape.registerShape('edge', 'line', {
|
37922 | draw: function draw(cfg, container) {
|
37923 | var points = this.parsePoints(cfg.points);
|
37924 | var attrCfg = getAttrs(cfg);
|
37925 | var path = PathUtil.getLinePath(points);
|
37926 | var line = container.addShape('path', {
|
37927 | attrs: Util.mix(attrCfg, {
|
37928 | path: path
|
37929 | })
|
37930 | });
|
37931 | return line;
|
37932 | },
|
37933 | getMarkerCfg: function getMarkerCfg(cfg) {
|
37934 | return Util.mix({
|
37935 | symbol: 'circle',
|
37936 | radius: 4.5
|
37937 | }, getAttrs(cfg));
|
37938 | }
|
37939 | });
|
37940 |
|
37941 | Shape.registerShape('edge', 'vhv', {
|
37942 | draw: function draw(cfg, container) {
|
37943 | var points = cfg.points;
|
37944 | var attrCfg = getAttrs(cfg);
|
37945 | var path = createRectPath(points[0], points[1]);
|
37946 | path = this.parsePath(path);
|
37947 | var line = container.addShape('path', {
|
37948 | attrs: Util.mix(attrCfg, {
|
37949 | path: path
|
37950 | })
|
37951 | });
|
37952 | return line;
|
37953 | },
|
37954 | getMarkerCfg: function getMarkerCfg(cfg) {
|
37955 | return Util.mix({
|
37956 | symbol: 'circle',
|
37957 | radius: 4.5
|
37958 | }, getAttrs(cfg));
|
37959 | }
|
37960 | });
|
37961 |
|
37962 | Shape.registerShape('edge', 'smooth', {
|
37963 | draw: function draw(cfg, container) {
|
37964 | var points = cfg.points;
|
37965 | var attrCfg = getAttrs(cfg);
|
37966 | var path = createSmoothPath(points[0], points[1]);
|
37967 | path = this.parsePath(path);
|
37968 |
|
37969 | var line = container.addShape('path', {
|
37970 | attrs: Util.mix(attrCfg, {
|
37971 | path: path
|
37972 | })
|
37973 | });
|
37974 | return line;
|
37975 | },
|
37976 | getMarkerCfg: function getMarkerCfg(cfg) {
|
37977 | return Util.mix({
|
37978 | symbol: 'circle',
|
37979 | radius: 4.5
|
37980 | }, getAttrs(cfg));
|
37981 | }
|
37982 | });
|
37983 |
|
37984 |
|
37985 | Shape.registerShape('edge', 'arc', {
|
37986 | draw: function draw(cfg, container) {
|
37987 | var points = cfg.points;
|
37988 | var type = points.length > 2 ? 'weight' : 'normal';
|
37989 | var attrCfg = getAttrs(cfg);
|
37990 | var line = void 0;
|
37991 | var path = void 0;
|
37992 | if (cfg.isInCircle) {
|
37993 | var center = {
|
37994 | x: 0,
|
37995 | y: 1
|
37996 | };
|
37997 | if (type === 'normal') {
|
37998 | path = createArcPath(points[0], points[1], center);
|
37999 | } else {
|
38000 | attrCfg.fill = attrCfg.stroke;
|
38001 | path = createArcWeightPath(points, center);
|
38002 | }
|
38003 | path = this.parsePath(path);
|
38004 | line = container.addShape('path', {
|
38005 | attrs: Util.mix(attrCfg, {
|
38006 | path: path
|
38007 | })
|
38008 | });
|
38009 | } else {
|
38010 | if (type === 'normal') {
|
38011 | points = this.parsePoints(points);
|
38012 | line = container.addShape('arc', {
|
38013 | attrs: Util.mix(attrCfg, {
|
38014 | x: (points[1].x + points[0].x) / 2,
|
38015 | y: points[0].y,
|
38016 | r: Math.abs(points[1].x - points[0].x) / 2,
|
38017 | startAngle: Math.PI,
|
38018 | endAngle: Math.PI * 2
|
38019 | })
|
38020 | });
|
38021 | } else {
|
38022 | path = [['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y]];
|
38023 | var c1 = getCPath(points[1], points[3]);
|
38024 | var c2 = getCPath(points[2], points[0]);
|
38025 | path.push(c1);
|
38026 | path.push(['L', points[3].x, points[3].y]);
|
38027 | path.push(['L', points[2].x, points[2].y]);
|
38028 | path.push(c2);
|
38029 | path.push(['Z']);
|
38030 | path = this.parsePath(path);
|
38031 | attrCfg.fill = attrCfg.stroke;
|
38032 | line = container.addShape('path', {
|
38033 | attrs: Util.mix(attrCfg, {
|
38034 | path: path
|
38035 | })
|
38036 | });
|
38037 | }
|
38038 | }
|
38039 | return line;
|
38040 | },
|
38041 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38042 | return Util.mix({
|
38043 | symbol: 'circle',
|
38044 | radius: 4.5
|
38045 | }, getAttrs(cfg));
|
38046 | }
|
38047 | });
|
38048 |
|
38049 | module.exports = Edge;
|
38050 |
|
38051 | }),
|
38052 |
|
38053 | (function(module, exports, __webpack_require__) {
|
38054 |
|
38055 |
|
38056 |
|
38057 |
|
38058 |
|
38059 |
|
38060 |
|
38061 |
|
38062 | var Util = __webpack_require__(0);
|
38063 | var Shape = __webpack_require__(10);
|
38064 | var PathUtil = __webpack_require__(14);
|
38065 | var Global = __webpack_require__(1);
|
38066 |
|
38067 |
|
38068 | function getRectPoints(cfg, isPyramid) {
|
38069 | var x = cfg.x;
|
38070 | var y = cfg.y;
|
38071 | var y0 = cfg.y0;
|
38072 | var width = cfg.size;
|
38073 |
|
38074 |
|
38075 |
|
38076 |
|
38077 | var ymin = y0;
|
38078 | var ymax = y;
|
38079 | if (Util.isArray(y)) {
|
38080 | ymax = y[1];
|
38081 | ymin = y[0];
|
38082 | }
|
38083 |
|
38084 | var xmin = void 0;
|
38085 | var xmax = void 0;
|
38086 | if (Util.isArray(x)) {
|
38087 | xmin = x[0];
|
38088 | xmax = x[1];
|
38089 | } else {
|
38090 | xmin = x - width / 2;
|
38091 | xmax = x + width / 2;
|
38092 | }
|
38093 |
|
38094 | var points = [];
|
38095 | points.push({
|
38096 | x: xmin,
|
38097 | y: ymin
|
38098 | }, {
|
38099 | x: xmin,
|
38100 | y: ymax
|
38101 | });
|
38102 |
|
38103 | if (isPyramid) {
|
38104 | points.push({
|
38105 | x: xmax,
|
38106 | y: (ymax + ymin) / 2
|
38107 | });
|
38108 | } else {
|
38109 | points.push({
|
38110 | x: xmax,
|
38111 | y: ymax
|
38112 | }, {
|
38113 | x: xmax,
|
38114 | y: ymin
|
38115 | });
|
38116 | }
|
38117 |
|
38118 | return points;
|
38119 | }
|
38120 |
|
38121 | function getRectPath(points) {
|
38122 | var path = [];
|
38123 | for (var i = 0; i < points.length; i++) {
|
38124 | var point = points[i];
|
38125 | if (point) {
|
38126 | var action = i === 0 ? 'M' : 'L';
|
38127 | path.push([action, point.x, point.y]);
|
38128 | }
|
38129 | }
|
38130 | var first = points[0];
|
38131 | path.push(['L', first.x, first.y]);
|
38132 | path.push(['z']);
|
38133 | return path;
|
38134 | }
|
38135 |
|
38136 | function getLinePoints(cfg) {
|
38137 | var x = cfg.x;
|
38138 | var y = cfg.y;
|
38139 | var y0 = cfg.y0;
|
38140 | var points = [];
|
38141 |
|
38142 | if (Util.isArray(y)) {
|
38143 | Util.each(y, function (yItem, idx) {
|
38144 | points.push({
|
38145 | x: Util.isArray(x) ? x[idx] : x,
|
38146 | y: yItem
|
38147 | });
|
38148 | });
|
38149 | } else {
|
38150 | points.push({
|
38151 | x: x,
|
38152 | y: y
|
38153 | }, {
|
38154 | x: x,
|
38155 | y: y0
|
38156 | });
|
38157 | }
|
38158 |
|
38159 | return points;
|
38160 | }
|
38161 |
|
38162 | function getTickPoints(cfg) {
|
38163 | var x = cfg.x;
|
38164 | var y = Util.isArray(cfg.y) ? cfg.y[1] : cfg.y;
|
38165 | var y0 = Util.isArray(cfg.y) ? cfg.y[0] : cfg.y0;
|
38166 |
|
38167 | var barWidth = cfg.size;
|
38168 | var points = [];
|
38169 |
|
38170 | points.push({
|
38171 | x: x - barWidth / 2,
|
38172 | y: y
|
38173 | }, {
|
38174 | x: x + barWidth / 2,
|
38175 | y: y
|
38176 | }, {
|
38177 | x: x,
|
38178 | y: y
|
38179 | }, {
|
38180 | x: x,
|
38181 | y: y0
|
38182 | }, {
|
38183 | x: x - barWidth / 2,
|
38184 | y: y0
|
38185 | }, {
|
38186 | x: x + barWidth / 2,
|
38187 | y: y0
|
38188 | });
|
38189 |
|
38190 | return points;
|
38191 | }
|
38192 |
|
38193 | function getTickPath(points) {
|
38194 | var path = [];
|
38195 | path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['M', points[2].x, points[2].y], ['L', points[3].x, points[3].y], ['M', points[4].x, points[4].y], ['L', points[5].x, points[5].y]);
|
38196 | return path;
|
38197 | }
|
38198 |
|
38199 | function getFillAttrs(cfg) {
|
38200 | var defaultAttrs = Global.shape.interval;
|
38201 | var attrs = Util.mix({}, defaultAttrs, {
|
38202 | fill: cfg.color,
|
38203 | stroke: cfg.color,
|
38204 | fillOpacity: cfg.opacity
|
38205 | }, cfg.style);
|
38206 | return attrs;
|
38207 | }
|
38208 |
|
38209 | function getLineAttrs(cfg) {
|
38210 | var defaultAttrs = Global.shape.hollowInterval;
|
38211 | var attrs = Util.mix({}, defaultAttrs, {
|
38212 | stroke: cfg.color,
|
38213 | strokeOpacity: cfg.opacity
|
38214 | }, cfg.style);
|
38215 | return attrs;
|
38216 | }
|
38217 |
|
38218 | function getFunnelPath(cfg, isFunnel) {
|
38219 | var path = [];
|
38220 | var points = cfg.points;
|
38221 | var nextPoints = cfg.nextPoints;
|
38222 | if (!Util.isNil(nextPoints)) {
|
38223 | path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', nextPoints[1].x, nextPoints[1].y], ['L', nextPoints[0].x, nextPoints[0].y], ['Z']);
|
38224 | } else if (isFunnel) {
|
38225 | path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', points[2].x, points[2].y], ['L', points[3].x, points[3].y], ['Z']);
|
38226 | } else {
|
38227 | path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', points[2].x, points[2].y], ['Z']);
|
38228 | }
|
38229 |
|
38230 | return path;
|
38231 | }
|
38232 |
|
38233 | function getThetaCfg(point, coord) {
|
38234 | var r = coord.getRadius();
|
38235 | var inner = coord.innerRadius;
|
38236 | var startAngle = void 0;
|
38237 | var endAngle = void 0;
|
38238 | var ir = r * inner;
|
38239 | var startPoint = void 0;
|
38240 | var endPoint = void 0;
|
38241 |
|
38242 | if (!Util.isArray(point.x) && Util.isArray(point.y)) {
|
38243 | point.x = [point.x, point.x];
|
38244 | }
|
38245 | if (Util.isArray(point.x)) {
|
38246 | startPoint = {
|
38247 | x: point.x[0],
|
38248 | y: point.y[0]
|
38249 | };
|
38250 | endPoint = {
|
38251 | x: point.x[1],
|
38252 | y: point.y[1]
|
38253 | };
|
38254 | startAngle = PathUtil.getPointAngle(coord, startPoint);
|
38255 | endAngle = PathUtil.getPointAngle(coord, endPoint);
|
38256 | if (endAngle <= startAngle) {
|
38257 |
|
38258 | endAngle = endAngle + Math.PI * 2;
|
38259 | }
|
38260 | } else {
|
38261 | endPoint = point;
|
38262 | startAngle = coord.startAngle;
|
38263 | endAngle = PathUtil.getPointAngle(coord, endPoint);
|
38264 | }
|
38265 | return {
|
38266 | r: r,
|
38267 | ir: ir,
|
38268 | startAngle: startAngle,
|
38269 | endAngle: endAngle
|
38270 | };
|
38271 | }
|
38272 |
|
38273 |
|
38274 | function _getSelectedCfg(type, cfg) {
|
38275 | var geom = cfg.geom;
|
38276 | var coord = geom.get('coord');
|
38277 | var point = cfg.point;
|
38278 | var r = 7.5;
|
38279 | var selectedCfg = void 0;
|
38280 | if (coord && coord.type === 'theta') {
|
38281 | var thetaCfg = getThetaCfg(point, coord);
|
38282 | var middleAngle = (thetaCfg.endAngle - thetaCfg.startAngle) / 2 + thetaCfg.startAngle;
|
38283 | var x = r * Math.cos(middleAngle);
|
38284 | var y = r * Math.sin(middleAngle);
|
38285 | selectedCfg = {
|
38286 | transform: [['t', x, y]]
|
38287 | };
|
38288 | }
|
38289 | return Util.mix({}, selectedCfg);
|
38290 | }
|
38291 |
|
38292 | var Interval = Shape.registerFactory('interval', {
|
38293 | defaultShapeType: 'rect',
|
38294 | getActiveCfg: function getActiveCfg(type, cfg) {
|
38295 | if (!type || Util.inArray(['rect', 'funnel', 'pyramid'], type)) {
|
38296 |
|
38297 | var fillOpacity = cfg.fillOpacity || cfg.opacity || 1;
|
38298 | return {
|
38299 | fillOpacity: fillOpacity - 0.15
|
38300 | };
|
38301 | }
|
38302 | var lineWidth = cfg.lineWidth || 0;
|
38303 | return {
|
38304 | lineWidth: lineWidth + 1
|
38305 | };
|
38306 | },
|
38307 | getDefaultPoints: function getDefaultPoints(pointInfo) {
|
38308 | return getRectPoints(pointInfo);
|
38309 | },
|
38310 | getSelectedCfg: function getSelectedCfg(type, cfg) {
|
38311 | return _getSelectedCfg(type, cfg);
|
38312 | }
|
38313 | });
|
38314 |
|
38315 |
|
38316 | Shape.registerShape('interval', 'rect', {
|
38317 | draw: function draw(cfg, container) {
|
38318 | var attrs = getFillAttrs(cfg);
|
38319 | var path = getRectPath(cfg.points);
|
38320 | path = this.parsePath(path);
|
38321 | return container.addShape('path', {
|
38322 | attrs: Util.mix(attrs, {
|
38323 | path: path
|
38324 | })
|
38325 | });
|
38326 | },
|
38327 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38328 | var rectCfg = getFillAttrs(cfg);
|
38329 | var isInCircle = cfg.isInCircle;
|
38330 | return Util.mix({
|
38331 | symbol: isInCircle ? 'circle' : 'square',
|
38332 | radius: isInCircle ? 4.5 : 4
|
38333 | }, rectCfg);
|
38334 | }
|
38335 | });
|
38336 |
|
38337 |
|
38338 | Shape.registerShape('interval', 'hollowRect', {
|
38339 | draw: function draw(cfg, container) {
|
38340 | var attrs = getLineAttrs(cfg);
|
38341 | var path = getRectPath(cfg.points);
|
38342 | path = this.parsePath(path);
|
38343 | return container.addShape('path', {
|
38344 | attrs: Util.mix(attrs, {
|
38345 | path: path
|
38346 | })
|
38347 | });
|
38348 | },
|
38349 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38350 | var rectCfg = getLineAttrs(cfg);
|
38351 | var isInCircle = cfg.isInCircle;
|
38352 | return Util.mix({
|
38353 | symbol: isInCircle ? 'circle' : 'square',
|
38354 | radius: isInCircle ? 4.5 : 4
|
38355 | }, rectCfg);
|
38356 | }
|
38357 | });
|
38358 |
|
38359 |
|
38360 | Shape.registerShape('interval', 'line', {
|
38361 | getPoints: function getPoints(pointInfo) {
|
38362 | return getLinePoints(pointInfo);
|
38363 | },
|
38364 | draw: function draw(cfg, container) {
|
38365 | var attrs = getLineAttrs(cfg);
|
38366 | attrs.lineWidth = cfg.size || 1;
|
38367 | var path = getRectPath(cfg.points);
|
38368 | path = this.parsePath(path);
|
38369 | return container.addShape('path', {
|
38370 | attrs: Util.mix(attrs, {
|
38371 | path: path
|
38372 | })
|
38373 | });
|
38374 | },
|
38375 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38376 | var lineCfg = getLineAttrs(cfg);
|
38377 | return Util.mix({
|
38378 | symbol: 'line',
|
38379 | radius: 5
|
38380 | }, lineCfg);
|
38381 | }
|
38382 | });
|
38383 |
|
38384 |
|
38385 | Shape.registerShape('interval', 'tick', {
|
38386 | getPoints: function getPoints(pointInfo) {
|
38387 | return getTickPoints(pointInfo);
|
38388 | },
|
38389 | draw: function draw(cfg, container) {
|
38390 | var attrs = getLineAttrs(cfg);
|
38391 | var path = getTickPath(cfg.points);
|
38392 | path = this.parsePath(path);
|
38393 | return container.addShape('path', {
|
38394 | attrs: Util.mix(attrs, {
|
38395 | path: path
|
38396 | })
|
38397 | });
|
38398 | },
|
38399 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38400 | var lineCfg = getLineAttrs(cfg);
|
38401 | return Util.mix({
|
38402 | symbol: 'tick',
|
38403 | radius: 5
|
38404 | }, lineCfg);
|
38405 | }
|
38406 | });
|
38407 |
|
38408 |
|
38409 | Shape.registerShape('interval', 'funnel', {
|
38410 | getPoints: function getPoints(pointInfo) {
|
38411 | pointInfo.size = pointInfo.size * 2;
|
38412 | return getRectPoints(pointInfo);
|
38413 | },
|
38414 | draw: function draw(cfg, container) {
|
38415 | var attrs = getFillAttrs(cfg);
|
38416 | var path = getFunnelPath(cfg, true);
|
38417 | path = this.parsePath(path);
|
38418 | return container.addShape('path', {
|
38419 | attrs: Util.mix(attrs, {
|
38420 | path: path
|
38421 | })
|
38422 | });
|
38423 | },
|
38424 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38425 | var funnelCfg = getFillAttrs(cfg);
|
38426 | return Util.mix({
|
38427 | symbol: 'square',
|
38428 | radius: 4
|
38429 | }, funnelCfg);
|
38430 | }
|
38431 | });
|
38432 |
|
38433 |
|
38434 | Shape.registerShape('interval', 'pyramid', {
|
38435 | getPoints: function getPoints(pointInfo) {
|
38436 | pointInfo.size = pointInfo.size * 2;
|
38437 | return getRectPoints(pointInfo, true);
|
38438 | },
|
38439 | draw: function draw(cfg, container) {
|
38440 | var attrs = getFillAttrs(cfg);
|
38441 | var path = getFunnelPath(cfg, false);
|
38442 | path = this.parsePath(path);
|
38443 | return container.addShape('path', {
|
38444 | attrs: Util.mix(attrs, {
|
38445 | path: path
|
38446 | })
|
38447 | });
|
38448 | },
|
38449 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38450 | var funnelCfg = getFillAttrs(cfg);
|
38451 | return Util.mix({
|
38452 | symbol: 'square',
|
38453 | radius: 4
|
38454 | }, funnelCfg);
|
38455 | }
|
38456 | });
|
38457 | module.exports = Interval;
|
38458 |
|
38459 | }),
|
38460 |
|
38461 | (function(module, exports, __webpack_require__) {
|
38462 |
|
38463 |
|
38464 |
|
38465 |
|
38466 |
|
38467 |
|
38468 |
|
38469 |
|
38470 | var Util = __webpack_require__(0);
|
38471 | var PathUtil = __webpack_require__(14);
|
38472 | var ShapeUtil = __webpack_require__(67);
|
38473 | var Shape = __webpack_require__(10);
|
38474 | var Global = __webpack_require__(1);
|
38475 | var DOT_ARR = [1, 1];
|
38476 | var DASH_ARR = [5.5, 1];
|
38477 |
|
38478 | function getAttrs(cfg) {
|
38479 | var defaultCfg = Global.shape.line;
|
38480 | var shapeCfg = Util.mix({}, defaultCfg, {
|
38481 | stroke: cfg.color,
|
38482 | lineWidth: cfg.size,
|
38483 | strokeOpacity: cfg.opacity,
|
38484 | opacity: cfg.opacity
|
38485 | }, cfg.style);
|
38486 | return shapeCfg;
|
38487 | }
|
38488 |
|
38489 | function getMarkerAttrs(cfg) {
|
38490 | var defaultCfg = Global.shape.line;
|
38491 | var shapeCfg = Util.mix({}, defaultCfg, {
|
38492 | stroke: cfg.color,
|
38493 | lineWidth: 2,
|
38494 | strokeOpacity: cfg.opacity,
|
38495 | opacity: cfg.opacity,
|
38496 | radius: 6
|
38497 | }, cfg.style);
|
38498 | return shapeCfg;
|
38499 | }
|
38500 |
|
38501 |
|
38502 | function getRangePath(points, smooth, isInCircle, cfg) {
|
38503 | var topPoints = [];
|
38504 | var isStack = cfg.isStack;
|
38505 | var bottomPoints = [];
|
38506 | for (var i = 0; i < points.length; i++) {
|
38507 | var point = points[i];
|
38508 | var tmp = ShapeUtil.splitPoints(point);
|
38509 | bottomPoints.push(tmp[0]);
|
38510 | topPoints.push(tmp[1]);
|
38511 | }
|
38512 | var topPath = getSinglePath(topPoints, smooth, isInCircle, cfg);
|
38513 | var bottomPath = getSinglePath(bottomPoints, smooth, isInCircle, cfg);
|
38514 | if (isStack) {
|
38515 | return topPath;
|
38516 | }
|
38517 | return topPath.concat(bottomPath);
|
38518 | }
|
38519 |
|
38520 |
|
38521 | function getSinglePath(points, smooth, isInCircle, cfg) {
|
38522 | var path = void 0;
|
38523 | if (!smooth) {
|
38524 | path = PathUtil.getLinePath(points, false);
|
38525 | if (isInCircle) {
|
38526 | path.push(['Z']);
|
38527 | }
|
38528 | } else {
|
38529 |
|
38530 | var constraint = cfg.constraint;
|
38531 | if (isInCircle && points.length) {
|
38532 | points.push({ x: points[0].x, y: points[0].y });
|
38533 | }
|
38534 | path = PathUtil.getSplinePath(points, false, constraint);
|
38535 | }
|
38536 |
|
38537 | return path;
|
38538 | }
|
38539 |
|
38540 | function getPath(cfg, smooth) {
|
38541 | var path = void 0;
|
38542 | var points = cfg.points;
|
38543 | var isInCircle = cfg.isInCircle;
|
38544 | var first = points[0];
|
38545 | if (Util.isArray(first.y)) {
|
38546 | path = getRangePath(points, smooth, isInCircle, cfg);
|
38547 | } else {
|
38548 | path = getSinglePath(points, smooth, isInCircle, cfg);
|
38549 | }
|
38550 | return path;
|
38551 | }
|
38552 |
|
38553 | function _interpPoints(points, fn) {
|
38554 | var tmpPoints = [];
|
38555 | Util.each(points, function (point, index) {
|
38556 | var nextPoint = points[index + 1];
|
38557 | tmpPoints.push(point);
|
38558 | if (nextPoint) {
|
38559 | tmpPoints = tmpPoints.concat(fn(point, nextPoint));
|
38560 | }
|
38561 | });
|
38562 | return tmpPoints;
|
38563 | }
|
38564 |
|
38565 | function _getInterPath(points) {
|
38566 | var path = [];
|
38567 | Util.each(points, function (point, index) {
|
38568 | var subPath = index === 0 ? ['M', point.x, point.y] : ['L', point.x, point.y];
|
38569 | path.push(subPath);
|
38570 | });
|
38571 | return path;
|
38572 | }
|
38573 |
|
38574 | function _getInterPointShapeCfg(cfg, fn) {
|
38575 | var points = _interpPoints(cfg.points, fn);
|
38576 | return _getInterPath(points);
|
38577 | }
|
38578 |
|
38579 | function _markerFn(x, y, r, ctx) {
|
38580 | ctx.moveTo(x - r, y);
|
38581 | ctx.lineTo(x + r, y);
|
38582 | }
|
38583 |
|
38584 | function _smoothMarkerFn(x, y, r, ctx) {
|
38585 | ctx.moveTo(x - r, y);
|
38586 | ctx.arcTo(x - r / 2, y - r / 2, x, y, r / 2);
|
38587 | ctx.lineTo(x, y);
|
38588 | ctx.arcTo(x + r / 2, y + r / 2, x + r, y - r / 2, r / 2);
|
38589 | }
|
38590 |
|
38591 | function _getMarkerCfg(cfg, smooth) {
|
38592 | return Util.mix({
|
38593 | symbol: smooth ? _smoothMarkerFn : _markerFn
|
38594 | }, getMarkerAttrs(cfg));
|
38595 | }
|
38596 |
|
38597 | function _getInterMarkerCfg(cfg, fn) {
|
38598 | return Util.mix({
|
38599 | symbol: fn
|
38600 | }, getMarkerAttrs(cfg));
|
38601 | }
|
38602 |
|
38603 |
|
38604 | function drawPointShape(shapeObj, cfg, container) {
|
38605 | var point = cfg.points[0];
|
38606 | return container.addShape('circle', {
|
38607 | attrs: Util.mix({
|
38608 | x: point.x,
|
38609 | y: point.y,
|
38610 | r: 2,
|
38611 | fill: cfg.color
|
38612 | }, cfg.style)
|
38613 | });
|
38614 | }
|
38615 |
|
38616 |
|
38617 | var Line = Shape.registerFactory('line', {
|
38618 |
|
38619 | defaultShapeType: 'line',
|
38620 | getMarkerCfg: function getMarkerCfg(type, cfg) {
|
38621 | var lineObj = Line[type] || Line.line;
|
38622 | return lineObj.getMarkerCfg(cfg);
|
38623 | },
|
38624 | getActiveCfg: function getActiveCfg(type, cfg) {
|
38625 | var lineWidth = cfg.lineWidth || 0;
|
38626 | return {
|
38627 | lineWidth: lineWidth + 1
|
38628 | };
|
38629 | },
|
38630 |
|
38631 |
|
38632 | getDefaultPoints: function getDefaultPoints(pointInfo) {
|
38633 | return ShapeUtil.splitPoints(pointInfo);
|
38634 | },
|
38635 | drawShape: function drawShape(type, cfg, container) {
|
38636 | var shape = this.getShape(type);
|
38637 | var gShape = void 0;
|
38638 | if (cfg.points.length === 1 && Global.showSinglePoint) {
|
38639 | gShape = drawPointShape(this, cfg, container);
|
38640 | } else {
|
38641 | gShape = shape.draw(cfg, container);
|
38642 | }
|
38643 | if (gShape) {
|
38644 | gShape.set('origin', cfg.origin);
|
38645 | gShape._id = cfg.splitedIndex ? cfg._id + cfg.splitedIndex : cfg._id;
|
38646 | gShape.name = this.name;
|
38647 | }
|
38648 | return gShape;
|
38649 | }
|
38650 | });
|
38651 |
|
38652 |
|
38653 | Shape.registerShape('line', 'line', {
|
38654 | draw: function draw(cfg, container) {
|
38655 | var attrs = getAttrs(cfg);
|
38656 | var path = getPath(cfg, false);
|
38657 | return container.addShape('path', {
|
38658 | attrs: Util.mix(attrs, {
|
38659 | path: path
|
38660 | })
|
38661 | });
|
38662 | },
|
38663 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38664 | return _getMarkerCfg(cfg);
|
38665 | }
|
38666 | });
|
38667 |
|
38668 |
|
38669 | Shape.registerShape('line', 'dot', {
|
38670 | draw: function draw(cfg, container) {
|
38671 | var attrs = getAttrs(cfg);
|
38672 | var path = getPath(cfg, false);
|
38673 | return container.addShape('path', {
|
38674 | attrs: Util.mix(attrs, {
|
38675 | path: path,
|
38676 | lineDash: DOT_ARR
|
38677 | })
|
38678 | });
|
38679 | },
|
38680 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38681 | var tmp = _getMarkerCfg(cfg, false);
|
38682 | tmp.lineDash = DOT_ARR;
|
38683 | return tmp;
|
38684 | }
|
38685 | });
|
38686 |
|
38687 |
|
38688 | Shape.registerShape('line', 'dash', {
|
38689 | draw: function draw(cfg, container) {
|
38690 | var attrs = getAttrs(cfg);
|
38691 | var path = getPath(cfg, false);
|
38692 | return container.addShape('path', {
|
38693 | attrs: Util.mix(attrs, {
|
38694 | path: path,
|
38695 | lineDash: DASH_ARR
|
38696 | })
|
38697 | });
|
38698 | },
|
38699 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38700 | var tmp = _getMarkerCfg(cfg, false);
|
38701 | tmp.lineDash = DASH_ARR;
|
38702 | return tmp;
|
38703 | }
|
38704 | });
|
38705 |
|
38706 |
|
38707 | Shape.registerShape('line', 'smooth', {
|
38708 | draw: function draw(cfg, container) {
|
38709 | var attrs = getAttrs(cfg);
|
38710 | var coord = this._coord;
|
38711 |
|
38712 | cfg.constraint = [[coord.start.x, coord.end.y], [coord.end.x, coord.start.y]];
|
38713 | var path = getPath(cfg, true);
|
38714 | return container.addShape('path', {
|
38715 | attrs: Util.mix(attrs, {
|
38716 | path: path
|
38717 | })
|
38718 | });
|
38719 | },
|
38720 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38721 | return _getMarkerCfg(cfg, true);
|
38722 | }
|
38723 | });
|
38724 |
|
38725 | Shape.registerShape('line', 'hv', {
|
38726 | draw: function draw(cfg, container) {
|
38727 | var attrs = getAttrs(cfg);
|
38728 | var path = _getInterPointShapeCfg(cfg, function (point, nextPoint) {
|
38729 | var tmp = [];
|
38730 | tmp.push({
|
38731 | x: nextPoint.x,
|
38732 | y: point.y
|
38733 | });
|
38734 | return tmp;
|
38735 | });
|
38736 | return container.addShape('path', {
|
38737 | attrs: Util.mix(attrs, {
|
38738 | path: path
|
38739 | })
|
38740 | });
|
38741 | },
|
38742 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38743 | return _getInterMarkerCfg(cfg, function (x, y, r, ctx) {
|
38744 | ctx.moveTo(x - r - 1, y - 2.5);
|
38745 | ctx.lineTo(x, y - 2.5);
|
38746 | ctx.lineTo(x, y + 2.5);
|
38747 | ctx.lineTo(x + r + 1, y + 2.5);
|
38748 | });
|
38749 | }
|
38750 | });
|
38751 |
|
38752 | Shape.registerShape('line', 'vh', {
|
38753 | draw: function draw(cfg, container) {
|
38754 | var attrs = getAttrs(cfg);
|
38755 | var path = _getInterPointShapeCfg(cfg, function (point, nextPoint) {
|
38756 | var tmp = [];
|
38757 | tmp.push({
|
38758 | x: point.x,
|
38759 | y: nextPoint.y
|
38760 | });
|
38761 | return tmp;
|
38762 | });
|
38763 | return container.addShape('path', {
|
38764 | attrs: Util.mix(attrs, {
|
38765 | path: path
|
38766 | })
|
38767 | });
|
38768 | },
|
38769 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38770 | return _getInterMarkerCfg(cfg, function (x, y, r, ctx) {
|
38771 | ctx.moveTo(x - r - 1, y + 2.5);
|
38772 | ctx.lineTo(x, y + 2.5);
|
38773 | ctx.lineTo(x, y - 2.5);
|
38774 | ctx.lineTo(x + r + 1, y - 2.5);
|
38775 | });
|
38776 | }
|
38777 | });
|
38778 |
|
38779 | Shape.registerShape('line', 'hvh', {
|
38780 | draw: function draw(cfg, container) {
|
38781 | var attrs = getAttrs(cfg);
|
38782 | var path = _getInterPointShapeCfg(cfg, function (point, nextPoint) {
|
38783 | var tmp = [];
|
38784 | var middlex = (nextPoint.x - point.x) / 2 + point.x;
|
38785 | tmp.push({
|
38786 | x: middlex,
|
38787 | y: point.y
|
38788 | });
|
38789 | tmp.push({
|
38790 | x: middlex,
|
38791 | y: nextPoint.y
|
38792 | });
|
38793 | return tmp;
|
38794 | });
|
38795 | return container.addShape('path', {
|
38796 | attrs: Util.mix(attrs, {
|
38797 | path: path
|
38798 | })
|
38799 | });
|
38800 | },
|
38801 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38802 | return _getInterMarkerCfg(cfg, function (x, y, r, ctx) {
|
38803 | ctx.moveTo(x - (r + 1), y + 2.5);
|
38804 | ctx.lineTo(x - r / 2, y + 2.5);
|
38805 | ctx.lineTo(x - r / 2, y - 2.5);
|
38806 | ctx.lineTo(x + r / 2, y - 2.5);
|
38807 | ctx.lineTo(x + r / 2, y + 2.5);
|
38808 | ctx.lineTo(x + r + 1, y + 2.5);
|
38809 | });
|
38810 | }
|
38811 | });
|
38812 |
|
38813 | Shape.registerShape('line', 'vhv', {
|
38814 | draw: function draw(cfg, container) {
|
38815 | var attrs = getAttrs(cfg);
|
38816 | var path = _getInterPointShapeCfg(cfg, function (point, nextPoint) {
|
38817 | var tmp = [];
|
38818 | var middley = (nextPoint.y - point.y) / 2 + point.y;
|
38819 | tmp.push({
|
38820 | x: point.x,
|
38821 | y: middley
|
38822 | });
|
38823 | tmp.push({
|
38824 | x: nextPoint.x,
|
38825 | y: middley
|
38826 | });
|
38827 | return tmp;
|
38828 | });
|
38829 | return container.addShape('path', {
|
38830 | attrs: Util.mix(attrs, {
|
38831 | path: path
|
38832 | })
|
38833 | });
|
38834 | },
|
38835 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38836 | return _getInterMarkerCfg(cfg, function (x, y, r, ctx) {
|
38837 |
|
38838 | ctx.moveTo(x - 5, y + 2.5);
|
38839 | ctx.lineTo(x - 5, y);
|
38840 | ctx.lineTo(x, y);
|
38841 | ctx.lineTo(x, y - 3);
|
38842 | ctx.lineTo(x, y + 3);
|
38843 | ctx.lineTo(x + 6.5, y + 3);
|
38844 | });
|
38845 | }
|
38846 | });
|
38847 |
|
38848 | Line.spline = Line.smooth;
|
38849 |
|
38850 | module.exports = Line;
|
38851 |
|
38852 | }),
|
38853 |
|
38854 | (function(module, exports, __webpack_require__) {
|
38855 |
|
38856 |
|
38857 |
|
38858 |
|
38859 |
|
38860 |
|
38861 |
|
38862 |
|
38863 | var Util = __webpack_require__(0);
|
38864 | var ShapeUtil = __webpack_require__(67);
|
38865 | var Marker = __webpack_require__(2).Marker;
|
38866 | var Global = __webpack_require__(1);
|
38867 | var Shape = __webpack_require__(10);
|
38868 | var SHAPES = ['circle', 'square', 'bowtie', 'diamond', 'hexagon', 'triangle', 'triangle-down'];
|
38869 | var HOLLOW_SHAPES = ['cross', 'tick', 'plus', 'hyphen', 'line', 'pointerLine', 'pointerArrow'];
|
38870 | var SQRT_3 = Math.sqrt(3);
|
38871 |
|
38872 |
|
38873 | Util.mix(Marker.Symbols, {
|
38874 | hexagon: function hexagon(x, y, r, ctx) {
|
38875 | var diffX = r / 2 * SQRT_3;
|
38876 | ctx.moveTo(x, y - r);
|
38877 | ctx.lineTo(x + diffX, y - r / 2);
|
38878 | ctx.lineTo(x + diffX, y + r / 2);
|
38879 | ctx.lineTo(x, y + r);
|
38880 | ctx.lineTo(x - diffX, y + r / 2);
|
38881 | ctx.lineTo(x - diffX, y - r / 2);
|
38882 | ctx.closePath();
|
38883 | },
|
38884 | bowtie: function bowtie(x, y, r, ctx) {
|
38885 | var diffY = r - 1.5;
|
38886 | ctx.moveTo(x - r, y - diffY);
|
38887 | ctx.lineTo(x + r, y + diffY);
|
38888 | ctx.lineTo(x + r, y - diffY);
|
38889 | ctx.lineTo(x - r, y + diffY);
|
38890 | ctx.closePath();
|
38891 | },
|
38892 | cross: function cross(x, y, r, ctx) {
|
38893 | ctx.moveTo(x - r, y - r);
|
38894 | ctx.lineTo(x + r, y + r);
|
38895 | ctx.moveTo(x + r, y - r);
|
38896 | ctx.lineTo(x - r, y + r);
|
38897 | },
|
38898 | tick: function tick(x, y, r, ctx) {
|
38899 | ctx.moveTo(x - r / 2, y - r);
|
38900 | ctx.lineTo(x + r / 2, y - r);
|
38901 | ctx.moveTo(x, y - r);
|
38902 | ctx.lineTo(x, y + r);
|
38903 | ctx.moveTo(x - r / 2, y + r);
|
38904 | ctx.lineTo(x + r / 2, y + r);
|
38905 | },
|
38906 | plus: function plus(x, y, r, ctx) {
|
38907 | ctx.moveTo(x - r, y);
|
38908 | ctx.lineTo(x + r, y);
|
38909 | ctx.moveTo(x, y - r);
|
38910 | ctx.lineTo(x, y + r);
|
38911 | },
|
38912 | hyphen: function hyphen(x, y, r, ctx) {
|
38913 | ctx.moveTo(x - r, y);
|
38914 | ctx.lineTo(x + r, y);
|
38915 | },
|
38916 | line: function line(x, y, r, ctx) {
|
38917 | ctx.moveTo(x, y - r);
|
38918 | ctx.lineTo(x, y + r);
|
38919 | }
|
38920 | });
|
38921 |
|
38922 | function getFillAttrs(cfg) {
|
38923 | var defaultAttrs = Global.shape.point;
|
38924 | var pointAttrs = Util.mix({}, defaultAttrs, {
|
38925 | fill: cfg.color,
|
38926 | fillOpacity: cfg.opacity,
|
38927 | radius: cfg.size
|
38928 | }, cfg.style);
|
38929 | return pointAttrs;
|
38930 | }
|
38931 |
|
38932 | function getLineAttrs(cfg) {
|
38933 | var defaultAttrs = Global.shape.hollowPoint;
|
38934 | var pointAttrs = Util.mix({}, defaultAttrs, {
|
38935 | stroke: cfg.color,
|
38936 | strokeOpacity: cfg.opacity,
|
38937 | radius: cfg.size
|
38938 | }, cfg.style);
|
38939 | return pointAttrs;
|
38940 | }
|
38941 |
|
38942 | var Point = Shape.registerFactory('point', {
|
38943 | defaultShapeType: 'hollowCircle',
|
38944 | getActiveCfg: function getActiveCfg(type, cfg) {
|
38945 |
|
38946 | var radius = cfg.radius;
|
38947 | var color = void 0;
|
38948 | if (type && (type.indexOf('hollow') === 0 || Util.indexOf(HOLLOW_SHAPES, type) !== -1) || !type) {
|
38949 | color = cfg.stroke || cfg.strokeStyle;
|
38950 | } else {
|
38951 | color = cfg.fill || cfg.fillStyle;
|
38952 | }
|
38953 |
|
38954 | return {
|
38955 | radius: radius + 1,
|
38956 | shadowBlur: radius,
|
38957 | shadowColor: color,
|
38958 | stroke: color,
|
38959 | strokeStyle: color,
|
38960 | strokeOpacity: 1,
|
38961 | lineWidth: 1
|
38962 | };
|
38963 | },
|
38964 | getDefaultPoints: function getDefaultPoints(pointInfo) {
|
38965 | return ShapeUtil.splitPoints(pointInfo);
|
38966 | }
|
38967 | });
|
38968 |
|
38969 | function getRectPath(cfg) {
|
38970 | var x = cfg.points[0].x;
|
38971 | var y = cfg.points[0].y;
|
38972 | var w = cfg.size[0];
|
38973 | var h = cfg.size[1];
|
38974 | var path = [['M', x - 0.5 * w, y - 0.5 * h], ['L', x + 0.5 * w, y - 0.5 * h], ['L', x + 0.5 * w, y + 0.5 * h], ['L', x - 0.5 * w, y + 0.5 * h], ['z']];
|
38975 | return path;
|
38976 | }
|
38977 |
|
38978 |
|
38979 | Shape.registerShape('point', 'rect', {
|
38980 | draw: function draw(cfg, container) {
|
38981 | var rectAttrs = getFillAttrs(cfg);
|
38982 | var path = getRectPath(cfg);
|
38983 | path = this.parsePath(path);
|
38984 | var gShape = container.addShape('path', {
|
38985 | attrs: Util.mix(rectAttrs, {
|
38986 | path: path
|
38987 | })
|
38988 | });
|
38989 | return gShape;
|
38990 | },
|
38991 | getMarkerCfg: function getMarkerCfg(cfg) {
|
38992 | var attrs = getFillAttrs(cfg);
|
38993 | attrs.symbol = 'rect';
|
38994 | attrs.radius = 4.5;
|
38995 | return attrs;
|
38996 | }
|
38997 | });
|
38998 |
|
38999 |
|
39000 | Util.each(SHAPES, function (shape) {
|
39001 | Shape.registerShape('point', shape, {
|
39002 | draw: function draw(cfg, container) {
|
39003 |
|
39004 | var attrs = getFillAttrs(cfg);
|
39005 | return container.addShape('Marker', {
|
39006 | attrs: Util.mix(attrs, {
|
39007 | symbol: shape,
|
39008 | x: cfg.x,
|
39009 | y: cfg.y
|
39010 | })
|
39011 | });
|
39012 | },
|
39013 | getMarkerCfg: function getMarkerCfg(cfg) {
|
39014 | var attrs = getFillAttrs(cfg);
|
39015 | attrs.symbol = shape;
|
39016 | attrs.radius = 4.5;
|
39017 | return attrs;
|
39018 | }
|
39019 | });
|
39020 |
|
39021 | Shape.registerShape('point', 'hollow' + Util.upperFirst(shape), {
|
39022 | draw: function draw(cfg, container) {
|
39023 |
|
39024 | var attrs = getLineAttrs(cfg);
|
39025 | return container.addShape('Marker', {
|
39026 | attrs: Util.mix(attrs, {
|
39027 | symbol: shape,
|
39028 | x: cfg.x,
|
39029 | y: cfg.y
|
39030 | })
|
39031 | });
|
39032 | },
|
39033 | getMarkerCfg: function getMarkerCfg(cfg) {
|
39034 | var attrs = getLineAttrs(cfg);
|
39035 | attrs.symbol = shape;
|
39036 | attrs.radius = 4.5;
|
39037 | return attrs;
|
39038 | }
|
39039 | });
|
39040 | });
|
39041 |
|
39042 |
|
39043 | Util.each(HOLLOW_SHAPES, function (shape) {
|
39044 | Shape.registerShape('point', shape, {
|
39045 | draw: function draw(cfg, container) {
|
39046 | var attrs = getLineAttrs(cfg);
|
39047 | return container.addShape('Marker', {
|
39048 | attrs: Util.mix(attrs, {
|
39049 | symbol: shape,
|
39050 | x: cfg.x,
|
39051 | y: cfg.y
|
39052 | })
|
39053 | });
|
39054 | },
|
39055 | getMarkerCfg: function getMarkerCfg(cfg) {
|
39056 | var attrs = getLineAttrs(cfg);
|
39057 | attrs.symbol = shape;
|
39058 | attrs.radius = 4.5;
|
39059 | return attrs;
|
39060 | }
|
39061 | });
|
39062 | });
|
39063 |
|
39064 | module.exports = Point;
|
39065 |
|
39066 | }),
|
39067 |
|
39068 | (function(module, exports, __webpack_require__) {
|
39069 |
|
39070 |
|
39071 |
|
39072 |
|
39073 |
|
39074 |
|
39075 |
|
39076 |
|
39077 | var Util = __webpack_require__(0);
|
39078 | var Shape = __webpack_require__(10);
|
39079 | var Global = __webpack_require__(1);
|
39080 |
|
39081 | function getAttrs(cfg) {
|
39082 | var defaultCfg = Global.shape.polygon;
|
39083 | var shapeCfg = Util.mix({}, defaultCfg, {
|
39084 | stroke: cfg.color,
|
39085 | fill: cfg.color,
|
39086 | fillOpacity: cfg.opacity
|
39087 | }, cfg.style);
|
39088 | return shapeCfg;
|
39089 | }
|
39090 |
|
39091 | function getHollowAttrs(cfg) {
|
39092 | var defaultCfg = Global.shape.hollowPolygon;
|
39093 | var shapeCfg = Util.mix({}, defaultCfg, {
|
39094 | stroke: cfg.color,
|
39095 | strokeOpacity: cfg.opacity
|
39096 | }, cfg.style);
|
39097 | return shapeCfg;
|
39098 | }
|
39099 | function getPath(points) {
|
39100 | var path = [];
|
39101 | var flag = [points[0].x, points[0].y];
|
39102 | var flagIndex = 0;
|
39103 | var lastStartPoint = points[0];
|
39104 | Util.each(points, function (obj, index) {
|
39105 | var subPath = index === 0 ? ['M', obj.x, obj.y] : ['L', obj.x, obj.y];
|
39106 | path.push(subPath);
|
39107 | if (flagIndex !== index && index < points.length - 1 && Util.isEqualWith(flag, [obj.x, obj.y])) {
|
39108 | var nextPoint = points[index + 1];
|
39109 | path.push(['Z']);
|
39110 | path.push(['M', nextPoint.x, nextPoint.y]);
|
39111 | lastStartPoint = nextPoint;
|
39112 | flagIndex = index + 1;
|
39113 | flag = [nextPoint.x, nextPoint.y];
|
39114 | }
|
39115 | });
|
39116 | path.push(['L', lastStartPoint.x, lastStartPoint.y]);
|
39117 | path.push(['Z']);
|
39118 |
|
39119 | return path;
|
39120 | }
|
39121 |
|
39122 |
|
39123 | var Polygon = Shape.registerFactory('polygon', {
|
39124 | defaultShapeType: 'polygon',
|
39125 | getDefaultPoints: function getDefaultPoints(pointInfo) {
|
39126 | var points = [];
|
39127 | Util.each(pointInfo.x, function (subX, index) {
|
39128 | var subY = pointInfo.y[index];
|
39129 | points.push({
|
39130 | x: subX,
|
39131 | y: subY
|
39132 | });
|
39133 | });
|
39134 | return points;
|
39135 | },
|
39136 | getActiveCfg: function getActiveCfg(type, cfg) {
|
39137 | var lineWidth = cfg.lineWidth || 1;
|
39138 | if (type === 'hollow') {
|
39139 | return {
|
39140 | lineWidth: lineWidth + 1
|
39141 | };
|
39142 | }
|
39143 |
|
39144 | var opacity = cfg.fillOpacity || cfg.opacity || 1;
|
39145 | return {
|
39146 |
|
39147 | fillOpacity: opacity - 0.08
|
39148 | };
|
39149 | },
|
39150 | getSelectedCfg: function getSelectedCfg(type, cfg) {
|
39151 | if (cfg && cfg.style) {
|
39152 | return cfg.style;
|
39153 | }
|
39154 | return this.getActiveCfg(type, cfg);
|
39155 | }
|
39156 | });
|
39157 |
|
39158 | Shape.registerShape('polygon', 'polygon', {
|
39159 | draw: function draw(cfg, container) {
|
39160 | if (!Util.isEmpty(cfg.points)) {
|
39161 | var attrs = getAttrs(cfg);
|
39162 | var path = getPath(cfg.points);
|
39163 | path = this.parsePath(path);
|
39164 | return container.addShape('path', {
|
39165 | attrs: Util.mix(attrs, {
|
39166 | path: path
|
39167 | })
|
39168 | });
|
39169 | }
|
39170 | },
|
39171 | getMarkerCfg: function getMarkerCfg(cfg) {
|
39172 | return Util.mix({
|
39173 | symbol: 'square',
|
39174 | radius: 4
|
39175 | }, getAttrs(cfg));
|
39176 | }
|
39177 | });
|
39178 |
|
39179 | Shape.registerShape('polygon', 'hollow', {
|
39180 | draw: function draw(cfg, container) {
|
39181 | if (!Util.isEmpty(cfg.points)) {
|
39182 | var attrs = getHollowAttrs(cfg);
|
39183 | var path = getPath(cfg.points);
|
39184 | path = this.parsePath(path);
|
39185 |
|
39186 | return container.addShape('path', {
|
39187 | attrs: Util.mix(attrs, {
|
39188 | path: path
|
39189 | })
|
39190 | });
|
39191 | }
|
39192 | },
|
39193 | getMarkerCfg: function getMarkerCfg(cfg) {
|
39194 | return Util.mix({
|
39195 | symbol: 'square',
|
39196 | radius: 4
|
39197 | }, getAttrs(cfg));
|
39198 | }
|
39199 | });
|
39200 |
|
39201 | module.exports = Polygon;
|
39202 |
|
39203 | }),
|
39204 |
|
39205 | (function(module, exports, __webpack_require__) {
|
39206 |
|
39207 |
|
39208 |
|
39209 |
|
39210 |
|
39211 |
|
39212 |
|
39213 | var Util = __webpack_require__(0);
|
39214 | var Shape = __webpack_require__(10);
|
39215 | var Global = __webpack_require__(1);
|
39216 |
|
39217 | function _parseValue(value) {
|
39218 | if (!Util.isArray(value)) {
|
39219 | value = [value];
|
39220 | }
|
39221 | var min = value[0];
|
39222 | var max = value[value.length - 1];
|
39223 | var min1 = value.length > 1 ? value[1] : min;
|
39224 | var max1 = value.length > 3 ? value[3] : max;
|
39225 | var median = value.length > 2 ? value[2] : min1;
|
39226 |
|
39227 | return {
|
39228 | min: min,
|
39229 | max: max,
|
39230 | min1: min1,
|
39231 | max1: max1,
|
39232 | median: median
|
39233 | };
|
39234 | }
|
39235 |
|
39236 | function addPoints(from, to) {
|
39237 | Util.each(from, function (subArr) {
|
39238 | to.push({
|
39239 | x: subArr[0],
|
39240 | y: subArr[1]
|
39241 | });
|
39242 | });
|
39243 | }
|
39244 |
|
39245 | function getAttrs(cfg) {
|
39246 | var defaultAttrs = Global.shape.schema;
|
39247 | var attrs = Util.mix({}, defaultAttrs, {
|
39248 | stroke: cfg.color,
|
39249 | strokeOpacity: cfg.opacity
|
39250 | }, cfg.style);
|
39251 | return attrs;
|
39252 | }
|
39253 |
|
39254 | function getFillAttrs(cfg) {
|
39255 | var defaultAttrs = Global.shape.schema;
|
39256 | var attrs = Util.mix({}, defaultAttrs, {
|
39257 | fill: cfg.color,
|
39258 | stroke: cfg.color,
|
39259 | fillOpacity: cfg.opacity
|
39260 | }, cfg.style);
|
39261 | return attrs;
|
39262 | }
|
39263 |
|
39264 | function getBoxPoints(x, y, width) {
|
39265 | var points = [];
|
39266 | var pointsArray = void 0;
|
39267 | var obj = void 0;
|
39268 | if (Util.isArray(y)) {
|
39269 |
|
39270 | obj = _parseValue(y);
|
39271 | pointsArray = [[x - width / 2, obj.max], [x + width / 2, obj.max], [x, obj.max], [x, obj.max1], [x - width / 2, obj.min1], [x - width / 2, obj.max1], [x + width / 2, obj.max1], [x + width / 2, obj.min1], [x, obj.min1], [x, obj.min], [x - width / 2, obj.min], [x + width / 2, obj.min], [x - width / 2, obj.median], [x + width / 2, obj.median]];
|
39272 | } else {
|
39273 |
|
39274 | y = y || 0.5;
|
39275 | obj = _parseValue(x);
|
39276 | pointsArray = [[obj.min, y - width / 2], [obj.min, y + width / 2], [obj.min, y], [obj.min1, y], [obj.min1, y - width / 2], [obj.min1, y + width / 2], [obj.max1, y + width / 2], [obj.max1, y - width / 2], [obj.max1, y], [obj.max, y], [obj.max, y - width / 2], [obj.max, y + width / 2], [obj.median, y - width / 2], [obj.median, y + width / 2]];
|
39277 | }
|
39278 | addPoints(pointsArray, points);
|
39279 | return points;
|
39280 | }
|
39281 |
|
39282 | function _sortValue(value) {
|
39283 | if (!Util.isArray(value)) {
|
39284 | value = [value];
|
39285 | }
|
39286 |
|
39287 | var sorted = value.sort(function (a, b) {
|
39288 | return a < b ? 1 : -1;
|
39289 | });
|
39290 |
|
39291 | var length = sorted.length;
|
39292 | if (length < 4) {
|
39293 | var min = sorted[length - 1];
|
39294 | for (var i = 0; i < 4 - length; i++) {
|
39295 | sorted.push(min);
|
39296 | }
|
39297 | }
|
39298 |
|
39299 | return sorted;
|
39300 | }
|
39301 |
|
39302 |
|
39303 | function getCandlePoints(x, y, width) {
|
39304 | var yValues = _sortValue(y);
|
39305 | var points = [{
|
39306 | x: x,
|
39307 | y: yValues[0]
|
39308 | }, {
|
39309 | x: x,
|
39310 | y: yValues[1]
|
39311 | }, {
|
39312 | x: x - width / 2,
|
39313 | y: yValues[2]
|
39314 | }, {
|
39315 | x: x - width / 2,
|
39316 | y: yValues[1]
|
39317 | }, {
|
39318 | x: x + width / 2,
|
39319 | y: yValues[1]
|
39320 | }, {
|
39321 | x: x + width / 2,
|
39322 | y: yValues[2]
|
39323 | }, {
|
39324 | x: x,
|
39325 | y: yValues[2]
|
39326 | }, {
|
39327 | x: x,
|
39328 | y: yValues[3]
|
39329 | }];
|
39330 | return points;
|
39331 | }
|
39332 |
|
39333 | function getBoxPath(points) {
|
39334 | var path = [['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['M', points[2].x, points[2].y], ['L', points[3].x, points[3].y], ['M', points[4].x, points[4].y], ['L', points[5].x, points[5].y], ['L', points[6].x, points[6].y], ['L', points[7].x, points[7].y], ['L', points[4].x, points[4].y],
|
39335 | ['Z'], ['M', points[8].x, points[8].y], ['L', points[9].x, points[9].y], ['M', points[10].x, points[10].y], ['L', points[11].x, points[11].y], ['M', points[12].x, points[12].y], ['L', points[13].x, points[13].y]];
|
39336 | return path;
|
39337 | }
|
39338 |
|
39339 | function getCandlePath(points) {
|
39340 | var path = [['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['M', points[2].x, points[2].y], ['L', points[3].x, points[3].y], ['L', points[4].x, points[4].y], ['L', points[5].x, points[5].y], ['Z'], ['M', points[6].x, points[6].y], ['L', points[7].x, points[7].y]];
|
39341 | return path;
|
39342 | }
|
39343 |
|
39344 | var Schema = Shape.registerFactory('schema', {
|
39345 | defaultShapeType: '',
|
39346 | getActiveCfg: function getActiveCfg(type, cfg) {
|
39347 | if (type === 'box') {
|
39348 | var lineWidth = cfg.lineWidth || 1;
|
39349 | return {
|
39350 | lineWidth: lineWidth + 1
|
39351 | };
|
39352 | }
|
39353 | var opacity = cfg.fillOpacity || cfg.opacity || 1;
|
39354 | return {
|
39355 | fillOpacity: opacity - 0.15,
|
39356 | strokeOpacity: opacity - 0.15
|
39357 | };
|
39358 | },
|
39359 | getSelectedCfg: function getSelectedCfg(type, cfg) {
|
39360 | if (cfg && cfg.style) {
|
39361 | return cfg.style;
|
39362 | }
|
39363 | return this.getActiveCfg(type, cfg);
|
39364 | }
|
39365 | });
|
39366 |
|
39367 |
|
39368 | Shape.registerShape('schema', 'box', {
|
39369 | getPoints: function getPoints(pointInfo) {
|
39370 | return getBoxPoints(pointInfo.x, pointInfo.y, pointInfo.size);
|
39371 | },
|
39372 | draw: function draw(cfg, container) {
|
39373 | var attrs = getAttrs(cfg);
|
39374 | var path = getBoxPath(cfg.points);
|
39375 | path = this.parsePath(path);
|
39376 | return container.addShape('path', {
|
39377 | attrs: Util.mix(attrs, {
|
39378 | path: path
|
39379 | })
|
39380 | });
|
39381 | },
|
39382 | getMarkerCfg: function getMarkerCfg(cfg) {
|
39383 | return {
|
39384 | symbol: function symbol(x, y, r, ctx) {
|
39385 | var yValues = [y - 6, y - 3, y, y + 3, y + 6];
|
39386 | var points = getBoxPoints(x, yValues, r);
|
39387 | ctx.moveTo(points[0].x + 1, points[0].y);
|
39388 | ctx.lineTo(points[1].x - 1, points[1].y);
|
39389 | ctx.moveTo(points[2].x, points[2].y);
|
39390 | ctx.lineTo(points[3].x, points[3].y);
|
39391 | ctx.moveTo(points[4].x, points[4].y);
|
39392 | ctx.lineTo(points[5].x, points[5].y);
|
39393 | ctx.lineTo(points[6].x, points[6].y);
|
39394 | ctx.lineTo(points[7].x, points[7].y);
|
39395 | ctx.lineTo(points[4].x, points[4].y);
|
39396 | ctx.closePath();
|
39397 | ctx.moveTo(points[8].x, points[8].y);
|
39398 | ctx.lineTo(points[9].x, points[9].y);
|
39399 | ctx.moveTo(points[10].x + 1, points[10].y);
|
39400 | ctx.lineTo(points[11].x - 1, points[11].y);
|
39401 | ctx.moveTo(points[12].x, points[12].y);
|
39402 | ctx.lineTo(points[13].x, points[13].y);
|
39403 | },
|
39404 |
|
39405 | radius: 6,
|
39406 | lineWidth: 1,
|
39407 | stroke: cfg.color
|
39408 | };
|
39409 | }
|
39410 | });
|
39411 |
|
39412 |
|
39413 | Shape.registerShape('schema', 'candle', {
|
39414 | getPoints: function getPoints(pointInfo) {
|
39415 | return getCandlePoints(pointInfo.x, pointInfo.y, pointInfo.size);
|
39416 | },
|
39417 | draw: function draw(cfg, container) {
|
39418 | var attrs = getFillAttrs(cfg);
|
39419 | var path = getCandlePath(cfg.points);
|
39420 | path = this.parsePath(path);
|
39421 | return container.addShape('path', {
|
39422 | attrs: Util.mix(attrs, {
|
39423 | path: path
|
39424 | })
|
39425 | });
|
39426 | },
|
39427 | getMarkerCfg: function getMarkerCfg(cfg) {
|
39428 | return {
|
39429 | symbol: function symbol(x, y, r, ctx) {
|
39430 | y = [y + 7.5, y + 3, y - 3, y - 7.5];
|
39431 | var points = getCandlePoints(x, y, r);
|
39432 | ctx.moveTo(points[0].x, points[0].y);
|
39433 | ctx.lineTo(points[1].x, points[1].y);
|
39434 | ctx.moveTo(points[2].x, points[2].y);
|
39435 | ctx.lineTo(points[3].x, points[3].y);
|
39436 | ctx.lineTo(points[4].x, points[4].y);
|
39437 | ctx.lineTo(points[5].x, points[5].y);
|
39438 | ctx.closePath();
|
39439 | ctx.moveTo(points[6].x, points[6].y);
|
39440 | ctx.lineTo(points[7].x, points[7].y);
|
39441 | },
|
39442 |
|
39443 | lineWidth: 1,
|
39444 | stroke: cfg.color,
|
39445 | fill: cfg.color,
|
39446 | radius: 6
|
39447 | };
|
39448 | }
|
39449 | });
|
39450 |
|
39451 | module.exports = Schema;
|
39452 |
|
39453 | }),
|
39454 |
|
39455 | (function(module, exports, __webpack_require__) {
|
39456 |
|
39457 |
|
39458 |
|
39459 |
|
39460 |
|
39461 | var Util = __webpack_require__(0);
|
39462 |
|
39463 | var _require = __webpack_require__(1),
|
39464 | defaultColor = _require.defaultColor;
|
39465 |
|
39466 | var FIELD_ORIGIN = '_origin';
|
39467 |
|
39468 | function getScaleName(scale) {
|
39469 | return scale.alias || scale.field;
|
39470 | }
|
39471 |
|
39472 | var TooltipMixin = {
|
39473 | _snapEqual: function _snapEqual(v1, v2, scale) {
|
39474 | var equals = void 0;
|
39475 | v1 = scale.translate(v1);
|
39476 | v2 = scale.translate(v2);
|
39477 |
|
39478 | if (scale.isCategory) {
|
39479 | equals = v1 === v2;
|
39480 | } else {
|
39481 | equals = Util.snapEqual(v1, v2);
|
39482 | }
|
39483 | return equals;
|
39484 | },
|
39485 | _getScaleValueByPoint: function _getScaleValueByPoint(point) {
|
39486 | var result = 0;
|
39487 | var coord = this.get('coord');
|
39488 | var xScale = this.getXScale();
|
39489 | var invertPoint = coord.invert(point);
|
39490 | var xValue = invertPoint.x;
|
39491 |
|
39492 | if (this.isInCircle() && xValue > (1 + xScale.rangeMax()) / 2) {
|
39493 | xValue = xScale.rangeMin();
|
39494 | }
|
39495 | result = xScale.invert(xValue);
|
39496 |
|
39497 | if (xScale.isCategory) {
|
39498 | result = xScale.translate(result);
|
39499 | }
|
39500 |
|
39501 | return result;
|
39502 | },
|
39503 | _getOriginByPoint: function _getOriginByPoint(point) {
|
39504 | var xScale = this.getXScale();
|
39505 | var yScale = this.getYScale();
|
39506 | var xField = xScale.field;
|
39507 | var yField = yScale.field;
|
39508 | var coord = this.get('coord');
|
39509 | var invertPoint = coord.invert(point);
|
39510 | var xValue = xScale.invert(invertPoint.x);
|
39511 | var yValue = yScale.invert(invertPoint.y);
|
39512 |
|
39513 | var result = {};
|
39514 | result[xField] = xValue;
|
39515 | result[yField] = yValue;
|
39516 | return result;
|
39517 | },
|
39518 | _getScale: function _getScale(field) {
|
39519 | var self = this;
|
39520 | var scales = self.get('scales');
|
39521 | var rst = null;
|
39522 |
|
39523 | Util.each(scales, function (scale) {
|
39524 | if (scale.field === field) {
|
39525 | rst = scale;
|
39526 | return false;
|
39527 | }
|
39528 | });
|
39529 | return rst;
|
39530 | },
|
39531 |
|
39532 |
|
39533 |
|
39534 | _getTipValueScale: function _getTipValueScale() {
|
39535 | var attrs = this.getAttrsForLegend();
|
39536 | var scale = void 0;
|
39537 | Util.each(attrs, function (attr) {
|
39538 | var tmpScale = attr.getScale(attr.type);
|
39539 | if (tmpScale.isLinear) {
|
39540 |
|
39541 | scale = tmpScale;
|
39542 | return false;
|
39543 | }
|
39544 | });
|
39545 |
|
39546 | var xScale = this.getXScale();
|
39547 | var yScale = this.getYScale();
|
39548 |
|
39549 | if (!scale && yScale && yScale.field === '..y') {
|
39550 | return xScale;
|
39551 | }
|
39552 |
|
39553 | return scale || yScale || xScale;
|
39554 | },
|
39555 | _getTipTitleScale: function _getTipTitleScale(titleField) {
|
39556 | var self = this;
|
39557 | if (titleField) {
|
39558 | return self._getScale(titleField);
|
39559 | }
|
39560 | var position = self.getAttr('position');
|
39561 | var fields = position.getFields();
|
39562 | var tmpField = void 0;
|
39563 | Util.each(fields, function (field) {
|
39564 | if (field.indexOf('..') === -1) {
|
39565 | tmpField = field;
|
39566 | return false;
|
39567 | }
|
39568 | });
|
39569 | return self._getScale(tmpField);
|
39570 | },
|
39571 | _filterValue: function _filterValue(arr, point) {
|
39572 | var coord = this.get('coord');
|
39573 | var yScale = this.getYScale();
|
39574 | var yField = yScale.field;
|
39575 | var invertPoint = coord.invert(point);
|
39576 | var yValue = invertPoint.y;
|
39577 | yValue = yScale.invert(yValue);
|
39578 | var rst = arr[arr.length - 1];
|
39579 |
|
39580 | Util.each(arr, function (obj) {
|
39581 | var origin = obj[FIELD_ORIGIN];
|
39582 | if (origin[yField][0] <= yValue && origin[yField][1] >= yValue) {
|
39583 | rst = obj;
|
39584 | return false;
|
39585 | }
|
39586 | });
|
39587 | return rst;
|
39588 | },
|
39589 | getXDistance: function getXDistance() {
|
39590 | var self = this;
|
39591 | var distance = self.get('xDistance');
|
39592 | if (!distance) {
|
39593 | var xScale = self.getXScale();
|
39594 | if (xScale.isCategory) {
|
39595 | distance = 1;
|
39596 | } else {
|
39597 | var values = xScale.values;
|
39598 | var min = xScale.translate(values[0]);
|
39599 | var max = min;
|
39600 | Util.each(values, function (value) {
|
39601 |
|
39602 | value = xScale.translate(value);
|
39603 | if (value < min) {
|
39604 | min = value;
|
39605 | }
|
39606 | if (value > max) {
|
39607 | max = value;
|
39608 | }
|
39609 | });
|
39610 | var length = values.length;
|
39611 |
|
39612 | distance = (max - min) / (length - 1);
|
39613 | }
|
39614 | self.set('xDistance', distance);
|
39615 | }
|
39616 |
|
39617 | return distance;
|
39618 | },
|
39619 | findPoint: function findPoint(point, dataArray) {
|
39620 | var self = this;
|
39621 | var type = self.get('type');
|
39622 | var xScale = self.getXScale();
|
39623 | var yScale = self.getYScale();
|
39624 | var xField = xScale.field;
|
39625 | var yField = yScale.field;
|
39626 | var rst = null;
|
39627 |
|
39628 | if (Util.indexOf(['heatmap'], type) > -1) {
|
39629 | var coord = self.get('coord');
|
39630 | var invertPoint = coord.invert(point);
|
39631 | var xValue = xScale.invert(invertPoint.x);
|
39632 | var yValue = yScale.invert(invertPoint.y);
|
39633 | var min = Infinity;
|
39634 | Util.each(dataArray, function (obj) {
|
39635 | var distance = Math.pow(obj[FIELD_ORIGIN][xField] - xValue, 2) + Math.pow(obj[FIELD_ORIGIN][yField] - yValue, 2);
|
39636 | if (distance < min) {
|
39637 | min = distance;
|
39638 | rst = obj;
|
39639 | }
|
39640 | });
|
39641 | return rst;
|
39642 | }
|
39643 |
|
39644 | var first = dataArray[0];
|
39645 | var last = dataArray[dataArray.length - 1];
|
39646 |
|
39647 | if (!first) {
|
39648 | return rst;
|
39649 | }
|
39650 |
|
39651 | var value = self._getScaleValueByPoint(point);
|
39652 | var firstXValue = first[FIELD_ORIGIN][xField];
|
39653 | var firstYValue = first[FIELD_ORIGIN][yField];
|
39654 | var lastXValue = last[FIELD_ORIGIN][xField];
|
39655 | var isYRange = yScale.isLinear && Util.isArray(firstYValue);
|
39656 |
|
39657 |
|
39658 | if (Util.isArray(firstXValue)) {
|
39659 | Util.each(dataArray, function (record) {
|
39660 | var origin = record[FIELD_ORIGIN];
|
39661 | if (xScale.translate(origin[xField][0]) <= value && xScale.translate(origin[xField][1]) >= value) {
|
39662 | if (isYRange) {
|
39663 | if (!Util.isArray(rst)) {
|
39664 | rst = [];
|
39665 | }
|
39666 | rst.push(record);
|
39667 | } else {
|
39668 | rst = record;
|
39669 | return false;
|
39670 | }
|
39671 | }
|
39672 | });
|
39673 | if (Util.isArray(rst)) {
|
39674 | rst = this._filterValue(rst, point);
|
39675 | }
|
39676 | } else {
|
39677 | var next = void 0;
|
39678 | if (!xScale.isLinear && xScale.type !== 'timeCat') {
|
39679 | Util.each(dataArray, function (record, index) {
|
39680 | var origin = record[FIELD_ORIGIN];
|
39681 | if (self._snapEqual(origin[xField], value, xScale)) {
|
39682 | if (isYRange) {
|
39683 | if (!Util.isArray(rst)) {
|
39684 | rst = [];
|
39685 | }
|
39686 | rst.push(record);
|
39687 | } else {
|
39688 | rst = record;
|
39689 | return false;
|
39690 | }
|
39691 | } else if (xScale.translate(origin[xField]) <= value) {
|
39692 | last = record;
|
39693 | next = dataArray[index + 1];
|
39694 | }
|
39695 | });
|
39696 |
|
39697 | if (Util.isArray(rst)) {
|
39698 | rst = this._filterValue(rst, point);
|
39699 | }
|
39700 | } else {
|
39701 | if ((value > xScale.translate(lastXValue) || value < xScale.translate(firstXValue)) && (value > xScale.max || value < xScale.min)) {
|
39702 | return null;
|
39703 | }
|
39704 |
|
39705 | var firstIdx = 0;
|
39706 | var lastIdx = dataArray.length - 1;
|
39707 | var middleIdx = void 0;
|
39708 | while (firstIdx <= lastIdx) {
|
39709 | middleIdx = Math.floor((firstIdx + lastIdx) / 2);
|
39710 | var item = dataArray[middleIdx][FIELD_ORIGIN][xField];
|
39711 | if (self._snapEqual(item, value, xScale)) {
|
39712 | return dataArray[middleIdx];
|
39713 | }
|
39714 |
|
39715 | if (xScale.translate(item) <= xScale.translate(value)) {
|
39716 | firstIdx = middleIdx + 1;
|
39717 | last = dataArray[middleIdx];
|
39718 | next = dataArray[middleIdx + 1];
|
39719 | } else {
|
39720 | if (lastIdx === 0) {
|
39721 | last = dataArray[0];
|
39722 | }
|
39723 | lastIdx = middleIdx - 1;
|
39724 | }
|
39725 | }
|
39726 | }
|
39727 |
|
39728 | if (last && next) {
|
39729 |
|
39730 | if (Math.abs(xScale.translate(last[FIELD_ORIGIN][xField]) - value) > Math.abs(xScale.translate(next[FIELD_ORIGIN][xField]) - value)) {
|
39731 | last = next;
|
39732 | }
|
39733 | }
|
39734 | }
|
39735 |
|
39736 | var distance = self.getXDistance();
|
39737 | if (!rst && Math.abs(xScale.translate(last[FIELD_ORIGIN][xField]) - value) <= distance / 2) {
|
39738 | rst = last;
|
39739 | }
|
39740 |
|
39741 | return rst;
|
39742 | },
|
39743 |
|
39744 | |
39745 |
|
39746 |
|
39747 |
|
39748 |
|
39749 |
|
39750 |
|
39751 | getTipTitle: function getTipTitle(origin, titleField) {
|
39752 | var tipTitle = '';
|
39753 | var titleScale = this._getTipTitleScale(titleField);
|
39754 |
|
39755 | if (titleScale) {
|
39756 | var value = origin[titleScale.field];
|
39757 | tipTitle = titleScale.getText(value);
|
39758 | } else if (this.get('type') === 'heatmap') {
|
39759 |
|
39760 | var xScale = this.getXScale();
|
39761 | var yScale = this.getYScale();
|
39762 | var xValue = xScale.getText(origin[xScale.field]);
|
39763 | var yValue = yScale.getText(origin[yScale.field]);
|
39764 |
|
39765 | tipTitle = '( ' + xValue + ', ' + yValue + ' )';
|
39766 | }
|
39767 | return tipTitle;
|
39768 | },
|
39769 | getTipValue: function getTipValue(origin, valueScale) {
|
39770 | var value = void 0;
|
39771 | var field = valueScale.field;
|
39772 | value = origin[field];
|
39773 |
|
39774 | if (Util.isArray(value)) {
|
39775 | var tmp = [];
|
39776 | Util.each(value, function (sub) {
|
39777 | tmp.push(valueScale.getText(sub));
|
39778 | });
|
39779 | value = tmp.join('-');
|
39780 | } else {
|
39781 | value = valueScale.getText(value);
|
39782 | }
|
39783 | return value;
|
39784 | },
|
39785 |
|
39786 | |
39787 |
|
39788 |
|
39789 |
|
39790 |
|
39791 |
|
39792 | getTipName: function getTipName(origin) {
|
39793 | var name = void 0;
|
39794 | var nameScale = void 0;
|
39795 | var groupScales = this._getGroupScales();
|
39796 | if (groupScales.length) {
|
39797 |
|
39798 | Util.each(groupScales, function (scale) {
|
39799 | nameScale = scale;
|
39800 | return false;
|
39801 | });
|
39802 | }
|
39803 | if (nameScale) {
|
39804 | var field = nameScale.field;
|
39805 | name = nameScale.getText(origin[field]);
|
39806 | } else {
|
39807 | var valueScale = this._getTipValueScale();
|
39808 | name = getScaleName(valueScale);
|
39809 | }
|
39810 | return name;
|
39811 | },
|
39812 |
|
39813 | |
39814 |
|
39815 |
|
39816 |
|
39817 |
|
39818 |
|
39819 |
|
39820 | getTipItems: function getTipItems(point, titleField) {
|
39821 | var self = this;
|
39822 | var origin = point[FIELD_ORIGIN];
|
39823 | var tipTitle = self.getTipTitle(origin, titleField);
|
39824 | var tooltipCfg = self.get('tooltipCfg');
|
39825 | var items = [];
|
39826 | var name = void 0;
|
39827 | var value = void 0;
|
39828 |
|
39829 | function addItem(itemName, itemValue, cfg) {
|
39830 | if (!Util.isNil(itemValue) && itemValue !== '') {
|
39831 |
|
39832 | var item = {
|
39833 | title: tipTitle,
|
39834 | point: point,
|
39835 | name: itemName || tipTitle,
|
39836 | value: itemValue,
|
39837 | color: point.color || defaultColor,
|
39838 | marker: true
|
39839 | };
|
39840 | if (self.get('type') === 'interval' || self.get('type') === 'schema') {
|
39841 | item.size = self.getSize();
|
39842 | }
|
39843 |
|
39844 | items.push(Util.mix({}, item, cfg));
|
39845 | }
|
39846 | }
|
39847 |
|
39848 | if (tooltipCfg) {
|
39849 | var fields = tooltipCfg.fields;
|
39850 | var cfg = tooltipCfg.cfg;
|
39851 | var callbackParams = [];
|
39852 | Util.each(fields, function (field) {
|
39853 | callbackParams.push(origin[field]);
|
39854 | });
|
39855 | if (cfg) {
|
39856 |
|
39857 | if (Util.isFunction(cfg)) {
|
39858 | cfg = cfg.apply(null, callbackParams);
|
39859 | }
|
39860 | var itemCfg = Util.mix({}, {
|
39861 | point: point,
|
39862 | title: tipTitle,
|
39863 | color: point.color || defaultColor,
|
39864 | marker: true
|
39865 | }, cfg);
|
39866 | if (self.get('type') === 'interval' || self.get('type') === 'schema') {
|
39867 | itemCfg.size = self.getSize();
|
39868 | }
|
39869 | items.push(itemCfg);
|
39870 | } else {
|
39871 | Util.each(fields, function (field) {
|
39872 | if (!Util.isNil(origin[field])) {
|
39873 |
|
39874 | var scale = self._getScale(field);
|
39875 | name = getScaleName(scale);
|
39876 | value = scale.getText(origin[field]);
|
39877 | addItem(name, value);
|
39878 | }
|
39879 | });
|
39880 | }
|
39881 | } else {
|
39882 | var valueScale = self._getTipValueScale();
|
39883 | if (!Util.isNil(origin[valueScale.field])) {
|
39884 |
|
39885 | value = self.getTipValue(origin, valueScale);
|
39886 | name = self.getTipName(origin);
|
39887 | addItem(name, value);
|
39888 | }
|
39889 | }
|
39890 | return items;
|
39891 | },
|
39892 | isShareTooltip: function isShareTooltip() {
|
39893 | var shareTooltip = this.get('shareTooltip');
|
39894 | var type = this.get('type');
|
39895 | var view = this.get('view');
|
39896 | var options = void 0;
|
39897 | if (view.get('parent')) {
|
39898 | options = view.get('parent').get('options');
|
39899 | } else {
|
39900 | options = view.get('options');
|
39901 | }
|
39902 |
|
39903 | if (type === 'interval') {
|
39904 | var coord = this.get('coord');
|
39905 | var coordType = coord.type;
|
39906 | if (coordType === 'theta' || coordType === 'polar' && coord.isTransposed) {
|
39907 | shareTooltip = false;
|
39908 | }
|
39909 | } else if (!this.getYScale() || Util.inArray(['contour', 'point', 'polygon', 'edge'], type)) {
|
39910 | shareTooltip = false;
|
39911 | }
|
39912 |
|
39913 | if (options.tooltip && Util.isBoolean(options.tooltip.shared)) {
|
39914 |
|
39915 | shareTooltip = options.tooltip.shared;
|
39916 | }
|
39917 | return shareTooltip;
|
39918 | }
|
39919 | };
|
39920 |
|
39921 | module.exports = TooltipMixin;
|
39922 |
|
39923 | }),
|
39924 |
|
39925 | (function(module, exports, __webpack_require__) {
|
39926 |
|
39927 |
|
39928 |
|
39929 |
|
39930 |
|
39931 | var Util = __webpack_require__(0);
|
39932 | var FIELD_ORIGIN = '_origin';
|
39933 |
|
39934 | function isSameShape(shape1, shape2) {
|
39935 | if (Util.isNil(shape1) || Util.isNil(shape2)) {
|
39936 | return false;
|
39937 | }
|
39938 | var shape1Origin = shape1.get('origin');
|
39939 | var shape2Origin = shape2.get('origin');
|
39940 | return Util.isEqual(shape1Origin, shape2Origin);
|
39941 | }
|
39942 |
|
39943 | function isChange(preShapes, shapes) {
|
39944 | if (!preShapes) {
|
39945 | return true;
|
39946 | }
|
39947 |
|
39948 | if (preShapes.length !== shapes.length) {
|
39949 | return true;
|
39950 | }
|
39951 |
|
39952 | var rst = false;
|
39953 | Util.each(shapes, function (shape, index) {
|
39954 | if (!isSameShape(shape, preShapes[index])) {
|
39955 | rst = true;
|
39956 | return false;
|
39957 | }
|
39958 | });
|
39959 | return rst;
|
39960 | }
|
39961 |
|
39962 | var ActiveMixin = {
|
39963 | _isAllowActive: function _isAllowActive() {
|
39964 | var allowActive = this.get('allowActive');
|
39965 | if (Util.isNil(allowActive)) {
|
39966 |
|
39967 | var view = this.get('view');
|
39968 | var isShareTooltip = this.isShareTooltip();
|
39969 | var options = view.get('options');
|
39970 |
|
39971 | if (options.tooltip === false || !isShareTooltip) {
|
39972 | return true;
|
39973 | }
|
39974 | } else {
|
39975 | return allowActive;
|
39976 | }
|
39977 |
|
39978 | return false;
|
39979 | },
|
39980 | _onMouseenter: function _onMouseenter(ev) {
|
39981 | var self = this;
|
39982 | var shape = ev.shape;
|
39983 | var shapeContainer = self.get('shapeContainer');
|
39984 | if (shape && !shape.get('animating') && shapeContainer.contain(shape) && self._isAllowActive()) {
|
39985 | self.setShapesActived(shape);
|
39986 | }
|
39987 | },
|
39988 | _onMouseleave: function _onMouseleave() {
|
39989 | var self = this;
|
39990 | var view = self.get('view');
|
39991 | var canvas = view.get('canvas');
|
39992 | if (self.get('activeShapes')) {
|
39993 | self.clearActivedShapes();
|
39994 | canvas.draw();
|
39995 | }
|
39996 | },
|
39997 | _bindActiveAction: function _bindActiveAction() {
|
39998 | var self = this;
|
39999 | var view = self.get('view');
|
40000 | var type = self.get('type');
|
40001 | view.on(type + ':mouseenter', Util.wrapBehavior(self, '_onMouseenter'));
|
40002 | view.on(type + ':mouseleave', Util.wrapBehavior(self, '_onMouseleave'));
|
40003 | },
|
40004 | _offActiveAction: function _offActiveAction() {
|
40005 | var self = this;
|
40006 | var view = self.get('view');
|
40007 | var type = self.get('type');
|
40008 | view.off(type + ':mouseenter', Util.getWrapBehavior(self, '_onMouseenter'));
|
40009 | view.off(type + ':mouseleave', Util.getWrapBehavior(self, '_onMouseleave'));
|
40010 | },
|
40011 | _setActiveShape: function _setActiveShape(shape) {
|
40012 | var self = this;
|
40013 | var shapeData = shape.get('origin');
|
40014 | var shapeName = shapeData.shape || self.getDefaultValue('shape');
|
40015 | if (Util.isArray(shapeName)) {
|
40016 | shapeName = shapeName[0];
|
40017 | }
|
40018 | var shapeFactory = self.get('shapeFactory');
|
40019 | var shapeCfg = Util.mix({}, shape.__attrs, {
|
40020 | origin: shapeData
|
40021 | });
|
40022 | var activeCfg = shapeFactory.getActiveCfg(shapeName, shapeCfg);
|
40023 | Util.mix(shape.__attrs, activeCfg);
|
40024 | shape.setZIndex(1);
|
40025 | },
|
40026 | setShapesActived: function setShapesActived(shapes) {
|
40027 | var self = this;
|
40028 | var isStop = false;
|
40029 | if (!Util.isArray(shapes)) {
|
40030 | shapes = [shapes];
|
40031 | }
|
40032 |
|
40033 | var preShapes = self.get('preShapes');
|
40034 | if (!isChange(preShapes, shapes)) {
|
40035 | return;
|
40036 | }
|
40037 | if (preShapes) {
|
40038 | self.clearActivedShapes();
|
40039 | }
|
40040 | var view = self.get('view');
|
40041 | var canvas = view.get('canvas');
|
40042 | var shapeContainer = self.get('shapeContainer');
|
40043 | Util.each(shapes, function (shape) {
|
40044 | if (shape.get('animating')) {
|
40045 | isStop = true;
|
40046 | return false;
|
40047 | }
|
40048 | if (!shape.get('_originAttrs')) {
|
40049 | shape.set('_originAttrs', Util.cloneDeep(shape.__attrs));
|
40050 | }
|
40051 | if (shape.get('visible') && !shape.get('selected')) {
|
40052 | self._setActiveShape(shape);
|
40053 | }
|
40054 | });
|
40055 |
|
40056 | if (isStop) {
|
40057 | return;
|
40058 | }
|
40059 |
|
40060 | self.set('activeShapes', shapes);
|
40061 | self.set('preShapes', shapes);
|
40062 | shapeContainer.sort();
|
40063 | canvas.draw();
|
40064 | },
|
40065 | clearActivedShapes: function clearActivedShapes() {
|
40066 | var self = this;
|
40067 | var shapeContainer = self.get('shapeContainer');
|
40068 | if (shapeContainer && !shapeContainer.get('destroyed')) {
|
40069 | var activeShapes = self.get('activeShapes');
|
40070 | Util.each(activeShapes, function (activeShape) {
|
40071 | if (!activeShape.get('selected')) {
|
40072 | var originAttrs = activeShape.get('_originAttrs');
|
40073 | activeShape.__attrs = Util.cloneDeep(originAttrs);
|
40074 | activeShape.setZIndex(0);
|
40075 | activeShape.set('_originAttrs', null);
|
40076 | }
|
40077 | });
|
40078 | var preHighlightShapes = self.get('preHighlightShapes');
|
40079 | if (preHighlightShapes) {
|
40080 | var shapes = shapeContainer.get('children');
|
40081 | Util.each(shapes, function (shape) {
|
40082 | if (!shape.get('selected')) {
|
40083 | var originAttrs = shape.get('_originAttrs');
|
40084 | if (originAttrs) {
|
40085 | shape.__attrs = Util.cloneDeep(originAttrs);
|
40086 | shape.setZIndex(0);
|
40087 | shape.set('_originAttrs', null);
|
40088 | }
|
40089 | }
|
40090 | });
|
40091 | }
|
40092 |
|
40093 | var children = shapeContainer.get('children');
|
40094 | children.sort(function (obj1, obj2) {
|
40095 | return obj1._INDEX - obj2._INDEX;
|
40096 | });
|
40097 |
|
40098 | self.set('activeShapes', null);
|
40099 | self.set('preShapes', null);
|
40100 | self.set('preHighlightShapes', null);
|
40101 | }
|
40102 | },
|
40103 | getGroupShapesByPoint: function getGroupShapesByPoint(point) {
|
40104 | var self = this;
|
40105 | var shapeContainer = self.get('shapeContainer');
|
40106 | var activeShapes = [];
|
40107 | if (shapeContainer) {
|
40108 | var xField = self.getXScale().field;
|
40109 | var shapes = self.getShapes();
|
40110 | var originObj = self._getOriginByPoint(point);
|
40111 | Util.each(shapes, function (shape) {
|
40112 | var origin = shape.get('origin');
|
40113 | if (shape.get('visible') && origin) {
|
40114 |
|
40115 | var shapeXValue = origin[FIELD_ORIGIN][xField];
|
40116 | if (shapeXValue === originObj[xField]) {
|
40117 | activeShapes.push(shape);
|
40118 | }
|
40119 | }
|
40120 | });
|
40121 | }
|
40122 | return activeShapes;
|
40123 | },
|
40124 | getSingleShapeByPoint: function getSingleShapeByPoint(point) {
|
40125 | var self = this;
|
40126 | var shapeContainer = self.get('shapeContainer');
|
40127 | var canvas = shapeContainer.get('canvas');
|
40128 | var pixelRatio = canvas.get('pixelRatio');
|
40129 | var result = void 0;
|
40130 | if (shapeContainer) {
|
40131 | result = shapeContainer.getShape(point.x * pixelRatio, point.y * pixelRatio);
|
40132 | }
|
40133 |
|
40134 | if (result && result.get('origin')) {
|
40135 | return result;
|
40136 | }
|
40137 | },
|
40138 | highlightShapes: function highlightShapes(_highlightShapes, highlightCfg) {
|
40139 | var self = this;
|
40140 | if (!Util.isArray(_highlightShapes)) {
|
40141 | _highlightShapes = [_highlightShapes];
|
40142 | }
|
40143 |
|
40144 | var preHighlightShapes = self.get('preHighlightShapes');
|
40145 | if (!isChange(preHighlightShapes, _highlightShapes)) {
|
40146 | return;
|
40147 | }
|
40148 |
|
40149 | if (preHighlightShapes) {
|
40150 | self.clearActivedShapes();
|
40151 | }
|
40152 |
|
40153 | var shapes = self.getShapes();
|
40154 |
|
40155 | Util.each(shapes, function (shape) {
|
40156 | if (!shape.get('_originAttrs')) {
|
40157 | shape.set('_originAttrs', Util.cloneDeep(shape.__attrs));
|
40158 | }
|
40159 | if (Util.indexOf(_highlightShapes, shape) !== -1) {
|
40160 | shape.__attrs = Util.mix({}, shape.get('_originAttrs'), highlightCfg);
|
40161 | shape.setZIndex(1);
|
40162 | } else {
|
40163 | Util.mix(shape.__attrs, {
|
40164 | fill: '#fff',
|
40165 | fillOpacity: 0.3,
|
40166 | strokeOpacity: 0.3,
|
40167 | stroke: '#fff'
|
40168 | });
|
40169 | shape.setZIndex(0);
|
40170 | }
|
40171 | });
|
40172 | self.set('preHighlightShapes', _highlightShapes);
|
40173 | self.set('activeShapes', _highlightShapes);
|
40174 | }
|
40175 | };
|
40176 |
|
40177 | module.exports = ActiveMixin;
|
40178 |
|
40179 | }),
|
40180 |
|
40181 | (function(module, exports, __webpack_require__) {
|
40182 |
|
40183 |
|
40184 |
|
40185 |
|
40186 |
|
40187 | var Util = __webpack_require__(0);
|
40188 |
|
40189 | function isSameShape(shape1, shape2) {
|
40190 | if (Util.isNil(shape1) || Util.isNil(shape2)) {
|
40191 | return false;
|
40192 | }
|
40193 | var shape1Origin = shape1.get('origin');
|
40194 | var shape2Origin = shape2.get('origin');
|
40195 | return Util.isEqual(shape1Origin, shape2Origin);
|
40196 | }
|
40197 |
|
40198 | var SelectMixin = {
|
40199 | _isAllowSelect: function _isAllowSelect() {
|
40200 | var isAllowSelect = this.get('allowSelect');
|
40201 | if (Util.isNil(isAllowSelect)) {
|
40202 | var type = this.get('type');
|
40203 | var coord = this.get('coord');
|
40204 | var coordType = coord && coord.type;
|
40205 |
|
40206 | if (type === 'interval' && coordType === 'theta') {
|
40207 |
|
40208 | return true;
|
40209 | }
|
40210 | } else {
|
40211 |
|
40212 | return isAllowSelect;
|
40213 | }
|
40214 |
|
40215 | return false;
|
40216 | },
|
40217 | _onClick: function _onClick(ev) {
|
40218 | var self = this;
|
40219 | if (self._isAllowSelect()) {
|
40220 |
|
40221 | self.clearActivedShapes();
|
40222 | var shape = ev.shape;
|
40223 | var shapeContainer = self.get('shapeContainer');
|
40224 | if (shape && !shape.get('animating') && shapeContainer.contain(shape)) {
|
40225 | self.setShapeSelected(shape);
|
40226 | }
|
40227 | }
|
40228 | },
|
40229 | _bindSelectedAction: function _bindSelectedAction() {
|
40230 | var self = this;
|
40231 | var view = self.get('view');
|
40232 | var type = self.get('type');
|
40233 | view.on(type + ':click', Util.wrapBehavior(self, '_onClick'));
|
40234 | },
|
40235 | _offSelectedAction: function _offSelectedAction() {
|
40236 | var self = this;
|
40237 | var view = self.get('view');
|
40238 | var type = self.get('type');
|
40239 | view.off(type + ':click', Util.getWrapBehavior(self, '_onClick'));
|
40240 | },
|
40241 | _setShapeStatus: function _setShapeStatus(shape, status) {
|
40242 | var self = this;
|
40243 | var view = self.get('view');
|
40244 | var selectedOptions = self.get('selectedOptions') || {};
|
40245 | var animate = selectedOptions.animate !== false;
|
40246 | var canvas = view.get('canvas');
|
40247 |
|
40248 | shape.set('selected', status);
|
40249 | var shapeData = shape.get('origin');
|
40250 |
|
40251 | if (status) {
|
40252 |
|
40253 | var shapeName = shapeData.shape || self.getDefaultValue('shape');
|
40254 | if (Util.isArray(shapeName)) {
|
40255 | shapeName = shapeName[0];
|
40256 | }
|
40257 | var shapeFactory = self.get('shapeFactory');
|
40258 | var cfg = Util.mix({
|
40259 | geom: self,
|
40260 | point: shapeData
|
40261 | }, selectedOptions);
|
40262 | var selectedStyle = shapeFactory.getSelectedCfg(shapeName, cfg);
|
40263 | Util.mix(selectedStyle, cfg.style);
|
40264 |
|
40265 | if (!shape.get('_originAttrs')) {
|
40266 |
|
40267 | shape.set('_originAttrs', Util.cloneDeep(shape.__attrs));
|
40268 | }
|
40269 |
|
40270 | if (animate) {
|
40271 | shape.animate(selectedStyle, 300);
|
40272 | } else {
|
40273 | shape.attr(selectedStyle);
|
40274 | canvas.draw();
|
40275 | }
|
40276 | } else {
|
40277 | var originAttrs = shape.get('_originAttrs');
|
40278 | if (animate) {
|
40279 | shape.animate(originAttrs, 300);
|
40280 | } else {
|
40281 | shape.attr(originAttrs);
|
40282 | canvas.draw();
|
40283 | }
|
40284 | }
|
40285 | },
|
40286 | setShapeSelected: function setShapeSelected(shape) {
|
40287 | var self = this;
|
40288 | var selectedShapes = self._getSelectedShapes();
|
40289 | var selectedOptions = self.get('selectedOptions') || {};
|
40290 | var cancelable = selectedOptions.cancelable !== false;
|
40291 | if (selectedOptions.mode === 'multiple') {
|
40292 |
|
40293 | if (Util.indexOf(selectedShapes, shape) === -1) {
|
40294 | selectedShapes.push(shape);
|
40295 | self._setShapeStatus(shape, true);
|
40296 | } else if (cancelable) {
|
40297 |
|
40298 | Util.Array.remove(selectedShapes, shape);
|
40299 | self._setShapeStatus(shape, false);
|
40300 | }
|
40301 | } else {
|
40302 | var selectedShape = selectedShapes[0];
|
40303 | if (cancelable) {
|
40304 |
|
40305 | shape = isSameShape(selectedShape, shape) ? null : shape;
|
40306 | }
|
40307 | if (!isSameShape(selectedShape, shape)) {
|
40308 | if (selectedShape) {
|
40309 | self._setShapeStatus(selectedShape, false);
|
40310 | }
|
40311 | if (shape) {
|
40312 | self._setShapeStatus(shape, true);
|
40313 | }
|
40314 | }
|
40315 | }
|
40316 | },
|
40317 | clearSelected: function clearSelected() {
|
40318 | var self = this;
|
40319 | var shapeContainer = self.get('shapeContainer');
|
40320 | if (shapeContainer && !shapeContainer.get('destroyed')) {
|
40321 | var selectedShapes = self._getSelectedShapes();
|
40322 | Util.each(selectedShapes, function (shape) {
|
40323 | self._setShapeStatus(shape, false);
|
40324 | shape.set('_originAttrs', null);
|
40325 | });
|
40326 | }
|
40327 | },
|
40328 | _getSelectedShapes: function _getSelectedShapes() {
|
40329 | var self = this;
|
40330 | var shapes = self.getShapes();
|
40331 | var selectedShapes = [];
|
40332 |
|
40333 | Util.each(shapes, function (shape) {
|
40334 | if (shape.get('selected')) {
|
40335 | selectedShapes.push(shape);
|
40336 | }
|
40337 | });
|
40338 | self.set('selectedShapes', selectedShapes);
|
40339 | return selectedShapes;
|
40340 | }
|
40341 | };
|
40342 |
|
40343 | module.exports = SelectMixin;
|
40344 |
|
40345 | }),
|
40346 |
|
40347 | (function(module, exports, __webpack_require__) {
|
40348 |
|
40349 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40350 |
|
40351 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
40352 |
|
40353 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
40354 |
|
40355 |
|
40356 |
|
40357 |
|
40358 |
|
40359 |
|
40360 | var GeomBase = __webpack_require__(9);
|
40361 | var Util = __webpack_require__(0);
|
40362 |
|
40363 | var Point = function (_GeomBase) {
|
40364 | _inherits(Point, _GeomBase);
|
40365 |
|
40366 | function Point() {
|
40367 | _classCallCheck(this, Point);
|
40368 |
|
40369 | return _possibleConstructorReturn(this, _GeomBase.apply(this, arguments));
|
40370 | }
|
40371 |
|
40372 | |
40373 |
|
40374 |
|
40375 |
|
40376 |
|
40377 | Point.prototype.getDefaultCfg = function getDefaultCfg() {
|
40378 | var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
|
40379 | cfg.type = 'point';
|
40380 | cfg.shapeType = 'point';
|
40381 | cfg.generatePoints = true;
|
40382 | return cfg;
|
40383 | };
|
40384 |
|
40385 | Point.prototype.drawPoint = function drawPoint(obj, container, shapeFactory, index) {
|
40386 | var self = this;
|
40387 | var shape = obj.shape;
|
40388 | var cfg = self.getDrawCfg(obj);
|
40389 | var geomShape = void 0;
|
40390 | if (Util.isArray(obj.y)) {
|
40391 | var hasAdjust = self.hasStack();
|
40392 | Util.each(obj.y, function (y, idx) {
|
40393 | cfg.y = y;
|
40394 | cfg.yIndex = idx;
|
40395 | if (!hasAdjust || idx !== 0) {
|
40396 | geomShape = shapeFactory.drawShape(shape, cfg, container);
|
40397 | geomShape.setSilent('index', index + idx);
|
40398 | geomShape.setSilent('coord', self.get('coord'));
|
40399 | if (self.get('animate') && self.get('animateCfg')) {
|
40400 | geomShape.setSilent('animateCfg', self.get('animateCfg'));
|
40401 | }
|
40402 | }
|
40403 | });
|
40404 | } else if (!Util.isNil(obj.y)) {
|
40405 | geomShape = shapeFactory.drawShape(shape, cfg, container);
|
40406 | geomShape.setSilent('index', index);
|
40407 | geomShape.setSilent('coord', self.get('coord'));
|
40408 |
|
40409 | if (self.get('animate') && self.get('animateCfg')) {
|
40410 | geomShape.setSilent('animateCfg', self.get('animateCfg'));
|
40411 | }
|
40412 | }
|
40413 | };
|
40414 |
|
40415 | return Point;
|
40416 | }(GeomBase);
|
40417 |
|
40418 | var PointJitter = function (_Point) {
|
40419 | _inherits(PointJitter, _Point);
|
40420 |
|
40421 | function PointJitter() {
|
40422 | _classCallCheck(this, PointJitter);
|
40423 |
|
40424 | return _possibleConstructorReturn(this, _Point.apply(this, arguments));
|
40425 | }
|
40426 |
|
40427 | PointJitter.prototype.getDefaultCfg = function getDefaultCfg() {
|
40428 | var cfg = _Point.prototype.getDefaultCfg.call(this);
|
40429 | cfg.hasDefaultAdjust = true;
|
40430 | cfg.adjusts = [{ type: 'jitter' }];
|
40431 | return cfg;
|
40432 | };
|
40433 |
|
40434 | return PointJitter;
|
40435 | }(Point);
|
40436 |
|
40437 | Point.Jitter = PointJitter;
|
40438 |
|
40439 | module.exports = Point;
|
40440 |
|
40441 | }),
|
40442 |
|
40443 | (function(module, exports, __webpack_require__) {
|
40444 |
|
40445 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40446 |
|
40447 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
40448 |
|
40449 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
40450 |
|
40451 |
|
40452 |
|
40453 |
|
40454 |
|
40455 |
|
40456 | var Path = __webpack_require__(112);
|
40457 |
|
40458 | var Line = function (_Path) {
|
40459 | _inherits(Line, _Path);
|
40460 |
|
40461 | function Line() {
|
40462 | _classCallCheck(this, Line);
|
40463 |
|
40464 | return _possibleConstructorReturn(this, _Path.apply(this, arguments));
|
40465 | }
|
40466 |
|
40467 | |
40468 |
|
40469 |
|
40470 |
|
40471 |
|
40472 | Line.prototype.getDefaultCfg = function getDefaultCfg() {
|
40473 | var cfg = _Path.prototype.getDefaultCfg.call(this);
|
40474 | cfg.type = 'line';
|
40475 | cfg.sortable = true;
|
40476 | return cfg;
|
40477 | };
|
40478 |
|
40479 | return Line;
|
40480 | }(Path);
|
40481 |
|
40482 | var LineStack = function (_Line) {
|
40483 | _inherits(LineStack, _Line);
|
40484 |
|
40485 | function LineStack() {
|
40486 | _classCallCheck(this, LineStack);
|
40487 |
|
40488 | return _possibleConstructorReturn(this, _Line.apply(this, arguments));
|
40489 | }
|
40490 |
|
40491 | LineStack.prototype.getDefaultCfg = function getDefaultCfg() {
|
40492 | var cfg = _Line.prototype.getDefaultCfg.call(this);
|
40493 | cfg.hasDefaultAdjust = true;
|
40494 | cfg.adjusts = [{ type: 'stack' }];
|
40495 | return cfg;
|
40496 | };
|
40497 |
|
40498 | return LineStack;
|
40499 | }(Line);
|
40500 |
|
40501 | Line.Stack = LineStack;
|
40502 | module.exports = Line;
|
40503 |
|
40504 | }),
|
40505 |
|
40506 | (function(module, exports, __webpack_require__) {
|
40507 |
|
40508 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40509 |
|
40510 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
40511 |
|
40512 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
40513 |
|
40514 |
|
40515 |
|
40516 |
|
40517 |
|
40518 |
|
40519 | var GeomBase = __webpack_require__(9);
|
40520 | var Util = __webpack_require__(0);
|
40521 | var SizeMixin = __webpack_require__(114);
|
40522 |
|
40523 | var Interval = function (_GeomBase) {
|
40524 | _inherits(Interval, _GeomBase);
|
40525 |
|
40526 | |
40527 |
|
40528 |
|
40529 |
|
40530 |
|
40531 | Interval.prototype.getDefaultCfg = function getDefaultCfg() {
|
40532 | var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
|
40533 | cfg.type = 'interval';
|
40534 | cfg.shapeType = 'interval';
|
40535 | cfg.generatePoints = true;
|
40536 | return cfg;
|
40537 | };
|
40538 |
|
40539 | function Interval(cfg) {
|
40540 | _classCallCheck(this, Interval);
|
40541 |
|
40542 | var _this = _possibleConstructorReturn(this, _GeomBase.call(this, cfg));
|
40543 |
|
40544 | Util.assign(_this, SizeMixin);
|
40545 | return _this;
|
40546 | }
|
40547 |
|
40548 | Interval.prototype.createShapePointsCfg = function createShapePointsCfg(obj) {
|
40549 | var cfg = _GeomBase.prototype.createShapePointsCfg.call(this, obj);
|
40550 | cfg.size = this.getNormalizedSize(obj);
|
40551 | return cfg;
|
40552 | };
|
40553 |
|
40554 | Interval.prototype.clearInner = function clearInner() {
|
40555 | _GeomBase.prototype.clearInner.call(this);
|
40556 | this.set('defaultSize', null);
|
40557 | };
|
40558 |
|
40559 | return Interval;
|
40560 | }(GeomBase);
|
40561 |
|
40562 | var IntervalStack = function (_Interval) {
|
40563 | _inherits(IntervalStack, _Interval);
|
40564 |
|
40565 | function IntervalStack() {
|
40566 | _classCallCheck(this, IntervalStack);
|
40567 |
|
40568 | return _possibleConstructorReturn(this, _Interval.apply(this, arguments));
|
40569 | }
|
40570 |
|
40571 | IntervalStack.prototype.getDefaultCfg = function getDefaultCfg() {
|
40572 | var cfg = _Interval.prototype.getDefaultCfg.call(this);
|
40573 | cfg.hasDefaultAdjust = true;
|
40574 | cfg.adjusts = [{ type: 'stack' }];
|
40575 | return cfg;
|
40576 | };
|
40577 |
|
40578 | return IntervalStack;
|
40579 | }(Interval);
|
40580 |
|
40581 | var IntervalDodge = function (_Interval2) {
|
40582 | _inherits(IntervalDodge, _Interval2);
|
40583 |
|
40584 | function IntervalDodge() {
|
40585 | _classCallCheck(this, IntervalDodge);
|
40586 |
|
40587 | return _possibleConstructorReturn(this, _Interval2.apply(this, arguments));
|
40588 | }
|
40589 |
|
40590 | IntervalDodge.prototype.getDefaultCfg = function getDefaultCfg() {
|
40591 | var cfg = _Interval2.prototype.getDefaultCfg.call(this);
|
40592 | cfg.hasDefaultAdjust = true;
|
40593 | cfg.adjusts = [{ type: 'dodge' }];
|
40594 | return cfg;
|
40595 | };
|
40596 |
|
40597 | return IntervalDodge;
|
40598 | }(Interval);
|
40599 |
|
40600 | var IntervalSymmetric = function (_Interval3) {
|
40601 | _inherits(IntervalSymmetric, _Interval3);
|
40602 |
|
40603 | function IntervalSymmetric() {
|
40604 | _classCallCheck(this, IntervalSymmetric);
|
40605 |
|
40606 | return _possibleConstructorReturn(this, _Interval3.apply(this, arguments));
|
40607 | }
|
40608 |
|
40609 | IntervalSymmetric.prototype.getDefaultCfg = function getDefaultCfg() {
|
40610 | var cfg = _Interval3.prototype.getDefaultCfg.call(this);
|
40611 | cfg.hasDefaultAdjust = true;
|
40612 | cfg.adjusts = [{ type: 'symmetric' }];
|
40613 | return cfg;
|
40614 | };
|
40615 |
|
40616 | return IntervalSymmetric;
|
40617 | }(Interval);
|
40618 |
|
40619 | Interval.Stack = IntervalStack;
|
40620 | Interval.Dodge = IntervalDodge;
|
40621 | Interval.Symmetric = IntervalSymmetric;
|
40622 |
|
40623 | module.exports = Interval;
|
40624 |
|
40625 | }),
|
40626 |
|
40627 | (function(module, exports, __webpack_require__) {
|
40628 |
|
40629 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40630 |
|
40631 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
40632 |
|
40633 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
40634 |
|
40635 |
|
40636 |
|
40637 |
|
40638 |
|
40639 |
|
40640 | var GeomBase = __webpack_require__(9);
|
40641 | var SplitMixin = __webpack_require__(113);
|
40642 | var Util = __webpack_require__(0);
|
40643 |
|
40644 | var Area = function (_GeomBase) {
|
40645 | _inherits(Area, _GeomBase);
|
40646 |
|
40647 | |
40648 |
|
40649 |
|
40650 |
|
40651 |
|
40652 | Area.prototype.getDefaultCfg = function getDefaultCfg() {
|
40653 | var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
|
40654 | cfg.type = 'area';
|
40655 | cfg.shapeType = 'area';
|
40656 | cfg.generatePoints = true;
|
40657 | cfg.sortable = true;
|
40658 | return cfg;
|
40659 | };
|
40660 |
|
40661 | function Area(cfg) {
|
40662 | _classCallCheck(this, Area);
|
40663 |
|
40664 | var _this = _possibleConstructorReturn(this, _GeomBase.call(this, cfg));
|
40665 |
|
40666 | Util.assign(_this, SplitMixin);
|
40667 | return _this;
|
40668 | }
|
40669 |
|
40670 | Area.prototype.draw = function draw(data, container, shapeFactory, index) {
|
40671 | var self = this;
|
40672 | var cfg = this.getDrawCfg(data[0]);
|
40673 | var splitArray = this.splitData(data);
|
40674 |
|
40675 | cfg.origin = data;
|
40676 | Util.each(splitArray, function (subData, splitedIndex) {
|
40677 | cfg.splitedIndex = splitedIndex;
|
40678 | var points = subData.map(function (obj) {
|
40679 | return obj.points;
|
40680 | });
|
40681 | cfg.points = points;
|
40682 | var geomShape = shapeFactory.drawShape(cfg.shape, cfg, container);
|
40683 | geomShape.setSilent('index', index + splitedIndex);
|
40684 | geomShape.setSilent('coord', self.get('coord'));
|
40685 |
|
40686 | if (self.get('animate') && self.get('animateCfg')) {
|
40687 | geomShape.setSilent('animateCfg', self.get('animateCfg'));
|
40688 | }
|
40689 | });
|
40690 | };
|
40691 |
|
40692 | return Area;
|
40693 | }(GeomBase);
|
40694 |
|
40695 | var AreaStack = function (_Area) {
|
40696 | _inherits(AreaStack, _Area);
|
40697 |
|
40698 | function AreaStack() {
|
40699 | _classCallCheck(this, AreaStack);
|
40700 |
|
40701 | return _possibleConstructorReturn(this, _Area.apply(this, arguments));
|
40702 | }
|
40703 |
|
40704 | AreaStack.prototype.getDefaultCfg = function getDefaultCfg() {
|
40705 | var cfg = _Area.prototype.getDefaultCfg.call(this);
|
40706 | cfg.hasDefaultAdjust = true;
|
40707 | cfg.adjusts = [{ type: 'stack' }];
|
40708 | return cfg;
|
40709 | };
|
40710 |
|
40711 | return AreaStack;
|
40712 | }(Area);
|
40713 |
|
40714 | Area.Stack = AreaStack;
|
40715 | module.exports = Area;
|
40716 |
|
40717 | }),
|
40718 |
|
40719 | (function(module, exports, __webpack_require__) {
|
40720 |
|
40721 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40722 |
|
40723 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
40724 |
|
40725 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
40726 |
|
40727 |
|
40728 |
|
40729 |
|
40730 |
|
40731 |
|
40732 | var GeomBase = __webpack_require__(9);
|
40733 | var Util = __webpack_require__(0);
|
40734 |
|
40735 | var Polygon = function (_GeomBase) {
|
40736 | _inherits(Polygon, _GeomBase);
|
40737 |
|
40738 | function Polygon() {
|
40739 | _classCallCheck(this, Polygon);
|
40740 |
|
40741 | return _possibleConstructorReturn(this, _GeomBase.apply(this, arguments));
|
40742 | }
|
40743 |
|
40744 | |
40745 |
|
40746 |
|
40747 |
|
40748 |
|
40749 | Polygon.prototype.getDefaultCfg = function getDefaultCfg() {
|
40750 | var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
|
40751 | cfg.type = 'polygon';
|
40752 | cfg.shapeType = 'polygon';
|
40753 | cfg.generatePoints = true;
|
40754 | return cfg;
|
40755 | };
|
40756 |
|
40757 | Polygon.prototype.createShapePointsCfg = function createShapePointsCfg(obj) {
|
40758 | var cfg = _GeomBase.prototype.createShapePointsCfg.call(this, obj);
|
40759 | var self = this;
|
40760 | var x = cfg.x;
|
40761 | var y = cfg.y;
|
40762 | var temp = void 0;
|
40763 | if (!(Util.isArray(x) && Util.isArray(y))) {
|
40764 |
|
40765 | var xScale = self.getXScale();
|
40766 | var yScale = self.getYScale();
|
40767 | var xCount = xScale.values ? xScale.values.length : xScale.ticks.length;
|
40768 | var yCount = yScale.values ? yScale.values.length : yScale.ticks.length;
|
40769 | var xOffset = 0.5 * 1 / xCount;
|
40770 | var yOffset = 0.5 * 1 / yCount;
|
40771 | if (xScale.isCategory && yScale.isCategory) {
|
40772 |
|
40773 | x = [x - xOffset, x - xOffset, x + xOffset, x + xOffset];
|
40774 | y = [y - yOffset, y + yOffset, y + yOffset, y - yOffset];
|
40775 | } else if (Util.isArray(x)) {
|
40776 |
|
40777 | temp = x;
|
40778 | x = [temp[0], temp[0], temp[1], temp[1]];
|
40779 | y = [y - yOffset / 2, y + yOffset / 2, y + yOffset / 2, y - yOffset / 2];
|
40780 | } else if (Util.isArray(y)) {
|
40781 |
|
40782 | temp = y;
|
40783 | y = [temp[0], temp[1], temp[1], temp[0]];
|
40784 | x = [x - xOffset / 2, x - xOffset / 2, x + xOffset / 2, x + xOffset / 2];
|
40785 | }
|
40786 | cfg.x = x;
|
40787 | cfg.y = y;
|
40788 | }
|
40789 | return cfg;
|
40790 | };
|
40791 |
|
40792 | return Polygon;
|
40793 | }(GeomBase);
|
40794 |
|
40795 | module.exports = Polygon;
|
40796 |
|
40797 | }),
|
40798 |
|
40799 | (function(module, exports, __webpack_require__) {
|
40800 |
|
40801 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40802 |
|
40803 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
40804 |
|
40805 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
40806 |
|
40807 |
|
40808 |
|
40809 |
|
40810 |
|
40811 |
|
40812 | var GeomBase = __webpack_require__(9);
|
40813 | var Util = __webpack_require__(0);
|
40814 | var SizeMixin = __webpack_require__(114);
|
40815 |
|
40816 | var Schema = function (_GeomBase) {
|
40817 | _inherits(Schema, _GeomBase);
|
40818 |
|
40819 | |
40820 |
|
40821 |
|
40822 |
|
40823 |
|
40824 | Schema.prototype.getDefaultCfg = function getDefaultCfg() {
|
40825 | var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
|
40826 | cfg.type = 'schema';
|
40827 | cfg.shapeType = 'schema';
|
40828 | cfg.generatePoints = true;
|
40829 | return cfg;
|
40830 | };
|
40831 |
|
40832 | function Schema(cfg) {
|
40833 | _classCallCheck(this, Schema);
|
40834 |
|
40835 | var _this = _possibleConstructorReturn(this, _GeomBase.call(this, cfg));
|
40836 |
|
40837 | Util.assign(_this, SizeMixin);
|
40838 | return _this;
|
40839 | }
|
40840 |
|
40841 | Schema.prototype.createShapePointsCfg = function createShapePointsCfg(obj) {
|
40842 | var cfg = _GeomBase.prototype.createShapePointsCfg.call(this, obj);
|
40843 | cfg.size = this.getNormalizedSize(obj);
|
40844 | return cfg;
|
40845 | };
|
40846 |
|
40847 | return Schema;
|
40848 | }(GeomBase);
|
40849 |
|
40850 | var SchemaDodge = function (_Schema) {
|
40851 | _inherits(SchemaDodge, _Schema);
|
40852 |
|
40853 | function SchemaDodge() {
|
40854 | _classCallCheck(this, SchemaDodge);
|
40855 |
|
40856 | return _possibleConstructorReturn(this, _Schema.apply(this, arguments));
|
40857 | }
|
40858 |
|
40859 | SchemaDodge.prototype.getDefaultCfg = function getDefaultCfg() {
|
40860 | var cfg = _Schema.prototype.getDefaultCfg.call(this);
|
40861 | cfg.hasDefaultAdjust = true;
|
40862 | cfg.adjusts = [{ type: 'dodge' }];
|
40863 | return cfg;
|
40864 | };
|
40865 |
|
40866 | return SchemaDodge;
|
40867 | }(Schema);
|
40868 |
|
40869 | Schema.Dodge = SchemaDodge;
|
40870 | module.exports = Schema;
|
40871 |
|
40872 | }),
|
40873 |
|
40874 | (function(module, exports, __webpack_require__) {
|
40875 |
|
40876 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40877 |
|
40878 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
40879 |
|
40880 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
40881 |
|
40882 |
|
40883 |
|
40884 |
|
40885 |
|
40886 |
|
40887 | var GeomBase = __webpack_require__(9);
|
40888 |
|
40889 | var Edge = function (_GeomBase) {
|
40890 | _inherits(Edge, _GeomBase);
|
40891 |
|
40892 | function Edge() {
|
40893 | _classCallCheck(this, Edge);
|
40894 |
|
40895 | return _possibleConstructorReturn(this, _GeomBase.apply(this, arguments));
|
40896 | }
|
40897 |
|
40898 | |
40899 |
|
40900 |
|
40901 |
|
40902 |
|
40903 | Edge.prototype.getDefaultCfg = function getDefaultCfg() {
|
40904 | var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
|
40905 | cfg.type = 'edge';
|
40906 | cfg.shapeType = 'edge';
|
40907 | cfg.generatePoints = true;
|
40908 | return cfg;
|
40909 | };
|
40910 |
|
40911 | return Edge;
|
40912 | }(GeomBase);
|
40913 |
|
40914 | module.exports = Edge;
|
40915 |
|
40916 | }),
|
40917 |
|
40918 | (function(module, exports, __webpack_require__) {
|
40919 |
|
40920 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40921 |
|
40922 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
40923 |
|
40924 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
40925 |
|
40926 |
|
40927 |
|
40928 |
|
40929 |
|
40930 | var GeomBase = __webpack_require__(9);
|
40931 | var colorUtil = __webpack_require__(64);
|
40932 | var Util = __webpack_require__(0);
|
40933 |
|
40934 | var ORIGIN_FIELD = '_origin';
|
40935 | var SHADOW_CANVAS_CTX = 'shadowCanvasCtx';
|
40936 | var VALUE_RANGE = 'valueRange';
|
40937 | var IMAGE_SHAPE = 'imageShape';
|
40938 | var MAPPED_DATA = 'mappedData';
|
40939 | var GRAY_SCALE_BLURRED_CANVAS = 'grayScaleBlurredCanvas';
|
40940 | var HEATMAP_SIZE = 'heatmapSize';
|
40941 |
|
40942 | var paletteCache = {};
|
40943 |
|
40944 | var Heatmap = function (_GeomBase) {
|
40945 | _inherits(Heatmap, _GeomBase);
|
40946 |
|
40947 | function Heatmap() {
|
40948 | _classCallCheck(this, Heatmap);
|
40949 |
|
40950 | return _possibleConstructorReturn(this, _GeomBase.apply(this, arguments));
|
40951 | }
|
40952 |
|
40953 | |
40954 |
|
40955 |
|
40956 |
|
40957 |
|
40958 | Heatmap.prototype.getDefaultCfg = function getDefaultCfg() {
|
40959 | var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
|
40960 | cfg.type = 'heatmap';
|
40961 |
|
40962 | return cfg;
|
40963 | };
|
40964 |
|
40965 | Heatmap.prototype._prepareRange = function _prepareRange() {
|
40966 | var self = this;
|
40967 |
|
40968 | var data = self.get(MAPPED_DATA);
|
40969 | var colorAttr = self.getAttr('color');
|
40970 | var colorField = colorAttr.field;
|
40971 |
|
40972 | var min = Infinity;
|
40973 | var max = -Infinity;
|
40974 | data.forEach(function (row) {
|
40975 | var value = row[ORIGIN_FIELD][colorField];
|
40976 | if (value > max) {
|
40977 | max = value;
|
40978 | }
|
40979 | if (value < min) {
|
40980 | min = value;
|
40981 | }
|
40982 | });
|
40983 | if (min === max) {
|
40984 | min = max - 1;
|
40985 | }
|
40986 |
|
40987 | var range = [min, max];
|
40988 | self.set(VALUE_RANGE, range);
|
40989 | };
|
40990 |
|
40991 | Heatmap.prototype._prepareSize = function _prepareSize() {
|
40992 | var self = this;
|
40993 | var radius = self.getDefaultValue('size');
|
40994 | if (!Util.isNumber(radius)) {
|
40995 | radius = self._getDefaultSize();
|
40996 | }
|
40997 | var styleOptions = self.get('styleOptions');
|
40998 | var blur = styleOptions && Util.isObject(styleOptions.style) ? styleOptions.style.blur : null;
|
40999 | if (!Util.isFinite(blur)) {
|
41000 | blur = radius / 2;
|
41001 | }
|
41002 | self.set(HEATMAP_SIZE, {
|
41003 | blur: blur,
|
41004 | radius: radius
|
41005 | });
|
41006 | };
|
41007 |
|
41008 | Heatmap.prototype._getDefaultSize = function _getDefaultSize() {
|
41009 | var self = this;
|
41010 | var position = self.getAttr('position');
|
41011 | var coord = self.get('coord');
|
41012 | var radius = Math.min(coord.width / (position.scales[0].ticks.length * 4), coord.height / (position.scales[1].ticks.length * 4));
|
41013 | return radius;
|
41014 | };
|
41015 |
|
41016 | Heatmap.prototype._colorize = function _colorize(img) {
|
41017 | var self = this;
|
41018 | var colorAttr = self.getAttr('color');
|
41019 | var pixels = img.data;
|
41020 | for (var i = 3; i < pixels.length; i += 4) {
|
41021 | var alpha = pixels[i];
|
41022 | if (alpha) {
|
41023 | var palette = void 0;
|
41024 | if (paletteCache[alpha]) {
|
41025 | palette = paletteCache[alpha];
|
41026 | } else {
|
41027 | palette = colorUtil.rgb2arr(colorAttr.gradient(alpha / 256));
|
41028 | paletteCache[alpha] = palette;
|
41029 | }
|
41030 |
|
41031 | pixels[i - 3] = palette[0];
|
41032 | pixels[i - 2] = palette[1];
|
41033 | pixels[i - 1] = palette[2];
|
41034 | pixels[i] = alpha;
|
41035 | }
|
41036 | }
|
41037 | };
|
41038 |
|
41039 | Heatmap.prototype._prepareGreyScaleBlurredCircle = function _prepareGreyScaleBlurredCircle(r, blur) {
|
41040 | var self = this;
|
41041 | var circleCanvas = self.get(GRAY_SCALE_BLURRED_CANVAS);
|
41042 | if (!circleCanvas) {
|
41043 | circleCanvas = document.createElement('canvas');
|
41044 | self.set(GRAY_SCALE_BLURRED_CANVAS, circleCanvas);
|
41045 | }
|
41046 | var r2 = r + blur;
|
41047 | var ctx = circleCanvas.getContext('2d');
|
41048 | circleCanvas.width = circleCanvas.height = r2 * 2;
|
41049 | ctx.clearRect(0, 0, circleCanvas.width, circleCanvas.height);
|
41050 | ctx.shadowOffsetX = ctx.shadowOffsetY = r2 * 2;
|
41051 | ctx.shadowBlur = blur;
|
41052 | ctx.shadowColor = 'black';
|
41053 |
|
41054 | ctx.beginPath();
|
41055 | ctx.arc(-r2, -r2, r, 0, Math.PI * 2, true);
|
41056 | ctx.closePath();
|
41057 | ctx.fill();
|
41058 | };
|
41059 |
|
41060 | Heatmap.prototype._drawGrayScaleBlurredCircle = function _drawGrayScaleBlurredCircle(x, y, r, alpha, ctx) {
|
41061 | var circleCanvas = this.get(GRAY_SCALE_BLURRED_CANVAS);
|
41062 | ctx.globalAlpha = alpha;
|
41063 | ctx.drawImage(circleCanvas, x - r, y - r);
|
41064 | };
|
41065 |
|
41066 | Heatmap.prototype._getShadowCanvasCtx = function _getShadowCanvasCtx() {
|
41067 | var self = this;
|
41068 | var ctx = self.get(SHADOW_CANVAS_CTX);
|
41069 | if (ctx) {
|
41070 | return ctx;
|
41071 | }
|
41072 | var coord = self.get('coord');
|
41073 | var width = coord.x.end;
|
41074 | var height = coord.y.start;
|
41075 | var heatmapCanvas = document.createElement('canvas');
|
41076 | heatmapCanvas.width = width;
|
41077 | heatmapCanvas.height = height;
|
41078 | ctx = heatmapCanvas.getContext('2d');
|
41079 | self.set(SHADOW_CANVAS_CTX, ctx);
|
41080 | return ctx;
|
41081 | };
|
41082 |
|
41083 | Heatmap.prototype._clearShadowCanvasCtx = function _clearShadowCanvasCtx() {
|
41084 | var ctx = this.get(SHADOW_CANVAS_CTX);
|
41085 | if (ctx) {
|
41086 | ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
41087 | }
|
41088 | };
|
41089 |
|
41090 | Heatmap.prototype._getImageShape = function _getImageShape() {
|
41091 | var self = this;
|
41092 | var imageShape = self.get(IMAGE_SHAPE);
|
41093 | if (imageShape) {
|
41094 | return imageShape;
|
41095 | }
|
41096 | var container = self.get('container');
|
41097 | imageShape = container.addShape('Image', {});
|
41098 | self.set(IMAGE_SHAPE, imageShape);
|
41099 | return imageShape;
|
41100 | };
|
41101 |
|
41102 | Heatmap.prototype.drawWithRange = function drawWithRange(range) {
|
41103 | var self = this;
|
41104 |
|
41105 |
|
41106 | var coord = self.get('coord');
|
41107 | var width = coord.width;
|
41108 | var height = coord.height;
|
41109 |
|
41110 |
|
41111 | var valueField = self.getAttr('color').field;
|
41112 | var size = self.get(HEATMAP_SIZE);
|
41113 |
|
41114 |
|
41115 | self._clearShadowCanvasCtx();
|
41116 | var ctx = self._getShadowCanvasCtx();
|
41117 |
|
41118 |
|
41119 | var data = self.get(MAPPED_DATA);
|
41120 | if (range) {
|
41121 | data = data.filter(function (row) {
|
41122 | return row[ORIGIN_FIELD][valueField] <= range[1] && row[ORIGIN_FIELD][valueField] >= range[0];
|
41123 | });
|
41124 | }
|
41125 |
|
41126 |
|
41127 | var scale = self._getScale(valueField);
|
41128 | for (var i = 0; i < data.length; i++) {
|
41129 | var obj = data[i];
|
41130 | var cfg = self.getDrawCfg(obj);
|
41131 | var alpha = scale.scale(obj[ORIGIN_FIELD][valueField]);
|
41132 | self._drawGrayScaleBlurredCircle(cfg.x, cfg.y, size.radius, alpha, ctx);
|
41133 | }
|
41134 |
|
41135 |
|
41136 | var colored = ctx.getImageData(coord.start.x, coord.end.y, width + coord.start.x, height + coord.end.y);
|
41137 | self._clearShadowCanvasCtx();
|
41138 | self._colorize(colored);
|
41139 | ctx.putImageData(colored, 0, 0);
|
41140 | var imageShape = self._getImageShape();
|
41141 | imageShape.attr('x', coord.start.x);
|
41142 | imageShape.attr('y', coord.end.y);
|
41143 | imageShape.attr('width', width + coord.start.x);
|
41144 | imageShape.attr('height', height + coord.end.y);
|
41145 | imageShape.attr('img', ctx.canvas);
|
41146 | };
|
41147 |
|
41148 | Heatmap.prototype.draw = function draw(data /* , container, shapeFactory, index */) {
|
41149 | var self = this;
|
41150 | self.set(MAPPED_DATA, data);
|
41151 |
|
41152 | self._prepareRange();
|
41153 | self._prepareSize();
|
41154 |
|
41155 | var size = self.get(HEATMAP_SIZE);
|
41156 | self._prepareGreyScaleBlurredCircle(size.radius, size.blur);
|
41157 |
|
41158 | var range = self.get(VALUE_RANGE);
|
41159 | self.drawWithRange(range);
|
41160 |
|
41161 | };
|
41162 |
|
41163 | return Heatmap;
|
41164 | }(GeomBase);
|
41165 |
|
41166 | module.exports = Heatmap;
|
41167 |
|
41168 | }),
|
41169 |
|
41170 | (function(module, exports, __webpack_require__) {
|
41171 |
|
41172 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
41173 |
|
41174 |
|
41175 |
|
41176 |
|
41177 |
|
41178 |
|
41179 | var Util = __webpack_require__(0);
|
41180 | var Global = __webpack_require__(1);
|
41181 | var Scale = __webpack_require__(116);
|
41182 | var dateRegex = /^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/;
|
41183 | var TYPES = {
|
41184 | LINEAR: 'linear',
|
41185 | CAT: 'cat',
|
41186 | TIME: 'time'
|
41187 | };
|
41188 |
|
41189 | var ScaleController = function () {
|
41190 | function ScaleController(cfg) {
|
41191 | _classCallCheck(this, ScaleController);
|
41192 |
|
41193 |
|
41194 | this.defs = {};
|
41195 | Util.assign(this, cfg);
|
41196 | }
|
41197 |
|
41198 | ScaleController.prototype._getDef = function _getDef(field) {
|
41199 | var defs = this.defs;
|
41200 | var def = null;
|
41201 | if (Global.scales[field] || defs[field]) {
|
41202 | def = Util.mix({}, Global.scales[field]);
|
41203 |
|
41204 | Util.each(defs[field], function (v, k) {
|
41205 | if (Util.isNil(v)) {
|
41206 | delete def[k];
|
41207 | } else {
|
41208 | def[k] = v;
|
41209 | }
|
41210 | });
|
41211 | }
|
41212 | return def;
|
41213 | };
|
41214 |
|
41215 | ScaleController.prototype._getDefaultType = function _getDefaultType(field, data) {
|
41216 | var type = TYPES.LINEAR;
|
41217 | var value = Util.Array.firstValue(data, field);
|
41218 | if (Util.isArray(value)) {
|
41219 | value = value[0];
|
41220 | }
|
41221 | if (dateRegex.test(value)) {
|
41222 | type = TYPES.TIME;
|
41223 | } else if (Util.isString(value)) {
|
41224 | type = TYPES.CAT;
|
41225 | }
|
41226 | return type;
|
41227 | };
|
41228 |
|
41229 | ScaleController.prototype._getScaleCfg = function _getScaleCfg(type, field, data) {
|
41230 | var cfg = {
|
41231 | field: field
|
41232 | };
|
41233 | var values = Util.Array.values(data, field);
|
41234 | cfg.values = values;
|
41235 | if (!Scale.isCategory(type) && type !== 'time') {
|
41236 | var range = Util.Array.getRange(values);
|
41237 | cfg.min = range.min;
|
41238 | cfg.max = range.max;
|
41239 | cfg.nice = true;
|
41240 | }
|
41241 |
|
41242 | if (type === 'time') {
|
41243 | cfg.nice = false;
|
41244 | }
|
41245 | return cfg;
|
41246 | };
|
41247 |
|
41248 | ScaleController.prototype.createScale = function createScale(field, data) {
|
41249 | var self = this;
|
41250 | var def = self._getDef(field);
|
41251 | var scale = void 0;
|
41252 |
|
41253 | if (!data || !data.length) {
|
41254 | if (def && def.type) {
|
41255 | scale = Scale[def.type](def);
|
41256 | } else {
|
41257 | scale = Scale.identity({
|
41258 | value: field,
|
41259 | field: field.toString(),
|
41260 | values: [field]
|
41261 | });
|
41262 | }
|
41263 | return scale;
|
41264 | }
|
41265 | var firstValue = Util.Array.firstValue(data, field);
|
41266 |
|
41267 | if (Util.isNumber(field) || Util.isNil(firstValue) && !def) {
|
41268 | scale = Scale.identity({
|
41269 | value: field,
|
41270 | field: field.toString(),
|
41271 | values: [field]
|
41272 | });
|
41273 | } else {
|
41274 |
|
41275 | var type = void 0;
|
41276 | if (def) {
|
41277 | type = def.type;
|
41278 | }
|
41279 | type = type || self._getDefaultType(field, data);
|
41280 | var cfg = self._getScaleCfg(type, field, data);
|
41281 | if (def) {
|
41282 | Util.mix(cfg, def);
|
41283 | }
|
41284 | scale = Scale[type](cfg);
|
41285 | }
|
41286 | return scale;
|
41287 | };
|
41288 |
|
41289 | return ScaleController;
|
41290 | }();
|
41291 |
|
41292 | module.exports = ScaleController;
|
41293 |
|
41294 | }),
|
41295 |
|
41296 | (function(module, exports, __webpack_require__) {
|
41297 |
|
41298 |
|
41299 |
|
41300 |
|
41301 |
|
41302 |
|
41303 | var Util = __webpack_require__(0);
|
41304 | var AutoUtil = __webpack_require__(117);
|
41305 | var MIN_COUNT = 5;
|
41306 | var MAX_COUNT = 7;
|
41307 | var Global = __webpack_require__(1);
|
41308 |
|
41309 | module.exports = function (info) {
|
41310 | var min = info.min;
|
41311 | var max = info.max;
|
41312 | var interval = info.interval;
|
41313 | var ticks = [];
|
41314 | var minCount = info.minCount || MIN_COUNT;
|
41315 | var maxCount = info.maxCount || MAX_COUNT;
|
41316 | var isFixedCount = minCount === maxCount;
|
41317 | var minLimit = Util.isNil(info.minLimit) ? -Infinity : info.minLimit;
|
41318 | var maxLimit = Util.isNil(info.maxLimit) ? Infinity : info.maxLimit;
|
41319 | var avgCount = (minCount + maxCount) / 2;
|
41320 | var count = avgCount;
|
41321 |
|
41322 | var snapArray = info.snapArray ? info.snapArray : isFixedCount ? Global.snapCountArray : Global.snapArray;
|
41323 |
|
41324 |
|
41325 | if (min === minLimit && max === maxLimit && isFixedCount) {
|
41326 | interval = (max - min) / (count - 1);
|
41327 | }
|
41328 |
|
41329 | if (Util.isNil(min)) {
|
41330 | min = 0;
|
41331 | }
|
41332 | if (Util.isNil(max)) {
|
41333 | max = 0;
|
41334 | }
|
41335 | if (max === min) {
|
41336 | if (min === 0) {
|
41337 | max = 1;
|
41338 | } else {
|
41339 | if (min > 0) {
|
41340 | min = 0;
|
41341 | } else {
|
41342 | max = 0;
|
41343 | }
|
41344 | }
|
41345 | if (max - min < 5 && !interval && max - min >= 1) {
|
41346 | interval = 1;
|
41347 | }
|
41348 | }
|
41349 |
|
41350 | if (Util.isNil(interval)) {
|
41351 |
|
41352 | var temp = (max - min) / (avgCount - 1);
|
41353 | interval = AutoUtil.snapFactorTo(temp, snapArray, 'ceil');
|
41354 | if (maxCount !== minCount) {
|
41355 | count = parseInt((max - min) / interval, 10);
|
41356 | if (count > maxCount) {
|
41357 | count = maxCount;
|
41358 | }
|
41359 | if (count < minCount) {
|
41360 | count = minCount;
|
41361 | }
|
41362 |
|
41363 | interval = AutoUtil.snapFactorTo((max - min) / (count - 1), snapArray, 'floor');
|
41364 | }
|
41365 | }
|
41366 | if (info.interval || maxCount !== minCount) {
|
41367 |
|
41368 | max = Math.min(AutoUtil.snapMultiple(max, interval, 'ceil'), maxLimit);
|
41369 | min = Math.max(AutoUtil.snapMultiple(min, interval, 'floor'), minLimit);
|
41370 |
|
41371 | count = Math.round((max - min) / interval);
|
41372 | min = Util.fixedBase(min, interval);
|
41373 | max = Util.fixedBase(max, interval);
|
41374 | } else {
|
41375 | avgCount = parseInt(avgCount, 10);
|
41376 | var avg = (max + min) / 2;
|
41377 | var avgTick = AutoUtil.snapMultiple(avg, interval, 'ceil');
|
41378 | var sideCount = Math.floor((avgCount - 2) / 2);
|
41379 | var maxTick = avgTick + sideCount * interval;
|
41380 | var minTick = void 0;
|
41381 | if (avgCount % 2 === 0) {
|
41382 | minTick = avgTick - sideCount * interval;
|
41383 | } else {
|
41384 | minTick = avgTick - (sideCount + 1) * interval;
|
41385 | }
|
41386 | if (maxTick < max) {
|
41387 | maxTick = maxTick + interval;
|
41388 | }
|
41389 | if (minTick > min) {
|
41390 | minTick = minTick - interval;
|
41391 | }
|
41392 | max = Util.fixedBase(maxTick, interval);
|
41393 | min = Util.fixedBase(minTick, interval);
|
41394 | }
|
41395 |
|
41396 | max = Math.min(max, maxLimit);
|
41397 | min = Math.max(min, minLimit);
|
41398 |
|
41399 | ticks.push(min);
|
41400 | for (var i = 1; i < count; i++) {
|
41401 | var tickValue = Util.fixedBase(interval * i + min, interval);
|
41402 | if (tickValue < max) {
|
41403 | ticks.push(tickValue);
|
41404 | }
|
41405 | }
|
41406 | if (ticks[ticks.length - 1] < max) {
|
41407 | ticks.push(max);
|
41408 | }
|
41409 | return {
|
41410 | min: min,
|
41411 | max: max,
|
41412 | interval: interval,
|
41413 | count: count,
|
41414 | ticks: ticks
|
41415 | };
|
41416 | };
|
41417 |
|
41418 | }),
|
41419 |
|
41420 | (function(module, exports, __webpack_require__) {
|
41421 |
|
41422 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
41423 |
|
41424 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
41425 |
|
41426 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
41427 |
|
41428 |
|
41429 |
|
41430 |
|
41431 |
|
41432 |
|
41433 | var Base = __webpack_require__(41);
|
41434 | var Util = __webpack_require__(0);
|
41435 |
|
41436 | var Identity = function (_Base) {
|
41437 | _inherits(Identity, _Base);
|
41438 |
|
41439 | function Identity() {
|
41440 | _classCallCheck(this, Identity);
|
41441 |
|
41442 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
41443 | }
|
41444 |
|
41445 | |
41446 |
|
41447 |
|
41448 | Identity.prototype.getDefaultCfg = function getDefaultCfg() {
|
41449 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
41450 | return Util.mix({}, cfg, {
|
41451 | isIdentity: true,
|
41452 | |
41453 |
|
41454 |
|
41455 |
|
41456 | type: 'identity',
|
41457 |
|
41458 | |
41459 |
|
41460 |
|
41461 |
|
41462 | value: null
|
41463 | });
|
41464 | };
|
41465 |
|
41466 | |
41467 |
|
41468 |
|
41469 |
|
41470 |
|
41471 | Identity.prototype.getText = function getText() {
|
41472 | return this.value.toString();
|
41473 | };
|
41474 |
|
41475 | |
41476 |
|
41477 |
|
41478 |
|
41479 |
|
41480 | Identity.prototype.scale = function scale(value) {
|
41481 | if (this.value !== value && Util.isNumber(value)) {
|
41482 | return value;
|
41483 | }
|
41484 | return this.range[0];
|
41485 | };
|
41486 |
|
41487 | |
41488 |
|
41489 |
|
41490 |
|
41491 |
|
41492 | Identity.prototype.invert = function invert() {
|
41493 | return this.value;
|
41494 | };
|
41495 |
|
41496 | return Identity;
|
41497 | }(Base);
|
41498 |
|
41499 | module.exports = Identity;
|
41500 |
|
41501 | }),
|
41502 |
|
41503 | (function(module, exports, __webpack_require__) {
|
41504 |
|
41505 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
41506 |
|
41507 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
41508 |
|
41509 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
41510 |
|
41511 |
|
41512 |
|
41513 |
|
41514 |
|
41515 |
|
41516 | var Linear = __webpack_require__(42);
|
41517 | var Util = __webpack_require__(0);
|
41518 | var timeAuto = __webpack_require__(325);
|
41519 | var fecha = __webpack_require__(120);
|
41520 | var TimeUtil = __webpack_require__(121);
|
41521 |
|
41522 |
|
41523 |
|
41524 |
|
41525 |
|
41526 |
|
41527 | var Time = function (_Linear) {
|
41528 | _inherits(Time, _Linear);
|
41529 |
|
41530 | function Time() {
|
41531 | _classCallCheck(this, Time);
|
41532 |
|
41533 | return _possibleConstructorReturn(this, _Linear.apply(this, arguments));
|
41534 | }
|
41535 |
|
41536 | |
41537 |
|
41538 |
|
41539 | Time.prototype.getDefaultCfg = function getDefaultCfg() {
|
41540 | var cfg = _Linear.prototype.getDefaultCfg.call(this);
|
41541 | return Util.mix({}, cfg, {
|
41542 | |
41543 |
|
41544 |
|
41545 | type: 'time',
|
41546 |
|
41547 | |
41548 |
|
41549 |
|
41550 |
|
41551 | mask: 'YYYY-MM-DD'
|
41552 | });
|
41553 | };
|
41554 |
|
41555 | |
41556 |
|
41557 |
|
41558 |
|
41559 |
|
41560 | Time.prototype.init = function init() {
|
41561 | var self = this;
|
41562 | var values = self.values;
|
41563 | if (values) {
|
41564 |
|
41565 | var timeStamps = [];
|
41566 | var min = Infinity;
|
41567 | var secondMin = min;
|
41568 | var max = 0;
|
41569 |
|
41570 | Util.each(values, function (v) {
|
41571 | var timeStamp = self._toTimeStamp(v);
|
41572 | if (min > timeStamp) {
|
41573 | secondMin = min;
|
41574 | min = timeStamp;
|
41575 | } else if (secondMin > timeStamp) {
|
41576 | secondMin = timeStamp;
|
41577 | }
|
41578 | if (max < timeStamp) {
|
41579 | max = timeStamp;
|
41580 | }
|
41581 | timeStamps.push(timeStamp);
|
41582 | });
|
41583 |
|
41584 | if (values.length > 1) {
|
41585 | self.minTickInterval = secondMin - min;
|
41586 | }
|
41587 | if (Util.isNil(self.min) || self._toTimeStamp(self.min) > min) {
|
41588 | self.min = min;
|
41589 | }
|
41590 | if (Util.isNil(self.max) || self._toTimeStamp(self.max) < max) {
|
41591 | self.max = max;
|
41592 | }
|
41593 | }
|
41594 | _Linear.prototype.init.call(this);
|
41595 | };
|
41596 |
|
41597 | Time.prototype.calculateTicks = function calculateTicks() {
|
41598 | var self = this;
|
41599 | var min = self.min;
|
41600 | var max = self.max;
|
41601 | var count = self.tickCount;
|
41602 | var interval = self.tickInterval;
|
41603 | var tmp = timeAuto({
|
41604 | min: min,
|
41605 | max: max,
|
41606 | minCount: count,
|
41607 | maxCount: count,
|
41608 | interval: interval,
|
41609 | minInterval: self.minTickInterval
|
41610 | });
|
41611 | return tmp.ticks;
|
41612 | };
|
41613 |
|
41614 | |
41615 |
|
41616 |
|
41617 |
|
41618 |
|
41619 | Time.prototype.getText = function getText(value) {
|
41620 | var formatter = this.formatter;
|
41621 | value = this.translate(value);
|
41622 | value = formatter ? formatter(value) : fecha.format(value, this.mask);
|
41623 | return value;
|
41624 | };
|
41625 |
|
41626 | |
41627 |
|
41628 |
|
41629 |
|
41630 |
|
41631 | Time.prototype.scale = function scale(value) {
|
41632 | if (Util.isString(value)) {
|
41633 | value = this.translate(value);
|
41634 | }
|
41635 | return _Linear.prototype.scale.call(this, value);
|
41636 | };
|
41637 |
|
41638 | |
41639 |
|
41640 |
|
41641 |
|
41642 |
|
41643 | Time.prototype.translate = function translate(value) {
|
41644 | return this._toTimeStamp(value);
|
41645 | };
|
41646 |
|
41647 |
|
41648 |
|
41649 |
|
41650 | Time.prototype._toTimeStamp = function _toTimeStamp(value) {
|
41651 | return TimeUtil.toTimeStamp(value);
|
41652 | };
|
41653 |
|
41654 | return Time;
|
41655 | }(Linear);
|
41656 |
|
41657 | module.exports = Time;
|
41658 |
|
41659 | }),
|
41660 |
|
41661 | (function(module, exports, __webpack_require__) {
|
41662 |
|
41663 |
|
41664 |
|
41665 |
|
41666 |
|
41667 |
|
41668 | var Util = __webpack_require__(0);
|
41669 | var AutoUtil = __webpack_require__(117);
|
41670 |
|
41671 | var MAX_COUNT = 6;
|
41672 | var SNAP_ARRAY = [1, 2, 4, 6, 8, 12];
|
41673 | var MINUTE_MS = 60 * 1000;
|
41674 | var HOUR_MS = 3600 * 1000;
|
41675 | var DAY_MS = 24 * 3600 * 1000;
|
41676 |
|
41677 | function getYear(date) {
|
41678 | return new Date(date).getFullYear();
|
41679 | }
|
41680 |
|
41681 | function createYear(year) {
|
41682 | return new Date(year, 0, 1).getTime();
|
41683 | }
|
41684 |
|
41685 | function getMonth(date) {
|
41686 | return new Date(date).getMonth();
|
41687 | }
|
41688 |
|
41689 | function diffMonth(min, max) {
|
41690 | var minYear = getYear(min);
|
41691 | var maxYear = getYear(max);
|
41692 | var minMonth = getMonth(min);
|
41693 | var maxMonth = getMonth(max);
|
41694 | return (maxYear - minYear) * 12 + (maxMonth - minMonth) % 12;
|
41695 | }
|
41696 |
|
41697 | function creatMonth(year, month) {
|
41698 | return new Date(year, month, 1).getTime();
|
41699 | }
|
41700 |
|
41701 | function diffDay(min, max) {
|
41702 | return Math.ceil((max - min) / DAY_MS);
|
41703 | }
|
41704 |
|
41705 | function diffHour(min, max) {
|
41706 | return Math.ceil((max - min) / HOUR_MS);
|
41707 | }
|
41708 |
|
41709 | function diffMinus(min, max) {
|
41710 | return Math.ceil((max - min) / (60 * 1000));
|
41711 | }
|
41712 |
|
41713 | module.exports = function (info) {
|
41714 | var minInterval = info.minInterval;
|
41715 | var ticks = [];
|
41716 | var min = info.min;
|
41717 | var max = info.max;
|
41718 | var interval = info.interval;
|
41719 | var count = void 0;
|
41720 |
|
41721 |
|
41722 | if (max === min) {
|
41723 | max = min + DAY_MS;
|
41724 | }
|
41725 |
|
41726 |
|
41727 | if (Util.isNil(interval)) {
|
41728 | var innerTime = max - min;
|
41729 | var dms = DAY_MS;
|
41730 | var yms = 365 * dms;
|
41731 | interval = parseInt(innerTime / (info.maxCount || MAX_COUNT), 10);
|
41732 | if (minInterval && minInterval > interval) {
|
41733 | interval = minInterval;
|
41734 | }
|
41735 | var yfactor = interval / yms;
|
41736 | var minYear = getYear(min);
|
41737 |
|
41738 | if (yfactor > 0.51) {
|
41739 | var year = Math.ceil(yfactor);
|
41740 |
|
41741 | var maxYear = getYear(max);
|
41742 |
|
41743 | for (var i = minYear; i <= maxYear + year; i = i + year) {
|
41744 | ticks.push(createYear(i));
|
41745 | }
|
41746 | interval = null;
|
41747 | } else if (yfactor > 0.0834) {
|
41748 |
|
41749 | var month = Math.ceil(yfactor / 0.0834);
|
41750 | var mmMoth = getMonth(min);
|
41751 | var dMonths = diffMonth(min, max);
|
41752 |
|
41753 | for (var _i = 0; _i <= dMonths + month; _i = _i + month) {
|
41754 | ticks.push(creatMonth(minYear, _i + mmMoth));
|
41755 | }
|
41756 | interval = null;
|
41757 | } else if (interval > dms * 0.5) {
|
41758 |
|
41759 | var date = new Date(min);
|
41760 | var _year = date.getFullYear();
|
41761 | var _month = date.getMonth(min);
|
41762 | var mday = date.getDate();
|
41763 | var day = Math.ceil(interval / dms);
|
41764 | var ddays = diffDay(min, max);
|
41765 | interval = day * dms;
|
41766 | for (var _i2 = 0; _i2 < ddays + day; _i2 = _i2 + day) {
|
41767 | ticks.push(new Date(_year, _month, mday + _i2).getTime());
|
41768 | }
|
41769 | } else if (interval > HOUR_MS) {
|
41770 |
|
41771 | var _date = new Date(min);
|
41772 | var _year2 = _date.getFullYear();
|
41773 | var _month2 = _date.getMonth(min);
|
41774 | var _day = _date.getDate();
|
41775 | var hour = _date.getHours();
|
41776 | var hours = AutoUtil.snapTo(SNAP_ARRAY, Math.ceil(interval / HOUR_MS));
|
41777 | var dHours = diffHour(min, max);
|
41778 | interval = hours * HOUR_MS;
|
41779 |
|
41780 | for (var _i3 = 0; _i3 <= dHours + hours; _i3 = _i3 + hours) {
|
41781 | ticks.push(new Date(_year2, _month2, _day, hour + _i3).getTime());
|
41782 | }
|
41783 | } else if (interval > MINUTE_MS) {
|
41784 |
|
41785 | var dMinus = diffMinus(min, max);
|
41786 | var minutes = Math.ceil(interval / MINUTE_MS);
|
41787 | interval = minutes * MINUTE_MS;
|
41788 |
|
41789 | for (var _i4 = 0; _i4 <= dMinus + minutes; _i4 = _i4 + minutes) {
|
41790 | ticks.push(min + _i4 * MINUTE_MS);
|
41791 | }
|
41792 | } else {
|
41793 | if (interval < 1000) {
|
41794 | interval = 1000;
|
41795 | }
|
41796 | min = Math.floor(min / 1000) * 1000;
|
41797 | var dSeconds = Math.ceil((max - min) / 1000);
|
41798 | var seconds = Math.ceil(interval / 1000);
|
41799 | interval = seconds * 1000;
|
41800 |
|
41801 | for (var _i5 = 0; _i5 < dSeconds + seconds; _i5 = _i5 + seconds) {
|
41802 | ticks.push(min + _i5 * 1000);
|
41803 | }
|
41804 | }
|
41805 | }
|
41806 |
|
41807 | if (!ticks.length) {
|
41808 | min = Math.floor(min / 1000) * 1000;
|
41809 | max = Math.ceil(max / 1000) * 1000;
|
41810 | count = (max - min) / interval;
|
41811 | for (var _i6 = 0; _i6 <= count; _i6++) {
|
41812 | ticks.push(Util.fixedBase(interval * _i6 + min, interval));
|
41813 | }
|
41814 | }
|
41815 |
|
41816 | return {
|
41817 | max: max,
|
41818 | min: min,
|
41819 | interval: interval,
|
41820 | ticks: ticks,
|
41821 | count: ticks.length
|
41822 | };
|
41823 | };
|
41824 |
|
41825 | }),
|
41826 |
|
41827 | (function(module, exports, __webpack_require__) {
|
41828 |
|
41829 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
41830 |
|
41831 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
41832 |
|
41833 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
41834 |
|
41835 |
|
41836 |
|
41837 |
|
41838 |
|
41839 |
|
41840 | var Category = __webpack_require__(118);
|
41841 | var Util = __webpack_require__(0);
|
41842 | var fecha = __webpack_require__(120);
|
41843 | var catAuto = __webpack_require__(119);
|
41844 | var TimeUtil = __webpack_require__(121);
|
41845 |
|
41846 |
|
41847 |
|
41848 |
|
41849 |
|
41850 |
|
41851 | var TimeCategory = function (_Category) {
|
41852 | _inherits(TimeCategory, _Category);
|
41853 |
|
41854 | function TimeCategory() {
|
41855 | _classCallCheck(this, TimeCategory);
|
41856 |
|
41857 | return _possibleConstructorReturn(this, _Category.apply(this, arguments));
|
41858 | }
|
41859 |
|
41860 | |
41861 |
|
41862 |
|
41863 | TimeCategory.prototype.getDefaultCfg = function getDefaultCfg() {
|
41864 | var cfg = _Category.prototype.getDefaultCfg.call(this);
|
41865 | return Util.mix({}, cfg, {
|
41866 | |
41867 |
|
41868 |
|
41869 | type: 'timeCat',
|
41870 |
|
41871 | |
41872 |
|
41873 |
|
41874 |
|
41875 | mask: 'YYYY-MM-DD',
|
41876 |
|
41877 | |
41878 |
|
41879 |
|
41880 | tickCount: 5
|
41881 | });
|
41882 | };
|
41883 |
|
41884 | TimeCategory.prototype.init = function init() {
|
41885 | var self = this;
|
41886 | var values = this.values;
|
41887 |
|
41888 | Util.each(values, function (v, i) {
|
41889 | values[i] = self._toTimeStamp(v);
|
41890 | });
|
41891 | values.sort(function (v1, v2) {
|
41892 | return v1 - v2;
|
41893 | });
|
41894 |
|
41895 | if (!self.ticks) {
|
41896 | self.ticks = this.calculateTicks(false);
|
41897 | }
|
41898 | };
|
41899 |
|
41900 | |
41901 |
|
41902 |
|
41903 |
|
41904 |
|
41905 |
|
41906 |
|
41907 | TimeCategory.prototype.calculateTicks = function calculateTicks(formated) {
|
41908 | var self = this;
|
41909 | var count = self.tickCount;
|
41910 | var temp = catAuto({
|
41911 | maxCount: count,
|
41912 | data: self.values
|
41913 | });
|
41914 |
|
41915 | var ticks = temp.ticks;
|
41916 | if (formated) {
|
41917 | Util.each(ticks, function (value, index) {
|
41918 | ticks[index] = fecha.format(value, self.mask);
|
41919 | });
|
41920 | }
|
41921 | return ticks;
|
41922 | };
|
41923 |
|
41924 | |
41925 |
|
41926 |
|
41927 |
|
41928 |
|
41929 | TimeCategory.prototype.translate = function translate(value) {
|
41930 | value = this._toTimeStamp(value);
|
41931 | var index = this.values.indexOf(value);
|
41932 |
|
41933 | if (index === -1) {
|
41934 | if (Util.isNumber(value) && value < this.values.length) {
|
41935 | index = value;
|
41936 | } else {
|
41937 | index = NaN;
|
41938 | }
|
41939 | }
|
41940 | return index;
|
41941 | };
|
41942 |
|
41943 | |
41944 |
|
41945 |
|
41946 |
|
41947 |
|
41948 | TimeCategory.prototype.scale = function scale(value) {
|
41949 | var rangeMin = this.rangeMin();
|
41950 | var rangeMax = this.rangeMax();
|
41951 | var index = this.translate(value);
|
41952 | var percent = void 0;
|
41953 |
|
41954 | if (this.values.length === 1) {
|
41955 | percent = index;
|
41956 | } else if (index > -1) {
|
41957 | percent = index / (this.values.length - 1);
|
41958 | } else {
|
41959 | percent = 0;
|
41960 | }
|
41961 |
|
41962 | return rangeMin + percent * (rangeMax - rangeMin);
|
41963 | };
|
41964 |
|
41965 | |
41966 |
|
41967 |
|
41968 |
|
41969 |
|
41970 | TimeCategory.prototype.getText = function getText(value) {
|
41971 | var result = '';
|
41972 | var index = this.translate(value);
|
41973 | if (index > -1) {
|
41974 | result = this.values[index];
|
41975 | } else {
|
41976 | result = value;
|
41977 | }
|
41978 |
|
41979 | var formatter = this.formatter;
|
41980 | result = parseInt(result, 10);
|
41981 | result = formatter ? formatter(result) : fecha.format(result, this.mask);
|
41982 | return result;
|
41983 | };
|
41984 |
|
41985 | |
41986 |
|
41987 |
|
41988 |
|
41989 |
|
41990 | TimeCategory.prototype.getTicks = function getTicks() {
|
41991 | var self = this;
|
41992 | var ticks = this.ticks;
|
41993 | var rst = [];
|
41994 | Util.each(ticks, function (tick) {
|
41995 | var obj = void 0;
|
41996 | if (Util.isObject(tick)) {
|
41997 | obj = tick;
|
41998 | } else {
|
41999 | obj = {
|
42000 | text: Util.isString(tick) ? tick : self.getText(tick),
|
42001 | value: self.scale(tick)
|
42002 | };
|
42003 | }
|
42004 | rst.push(obj);
|
42005 | });
|
42006 | return rst;
|
42007 | };
|
42008 |
|
42009 |
|
42010 |
|
42011 |
|
42012 | TimeCategory.prototype._toTimeStamp = function _toTimeStamp(value) {
|
42013 | return TimeUtil.toTimeStamp(value);
|
42014 | };
|
42015 |
|
42016 | return TimeCategory;
|
42017 | }(Category);
|
42018 |
|
42019 | module.exports = TimeCategory;
|
42020 |
|
42021 | }),
|
42022 |
|
42023 | (function(module, exports, __webpack_require__) {
|
42024 |
|
42025 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
42026 |
|
42027 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
42028 |
|
42029 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
42030 |
|
42031 |
|
42032 |
|
42033 |
|
42034 |
|
42035 |
|
42036 | var Linear = __webpack_require__(42);
|
42037 | var Util = __webpack_require__(0);
|
42038 |
|
42039 |
|
42040 | function log(a, b) {
|
42041 | if (a === 1) {
|
42042 | return 1;
|
42043 | }
|
42044 | return Math.log(b) / Math.log(a);
|
42045 | }
|
42046 |
|
42047 |
|
42048 |
|
42049 |
|
42050 |
|
42051 |
|
42052 | var Log = function (_Linear) {
|
42053 | _inherits(Log, _Linear);
|
42054 |
|
42055 | function Log() {
|
42056 | _classCallCheck(this, Log);
|
42057 |
|
42058 | return _possibleConstructorReturn(this, _Linear.apply(this, arguments));
|
42059 | }
|
42060 |
|
42061 | |
42062 |
|
42063 |
|
42064 | Log.prototype.getDefaultCfg = function getDefaultCfg() {
|
42065 | var cfg = _Linear.prototype.getDefaultCfg.call(this);
|
42066 | return Util.mix({}, cfg, {
|
42067 | |
42068 |
|
42069 |
|
42070 | type: 'log',
|
42071 |
|
42072 | |
42073 |
|
42074 |
|
42075 |
|
42076 | base: 2,
|
42077 |
|
42078 | |
42079 |
|
42080 |
|
42081 |
|
42082 |
|
42083 | tickCount: 10,
|
42084 |
|
42085 |
|
42086 | _minTick: null
|
42087 | });
|
42088 | };
|
42089 | |
42090 |
|
42091 |
|
42092 |
|
42093 |
|
42094 | Log.prototype.calculateTicks = function calculateTicks() {
|
42095 | var self = this;
|
42096 | var base = self.base;
|
42097 | var minTick = void 0;
|
42098 | if (self.min < 0) {
|
42099 | throw new Error('The minimum value must be greater than zero!');
|
42100 | }
|
42101 | var maxTick = log(base, self.max);
|
42102 |
|
42103 | if (self.min > 0) {
|
42104 | minTick = Math.floor(log(base, self.min));
|
42105 | } else {
|
42106 | var values = self.values;
|
42107 | var positiveMin = self.max;
|
42108 | Util.each(values, function (value) {
|
42109 | if (value > 0 && value < positiveMin) {
|
42110 | positiveMin = value;
|
42111 | }
|
42112 | });
|
42113 | if (positiveMin === self.max) {
|
42114 | positiveMin = self.max / base;
|
42115 | }
|
42116 | if (positiveMin > 1) {
|
42117 | positiveMin = 1;
|
42118 | }
|
42119 | minTick = Math.floor(log(base, positiveMin));
|
42120 | self._minTick = minTick;
|
42121 | self.positiveMin = positiveMin;
|
42122 | }
|
42123 | var count = maxTick - minTick;
|
42124 | var tickCount = self.tickCount;
|
42125 | var avg = Math.ceil(count / tickCount);
|
42126 | var ticks = [];
|
42127 |
|
42128 | for (var i = minTick; i < maxTick + avg; i = i + avg) {
|
42129 | ticks.push(Math.pow(base, i));
|
42130 | }
|
42131 | if (self.min === 0) {
|
42132 | ticks.unshift(0);
|
42133 | }
|
42134 | return ticks;
|
42135 | };
|
42136 |
|
42137 |
|
42138 |
|
42139 | Log.prototype._getScalePercent = function _getScalePercent(value) {
|
42140 | var max = this.max;
|
42141 | var min = this.min;
|
42142 | if (max === min) {
|
42143 | return 0;
|
42144 | }
|
42145 |
|
42146 | if (value <= 0) {
|
42147 | return 0;
|
42148 | }
|
42149 | var base = this.base;
|
42150 | var positiveMin = this.positiveMin;
|
42151 |
|
42152 | if (positiveMin) {
|
42153 | min = positiveMin * 1 / base;
|
42154 | }
|
42155 | var percent = void 0;
|
42156 |
|
42157 | if (value < positiveMin) {
|
42158 | percent = value / positiveMin / (log(base, max) - log(base, min));
|
42159 | } else {
|
42160 | percent = (log(base, value) - log(base, min)) / (log(base, max) - log(base, min));
|
42161 | }
|
42162 | return percent;
|
42163 | };
|
42164 |
|
42165 | |
42166 |
|
42167 |
|
42168 |
|
42169 |
|
42170 | Log.prototype.scale = function scale(value) {
|
42171 | var percent = this._getScalePercent(value);
|
42172 | var rangeMin = this.rangeMin();
|
42173 | var rangeMax = this.rangeMax();
|
42174 | return rangeMin + percent * (rangeMax - rangeMin);
|
42175 | };
|
42176 | |
42177 |
|
42178 |
|
42179 |
|
42180 |
|
42181 | Log.prototype.invert = function invert(value) {
|
42182 | var base = this.base;
|
42183 | var max = log(base, this.max);
|
42184 | var rangeMin = this.rangeMin();
|
42185 | var range = this.rangeMax() - rangeMin;
|
42186 | var min = void 0;
|
42187 | var positiveMin = this.positiveMin;
|
42188 | if (positiveMin) {
|
42189 | if (value === 0) {
|
42190 | return 0;
|
42191 | }
|
42192 | min = log(base, positiveMin / base);
|
42193 | var appendPercent = 1 / (max - min) * range;
|
42194 | if (value < appendPercent) {
|
42195 |
|
42196 | return value / appendPercent * positiveMin;
|
42197 | }
|
42198 | } else {
|
42199 | min = log(base, this.min);
|
42200 | }
|
42201 | var percent = (value - rangeMin) / range;
|
42202 | var tmp = percent * (max - min) + min;
|
42203 | return Math.pow(base, tmp);
|
42204 | };
|
42205 |
|
42206 | return Log;
|
42207 | }(Linear);
|
42208 |
|
42209 | module.exports = Log;
|
42210 |
|
42211 | }),
|
42212 |
|
42213 | (function(module, exports, __webpack_require__) {
|
42214 |
|
42215 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
42216 |
|
42217 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
42218 |
|
42219 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
42220 |
|
42221 |
|
42222 |
|
42223 |
|
42224 |
|
42225 |
|
42226 | var Linear = __webpack_require__(42);
|
42227 | var Util = __webpack_require__(0);
|
42228 |
|
42229 |
|
42230 | function calBase(a, b) {
|
42231 | var e = Math.E;
|
42232 | var value = Math.pow(e, Math.log(b) / a);
|
42233 | return value;
|
42234 | }
|
42235 |
|
42236 |
|
42237 |
|
42238 |
|
42239 |
|
42240 |
|
42241 | var Pow = function (_Linear) {
|
42242 | _inherits(Pow, _Linear);
|
42243 |
|
42244 | function Pow() {
|
42245 | _classCallCheck(this, Pow);
|
42246 |
|
42247 | return _possibleConstructorReturn(this, _Linear.apply(this, arguments));
|
42248 | }
|
42249 |
|
42250 | |
42251 |
|
42252 |
|
42253 | Pow.prototype.getDefaultCfg = function getDefaultCfg() {
|
42254 | var cfg = _Linear.prototype.getDefaultCfg.call(this);
|
42255 | return Util.mix({}, cfg, {
|
42256 | |
42257 |
|
42258 |
|
42259 | type: 'pow',
|
42260 |
|
42261 | |
42262 |
|
42263 |
|
42264 |
|
42265 | exponent: 2,
|
42266 |
|
42267 | |
42268 |
|
42269 |
|
42270 |
|
42271 |
|
42272 | tickCount: 10
|
42273 | });
|
42274 | };
|
42275 |
|
42276 | |
42277 |
|
42278 |
|
42279 |
|
42280 |
|
42281 | Pow.prototype.calculateTicks = function calculateTicks() {
|
42282 | var self = this;
|
42283 | var exponent = self.exponent;
|
42284 | var min = void 0;
|
42285 | var max = Math.ceil(calBase(exponent, self.max));
|
42286 |
|
42287 | if (self.min >= 0) {
|
42288 | min = Math.floor(calBase(exponent, self.min));
|
42289 | } else {
|
42290 | min = 0;
|
42291 | }
|
42292 | if (min > max) {
|
42293 | var tmp = max;
|
42294 | max = min;
|
42295 | min = tmp;
|
42296 | }
|
42297 | var count = max - min;
|
42298 | var tickCount = self.tickCount;
|
42299 | var avg = Math.ceil(count / tickCount);
|
42300 | var ticks = [];
|
42301 |
|
42302 | for (var i = min; i < max + avg; i = i + avg) {
|
42303 | ticks.push(Math.pow(i, exponent));
|
42304 | }
|
42305 | return ticks;
|
42306 | };
|
42307 |
|
42308 |
|
42309 |
|
42310 |
|
42311 | Pow.prototype._getScalePercent = function _getScalePercent(value) {
|
42312 | var max = this.max;
|
42313 | var min = this.min;
|
42314 | if (max === min) {
|
42315 | return 0;
|
42316 | }
|
42317 | var exponent = this.exponent;
|
42318 | var percent = (calBase(exponent, value) - calBase(exponent, min)) / (calBase(exponent, max) - calBase(exponent, min));
|
42319 | return percent;
|
42320 | };
|
42321 |
|
42322 | |
42323 |
|
42324 |
|
42325 |
|
42326 |
|
42327 | Pow.prototype.scale = function scale(value) {
|
42328 | var percent = this._getScalePercent(value);
|
42329 | var rangeMin = this.rangeMin();
|
42330 | var rangeMax = this.rangeMax();
|
42331 | return rangeMin + percent * (rangeMax - rangeMin);
|
42332 | };
|
42333 |
|
42334 | |
42335 |
|
42336 |
|
42337 |
|
42338 |
|
42339 | Pow.prototype.invert = function invert(value) {
|
42340 | var percent = (value - this.rangeMin()) / (this.rangeMax() - this.rangeMin());
|
42341 | var exponent = this.exponent;
|
42342 | var max = calBase(exponent, this.max);
|
42343 | var min = calBase(exponent, this.min);
|
42344 | var tmp = percent * (max - min) + min;
|
42345 | return Math.pow(tmp, exponent);
|
42346 | };
|
42347 |
|
42348 | return Pow;
|
42349 | }(Linear);
|
42350 |
|
42351 | module.exports = Pow;
|
42352 |
|
42353 | }),
|
42354 |
|
42355 | (function(module, exports, __webpack_require__) {
|
42356 |
|
42357 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
42358 |
|
42359 |
|
42360 |
|
42361 |
|
42362 |
|
42363 | var Util = __webpack_require__(0);
|
42364 | var Coord = __webpack_require__(330);
|
42365 |
|
42366 | var CoordController = function () {
|
42367 | function CoordController(option) {
|
42368 | _classCallCheck(this, CoordController);
|
42369 |
|
42370 | this.type = 'rect';
|
42371 | this.actions = [];
|
42372 | this.cfg = {};
|
42373 | Util.mix(this, option);
|
42374 | this.option = option || {};
|
42375 | }
|
42376 |
|
42377 | CoordController.prototype.reset = function reset(coordOption) {
|
42378 | this.actions = coordOption.actions || [];
|
42379 | this.type = coordOption.type;
|
42380 | this.cfg = coordOption.cfg;
|
42381 | this.option.actions = this.actions;
|
42382 | this.option.type = this.type;
|
42383 | this.option.cfg = this.cfg;
|
42384 | return this;
|
42385 | };
|
42386 |
|
42387 | CoordController.prototype._execActions = function _execActions(coord) {
|
42388 | var actions = this.actions;
|
42389 | Util.each(actions, function (action) {
|
42390 | var m = action[0];
|
42391 | coord[m](action[1], action[2]);
|
42392 | });
|
42393 | };
|
42394 |
|
42395 | CoordController.prototype.hasAction = function hasAction(actionName) {
|
42396 | var actions = this.actions;
|
42397 | var rst = false;
|
42398 | Util.each(actions, function (action) {
|
42399 | if (actionName === action[0]) {
|
42400 | rst = true;
|
42401 | return false;
|
42402 | }
|
42403 | });
|
42404 | return rst;
|
42405 | };
|
42406 | |
42407 |
|
42408 |
|
42409 |
|
42410 |
|
42411 |
|
42412 |
|
42413 |
|
42414 | CoordController.prototype.createCoord = function createCoord(start, end) {
|
42415 | var self = this;
|
42416 | var type = self.type;
|
42417 | var cfg = self.cfg;
|
42418 | var C = void 0;
|
42419 | var coord = void 0;
|
42420 |
|
42421 | var coordCfg = Util.mix({
|
42422 | start: start,
|
42423 | end: end
|
42424 | }, cfg);
|
42425 |
|
42426 | if (type === 'theta') {
|
42427 | C = Coord.Polar;
|
42428 |
|
42429 | if (!self.hasAction('transpose')) {
|
42430 | self.transpose();
|
42431 | }
|
42432 | coord = new C(coordCfg);
|
42433 | coord.type = type;
|
42434 | } else {
|
42435 | C = Coord[Util.upperFirst(type)] || Coord.Rect;
|
42436 | coord = new C(coordCfg);
|
42437 | }
|
42438 |
|
42439 | self._execActions(coord);
|
42440 | return coord;
|
42441 | };
|
42442 |
|
42443 | CoordController.prototype.rotate = function rotate(angle) {
|
42444 | angle = angle * Math.PI / 180;
|
42445 | this.actions.push(['rotate', angle]);
|
42446 | return this;
|
42447 | };
|
42448 |
|
42449 | CoordController.prototype.reflect = function reflect(dim) {
|
42450 | this.actions.push(['reflect', dim]);
|
42451 | return this;
|
42452 | };
|
42453 |
|
42454 | CoordController.prototype.scale = function scale(sx, sy) {
|
42455 | this.actions.push(['scale', sx, sy]);
|
42456 | return this;
|
42457 | };
|
42458 |
|
42459 | CoordController.prototype.transpose = function transpose() {
|
42460 | this.actions.push(['transpose']);
|
42461 | return this;
|
42462 | };
|
42463 |
|
42464 | return CoordController;
|
42465 | }();
|
42466 |
|
42467 | module.exports = CoordController;
|
42468 |
|
42469 | }),
|
42470 |
|
42471 | (function(module, exports, __webpack_require__) {
|
42472 |
|
42473 |
|
42474 |
|
42475 |
|
42476 |
|
42477 | var Coord = __webpack_require__(43);
|
42478 | Coord.Cartesian = __webpack_require__(331);
|
42479 | Coord.Rect = Coord.Cartesian;
|
42480 | Coord.Polar = __webpack_require__(332);
|
42481 | Coord.Helix = __webpack_require__(333);
|
42482 |
|
42483 | module.exports = Coord;
|
42484 |
|
42485 | }),
|
42486 |
|
42487 | (function(module, exports, __webpack_require__) {
|
42488 |
|
42489 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
42490 |
|
42491 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
42492 |
|
42493 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
42494 |
|
42495 |
|
42496 |
|
42497 |
|
42498 |
|
42499 | var Util = __webpack_require__(0);
|
42500 | var Base = __webpack_require__(43);
|
42501 |
|
42502 | var Cartesian = function (_Base) {
|
42503 | _inherits(Cartesian, _Base);
|
42504 |
|
42505 | |
42506 |
|
42507 |
|
42508 | Cartesian.prototype.getDefaultCfg = function getDefaultCfg() {
|
42509 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
42510 | return Util.mix({}, cfg, {
|
42511 | start: {
|
42512 | x: 0,
|
42513 | y: 0
|
42514 | },
|
42515 | end: {
|
42516 | x: 0,
|
42517 | y: 0
|
42518 | },
|
42519 | type: 'cartesian',
|
42520 | isRect: true
|
42521 | });
|
42522 | };
|
42523 |
|
42524 | function Cartesian(cfg) {
|
42525 | _classCallCheck(this, Cartesian);
|
42526 |
|
42527 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
42528 |
|
42529 | _this._init();
|
42530 | return _this;
|
42531 | }
|
42532 |
|
42533 | Cartesian.prototype._init = function _init() {
|
42534 | var start = this.start,
|
42535 | end = this.end;
|
42536 |
|
42537 | var x = {
|
42538 | start: start.x,
|
42539 | end: end.x
|
42540 | };
|
42541 | var y = {
|
42542 | start: start.y,
|
42543 | end: end.y
|
42544 | };
|
42545 | this.x = x;
|
42546 | this.y = y;
|
42547 | };
|
42548 |
|
42549 | Cartesian.prototype.convertPoint = function convertPoint(point) {
|
42550 | var x = void 0;
|
42551 | var y = void 0;
|
42552 | if (this.isTransposed) {
|
42553 | x = point.y;
|
42554 | y = point.x;
|
42555 | } else {
|
42556 | x = point.x;
|
42557 | y = point.y;
|
42558 | }
|
42559 |
|
42560 | return {
|
42561 | x: this.convertDim(x, 'x'),
|
42562 | y: this.convertDim(y, 'y')
|
42563 | };
|
42564 | };
|
42565 |
|
42566 | Cartesian.prototype.invertPoint = function invertPoint(point) {
|
42567 | var x = this.invertDim(point.x, 'x');
|
42568 | var y = this.invertDim(point.y, 'y');
|
42569 |
|
42570 | if (this.isTransposed) {
|
42571 | return {
|
42572 | x: y,
|
42573 | y: x
|
42574 | };
|
42575 | }
|
42576 |
|
42577 | return {
|
42578 | x: x,
|
42579 | y: y
|
42580 | };
|
42581 | };
|
42582 |
|
42583 | return Cartesian;
|
42584 | }(Base);
|
42585 |
|
42586 | module.exports = Cartesian;
|
42587 |
|
42588 | }),
|
42589 |
|
42590 | (function(module, exports, __webpack_require__) {
|
42591 |
|
42592 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
42593 |
|
42594 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
42595 |
|
42596 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
42597 |
|
42598 |
|
42599 |
|
42600 |
|
42601 |
|
42602 | var Util = __webpack_require__(0);
|
42603 | var Base = __webpack_require__(43);
|
42604 | var MatrixUtil = __webpack_require__(2).MatrixUtil;
|
42605 | var mat3 = MatrixUtil.mat3;
|
42606 | var vec2 = MatrixUtil.vec2;
|
42607 | var vec3 = MatrixUtil.vec3;
|
42608 |
|
42609 | var Polar = function (_Base) {
|
42610 | _inherits(Polar, _Base);
|
42611 |
|
42612 | Polar.prototype.getDefaultCfg = function getDefaultCfg() {
|
42613 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
42614 | return Util.mix({}, cfg, {
|
42615 | startAngle: -Math.PI / 2,
|
42616 | endAngle: Math.PI * 3 / 2,
|
42617 | innerRadius: 0,
|
42618 | type: 'polar',
|
42619 | isPolar: true
|
42620 | });
|
42621 | };
|
42622 |
|
42623 | function Polar(cfg) {
|
42624 | _classCallCheck(this, Polar);
|
42625 |
|
42626 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
42627 |
|
42628 | _this._init();
|
42629 | return _this;
|
42630 | }
|
42631 |
|
42632 | Polar.prototype._init = function _init() {
|
42633 | var radius = this.radius;
|
42634 | var innerRadius = this.innerRadius;
|
42635 | var startAngle = this.startAngle;
|
42636 | var endAngle = this.endAngle;
|
42637 | var center = this.center;
|
42638 | var oneBox = this.getOneBox();
|
42639 |
|
42640 | var oneWidth = oneBox.maxX - oneBox.minX;
|
42641 | var oneHeight = oneBox.maxY - oneBox.minY;
|
42642 | var left = Math.abs(oneBox.minX) / oneWidth;
|
42643 | var top = Math.abs(oneBox.minY) / oneHeight;
|
42644 | var width = this.width;
|
42645 | var height = this.height;
|
42646 | var maxRadius = void 0;
|
42647 | var circleCentre = void 0;
|
42648 | if (height / oneHeight > width / oneWidth) {
|
42649 |
|
42650 | maxRadius = width / oneWidth;
|
42651 | circleCentre = {
|
42652 | x: center.x - (0.5 - left) * width,
|
42653 | y: center.y - (0.5 - top) * maxRadius * oneHeight
|
42654 | };
|
42655 | } else {
|
42656 |
|
42657 | maxRadius = height / oneHeight;
|
42658 | circleCentre = {
|
42659 | x: center.x - (0.5 - left) * maxRadius * oneWidth,
|
42660 | y: center.y - (0.5 - top) * height
|
42661 | };
|
42662 | }
|
42663 |
|
42664 | if (!radius) {
|
42665 | radius = maxRadius;
|
42666 | } else if (radius > 0 && radius <= 1) {
|
42667 | radius = maxRadius * radius;
|
42668 | } else if (radius <= 0 || radius > maxRadius) {
|
42669 | radius = maxRadius;
|
42670 | }
|
42671 |
|
42672 | var x = {
|
42673 | start: startAngle,
|
42674 | end: endAngle
|
42675 | };
|
42676 |
|
42677 | var y = {
|
42678 | start: innerRadius * radius,
|
42679 | end: radius
|
42680 | };
|
42681 |
|
42682 | this.x = x;
|
42683 | this.y = y;
|
42684 | this.radius = radius;
|
42685 | this.circleCentre = circleCentre;
|
42686 | this.center = circleCentre;
|
42687 | };
|
42688 |
|
42689 | Polar.prototype.getCenter = function getCenter() {
|
42690 | return this.circleCentre;
|
42691 | };
|
42692 |
|
42693 | Polar.prototype.getOneBox = function getOneBox() {
|
42694 | var startAngle = this.startAngle;
|
42695 | var endAngle = this.endAngle;
|
42696 | if (endAngle - startAngle >= Math.PI * 2) {
|
42697 | return {
|
42698 | minX: -1,
|
42699 | maxX: 1,
|
42700 | minY: -1,
|
42701 | maxY: 1
|
42702 | };
|
42703 | }
|
42704 | var xs = [0, Math.cos(startAngle), Math.cos(endAngle)];
|
42705 | var ys = [0, Math.sin(startAngle), Math.sin(endAngle)];
|
42706 |
|
42707 | for (var i = -Math.PI * 5 / 2; i < Math.PI * 3 / 2; i += Math.PI / 2) {
|
42708 | if (startAngle <= i && i <= endAngle) {
|
42709 | xs.push(Math.cos(i));
|
42710 | ys.push(Math.sin(i));
|
42711 | }
|
42712 | }
|
42713 |
|
42714 | return {
|
42715 | minX: Math.min.apply(Math, xs),
|
42716 | maxX: Math.max.apply(Math, xs),
|
42717 | minY: Math.min.apply(Math, ys),
|
42718 | maxY: Math.max.apply(Math, ys)
|
42719 | };
|
42720 | };
|
42721 |
|
42722 | Polar.prototype.getRadius = function getRadius() {
|
42723 | return this.radius;
|
42724 | };
|
42725 |
|
42726 | Polar.prototype.convertPoint = function convertPoint(point) {
|
42727 | var center = this.getCenter();
|
42728 | var x = this.isTransposed ? point.y : point.x;
|
42729 | var y = this.isTransposed ? point.x : point.y;
|
42730 |
|
42731 | x = this.convertDim(x, 'x');
|
42732 | y = this.convertDim(y, 'y');
|
42733 |
|
42734 | return {
|
42735 | x: center.x + Math.cos(x) * y,
|
42736 | y: center.y + Math.sin(x) * y
|
42737 | };
|
42738 | };
|
42739 |
|
42740 | Polar.prototype.invertPoint = function invertPoint(point) {
|
42741 | var center = this.getCenter();
|
42742 | var vPoint = [point.x - center.x, point.y - center.y];
|
42743 | var x = this.x;
|
42744 | var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
42745 | mat3.rotate(m, m, x.start);
|
42746 |
|
42747 | var vStart = [1, 0, 0];
|
42748 | vec3.transformMat3(vStart, vStart, m);
|
42749 | vStart = [vStart[0], vStart[1]];
|
42750 | var angle = vec2.angleTo(vStart, vPoint, x.end < x.start);
|
42751 | if (Util.snapEqual(angle, Math.PI * 2)) {
|
42752 | angle = 0;
|
42753 | }
|
42754 | var radius = vec2.length(vPoint);
|
42755 |
|
42756 | var xPercent = angle / (x.end - x.start);
|
42757 | xPercent = x.end - x.start > 0 ? xPercent : -xPercent;
|
42758 |
|
42759 | var yPercent = this.invertDim(radius, 'y');
|
42760 | var rst = {};
|
42761 | rst.x = this.isTransposed ? yPercent : xPercent;
|
42762 | rst.y = this.isTransposed ? xPercent : yPercent;
|
42763 | return rst;
|
42764 | };
|
42765 |
|
42766 | return Polar;
|
42767 | }(Base);
|
42768 |
|
42769 | module.exports = Polar;
|
42770 |
|
42771 | }),
|
42772 |
|
42773 | (function(module, exports, __webpack_require__) {
|
42774 |
|
42775 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
42776 |
|
42777 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
42778 |
|
42779 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
42780 |
|
42781 |
|
42782 |
|
42783 |
|
42784 |
|
42785 | var Util = __webpack_require__(0);
|
42786 | var Base = __webpack_require__(43);
|
42787 | var MatrixUtil = __webpack_require__(2).MatrixUtil;
|
42788 | var vec2 = MatrixUtil.vec2;
|
42789 |
|
42790 | var Helix = function (_Base) {
|
42791 | _inherits(Helix, _Base);
|
42792 |
|
42793 | Helix.prototype.getDefaultCfg = function getDefaultCfg() {
|
42794 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
42795 | return Util.mix({}, cfg, {
|
42796 | startAngle: 1.25 * Math.PI,
|
42797 | endAngle: 7.25 * Math.PI,
|
42798 | innerRadius: 0,
|
42799 | type: 'helix',
|
42800 | isHelix: true
|
42801 | });
|
42802 | };
|
42803 |
|
42804 | function Helix(cfg) {
|
42805 | _classCallCheck(this, Helix);
|
42806 |
|
42807 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
42808 |
|
42809 | _this._init();
|
42810 | return _this;
|
42811 | }
|
42812 |
|
42813 | Helix.prototype._init = function _init() {
|
42814 | var width = this.width;
|
42815 | var height = this.height;
|
42816 | var radius = this.radius;
|
42817 | var innerRadius = this.innerRadius;
|
42818 | var startAngle = this.startAngle;
|
42819 | var endAngle = this.endAngle;
|
42820 |
|
42821 | var index = (endAngle - startAngle) / (2 * Math.PI) + 1;
|
42822 | var maxRadius = Math.min(width, height) / 2;
|
42823 | if (radius && radius >= 0 && radius <= 1) {
|
42824 | maxRadius = maxRadius * radius;
|
42825 | }
|
42826 |
|
42827 | var d = Math.floor(maxRadius * (1 - innerRadius) / index);
|
42828 | var a = d / (Math.PI * 2);
|
42829 |
|
42830 | var x = {
|
42831 | start: startAngle,
|
42832 | end: endAngle
|
42833 | };
|
42834 | var y = {
|
42835 | start: innerRadius * maxRadius,
|
42836 | end: innerRadius * maxRadius + d * 0.99
|
42837 | };
|
42838 |
|
42839 | this.a = a;
|
42840 | this.d = d;
|
42841 | this.x = x;
|
42842 | this.y = y;
|
42843 | };
|
42844 |
|
42845 | Helix.prototype.getCenter = function getCenter() {
|
42846 | return this.center;
|
42847 | };
|
42848 |
|
42849 | |
42850 |
|
42851 |
|
42852 |
|
42853 |
|
42854 |
|
42855 |
|
42856 | Helix.prototype.convertPoint = function convertPoint(point) {
|
42857 | var a = this.a;
|
42858 | var center = this.center;
|
42859 | var x = void 0;
|
42860 | var y = void 0;
|
42861 |
|
42862 | if (this.isTransposed) {
|
42863 | x = point.y;
|
42864 | y = point.x;
|
42865 | } else {
|
42866 | x = point.x;
|
42867 | y = point.y;
|
42868 | }
|
42869 |
|
42870 | var thi = this.convertDim(x, 'x');
|
42871 | var r = a * thi;
|
42872 | var newY = this.convertDim(y, 'y');
|
42873 |
|
42874 | return {
|
42875 | x: center.x + Math.cos(thi) * (r + newY),
|
42876 | y: center.y + Math.sin(thi) * (r + newY)
|
42877 | };
|
42878 | };
|
42879 |
|
42880 | |
42881 |
|
42882 |
|
42883 |
|
42884 |
|
42885 |
|
42886 |
|
42887 | Helix.prototype.invertPoint = function invertPoint(point) {
|
42888 | var center = this.center;
|
42889 | var a = this.a;
|
42890 | var d = this.d + this.y.start;
|
42891 | var v = vec2.subtract([], [point.x, point.y], [center.x, center.y]);
|
42892 | var thi = vec2.angleTo(v, [1, 0], true);
|
42893 | var rMin = thi * a;
|
42894 |
|
42895 | if (vec2.length(v) < rMin) {
|
42896 |
|
42897 | rMin = vec2.length(v);
|
42898 | }
|
42899 |
|
42900 | var index = Math.floor((vec2.length(v) - rMin) / d);
|
42901 | thi = 2 * index * Math.PI + thi;
|
42902 | var r = a * thi;
|
42903 | var newY = vec2.length(v) - r;
|
42904 | newY = Util.snapEqual(newY, 0) ? 0 : newY;
|
42905 |
|
42906 | var x = this.invertDim(thi, 'x');
|
42907 | var y = this.invertDim(newY, 'y');
|
42908 | x = Util.snapEqual(x, 0) ? 0 : x;
|
42909 | y = Util.snapEqual(y, 0) ? 0 : y;
|
42910 |
|
42911 | var rst = {};
|
42912 | rst.x = this.isTransposed ? y : x;
|
42913 | rst.y = this.isTransposed ? x : y;
|
42914 | return rst;
|
42915 | };
|
42916 |
|
42917 | return Helix;
|
42918 | }(Base);
|
42919 |
|
42920 | module.exports = Helix;
|
42921 |
|
42922 | }),
|
42923 |
|
42924 | (function(module, exports, __webpack_require__) {
|
42925 |
|
42926 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
42927 |
|
42928 |
|
42929 |
|
42930 |
|
42931 |
|
42932 | var Util = __webpack_require__(0);
|
42933 |
|
42934 | var _require = __webpack_require__(25),
|
42935 | Axis = _require.Axis;
|
42936 |
|
42937 | var vec2 = __webpack_require__(2).MatrixUtil.vec2;
|
42938 |
|
42939 | var Global = __webpack_require__(1);
|
42940 |
|
42941 | function formatTicks(ticks) {
|
42942 | var tmp = [];
|
42943 | if (ticks.length > 0) {
|
42944 | tmp = ticks.slice(0);
|
42945 | var first = tmp[0];
|
42946 | var last = tmp[tmp.length - 1];
|
42947 | if (first.value !== 0) {
|
42948 | tmp.unshift({
|
42949 | value: 0
|
42950 | });
|
42951 | }
|
42952 | if (last.value !== 1) {
|
42953 | tmp.push({
|
42954 | value: 1
|
42955 | });
|
42956 | }
|
42957 | }
|
42958 | return tmp;
|
42959 | }
|
42960 |
|
42961 | var AxisController = function () {
|
42962 | function AxisController(cfg) {
|
42963 | _classCallCheck(this, AxisController);
|
42964 |
|
42965 | this.visible = true;
|
42966 | this.container = null;
|
42967 | this.coord = null;
|
42968 | this.options = null;
|
42969 | this.axes = [];
|
42970 | Util.mix(this, cfg);
|
42971 | }
|
42972 |
|
42973 | AxisController.prototype._isHide = function _isHide(field) {
|
42974 |
|
42975 | var options = this.options;
|
42976 |
|
42977 | if (options && options[field] === false) {
|
42978 | return true;
|
42979 | }
|
42980 | return false;
|
42981 | };
|
42982 |
|
42983 | AxisController.prototype._getMiddleValue = function _getMiddleValue(curValue, ticks, index) {
|
42984 | var tickCount = ticks.length;
|
42985 | if (index === tickCount - 1) {
|
42986 | return null;
|
42987 | }
|
42988 | var nextValue = ticks[index + 1].value;
|
42989 | return (curValue + nextValue) / 2;
|
42990 | };
|
42991 |
|
42992 | AxisController.prototype._getLineRange = function _getLineRange(coord, scale, dimType, index) {
|
42993 | var start = void 0;
|
42994 | var end = void 0;
|
42995 | var isVertical = void 0;
|
42996 | var field = scale.field;
|
42997 | var options = this.options;
|
42998 | var position = '';
|
42999 | if (options[field] && options[field].position) {
|
43000 | position = options[field].position;
|
43001 | }
|
43002 |
|
43003 | if (dimType === 'x') {
|
43004 |
|
43005 | start = {
|
43006 | x: 0,
|
43007 | y: position === 'top' ? 1 : 0
|
43008 | };
|
43009 | end = {
|
43010 | x: 1,
|
43011 | y: position === 'top' ? 1 : 0
|
43012 | };
|
43013 | isVertical = false;
|
43014 | } else {
|
43015 |
|
43016 | if (index) {
|
43017 |
|
43018 | start = {
|
43019 | x: position === 'left' ? 0 : 1,
|
43020 | y: 0
|
43021 | };
|
43022 | end = {
|
43023 | x: position === 'left' ? 0 : 1,
|
43024 | y: 1
|
43025 | };
|
43026 | } else {
|
43027 |
|
43028 | start = {
|
43029 | x: position === 'right' ? 1 : 0,
|
43030 | y: 0
|
43031 | };
|
43032 | end = {
|
43033 | x: position === 'right' ? 1 : 0,
|
43034 | y: 1
|
43035 | };
|
43036 | }
|
43037 | isVertical = true;
|
43038 | }
|
43039 |
|
43040 | start = coord.convert(start);
|
43041 | end = coord.convert(end);
|
43042 |
|
43043 | return {
|
43044 | start: start,
|
43045 | end: end,
|
43046 | isVertical: isVertical
|
43047 | };
|
43048 | };
|
43049 |
|
43050 | AxisController.prototype._getLineCfg = function _getLineCfg(coord, scale, dimType, index) {
|
43051 | var factor = void 0;
|
43052 | var range = this._getLineRange(coord, scale, dimType, index);
|
43053 | var isVertical = range.isVertical;
|
43054 | var start = range.start;
|
43055 | var end = range.end;
|
43056 | var center = coord.center;
|
43057 |
|
43058 | if (coord.isTransposed) {
|
43059 | isVertical = !isVertical;
|
43060 | }
|
43061 |
|
43062 | if (isVertical && start.x > center.x || !isVertical && start.y > center.y) {
|
43063 | factor = 1;
|
43064 | } else {
|
43065 | factor = -1;
|
43066 | }
|
43067 |
|
43068 | return {
|
43069 | isVertical: isVertical,
|
43070 | factor: factor,
|
43071 | start: start,
|
43072 | end: end
|
43073 | };
|
43074 | };
|
43075 |
|
43076 |
|
43077 |
|
43078 |
|
43079 | AxisController.prototype._getCircleCfg = function _getCircleCfg(coord) {
|
43080 | var circleCfg = {};
|
43081 | var rangeX = coord.x;
|
43082 | var rangeY = coord.y;
|
43083 | var isReflectY = rangeY.start > rangeY.end;
|
43084 | var start = void 0;
|
43085 | if (coord.isTransposed) {
|
43086 | start = {
|
43087 | x: isReflectY ? 0 : 1,
|
43088 | y: 0
|
43089 | };
|
43090 | } else {
|
43091 | start = {
|
43092 | x: 0,
|
43093 | y: isReflectY ? 0 : 1
|
43094 | };
|
43095 | }
|
43096 |
|
43097 | start = coord.convert(start);
|
43098 | var center = coord.circleCentre;
|
43099 | var startVector = [start.x - center.x, start.y - center.y];
|
43100 | var normalVector = [1, 0];
|
43101 | var startAngle = void 0;
|
43102 | if (start.y > center.y) {
|
43103 | startAngle = vec2.angle(startVector, normalVector);
|
43104 | } else {
|
43105 | startAngle = vec2.angle(startVector, normalVector) * -1;
|
43106 | }
|
43107 | var endAngle = startAngle + (rangeX.end - rangeX.start);
|
43108 |
|
43109 | circleCfg.startAngle = startAngle;
|
43110 | circleCfg.endAngle = endAngle;
|
43111 | circleCfg.center = center;
|
43112 | circleCfg.radius = Math.sqrt(Math.pow(start.x - center.x, 2) + Math.pow(start.y - center.y, 2));
|
43113 | circleCfg.inner = coord.innerRadius || 0;
|
43114 | return circleCfg;
|
43115 | };
|
43116 |
|
43117 | AxisController.prototype._getRadiusCfg = function _getRadiusCfg(coord) {
|
43118 | var startAngle = coord.x.start;
|
43119 | var factor = startAngle < 0 ? -1 : 1;
|
43120 | var start = void 0;
|
43121 | var end = void 0;
|
43122 | if (coord.isTransposed) {
|
43123 | start = {
|
43124 | x: 0,
|
43125 | y: 0
|
43126 | };
|
43127 | end = {
|
43128 | x: 1,
|
43129 | y: 0
|
43130 | };
|
43131 | } else {
|
43132 | start = {
|
43133 | x: 0,
|
43134 | y: 0
|
43135 | };
|
43136 | end = {
|
43137 | x: 0,
|
43138 | y: 1
|
43139 | };
|
43140 | }
|
43141 | return {
|
43142 | factor: factor,
|
43143 | start: coord.convert(start),
|
43144 | end: coord.convert(end)
|
43145 | };
|
43146 | };
|
43147 |
|
43148 |
|
43149 |
|
43150 |
|
43151 | AxisController.prototype._getAxisPosition = function _getAxisPosition(coord, dimType, index, field) {
|
43152 | var position = '';
|
43153 |
|
43154 | var options = this.options;
|
43155 | if (options[field] && options[field].position) {
|
43156 | position = options[field].position;
|
43157 | } else {
|
43158 | var coordType = coord.type;
|
43159 | if (coord.isRect) {
|
43160 | if (dimType === 'x') {
|
43161 | position = 'bottom';
|
43162 | } else if (dimType === 'y') {
|
43163 | if (index) {
|
43164 | position = 'right';
|
43165 | } else {
|
43166 | position = 'left';
|
43167 | }
|
43168 | }
|
43169 | } else if (coordType === 'helix') {
|
43170 | position = 'helix';
|
43171 | } else if (dimType === 'x') {
|
43172 | position = coord.isTransposed ? 'radius' : 'circle';
|
43173 | } else {
|
43174 | position = coord.isTransposed ? 'circle' : 'radius';
|
43175 | }
|
43176 | }
|
43177 |
|
43178 | return position;
|
43179 | };
|
43180 |
|
43181 |
|
43182 |
|
43183 |
|
43184 | AxisController.prototype._getAxisDefaultCfg = function _getAxisDefaultCfg(coord, scale, type, position) {
|
43185 | var self = this;
|
43186 | var cfg = {};
|
43187 | var options = self.options;
|
43188 | var field = scale.field;
|
43189 | var isShowTitle = !!(Global.axis[position] && Global.axis[position].title);
|
43190 | var titleCfg = void 0;
|
43191 |
|
43192 |
|
43193 | if (isShowTitle || options[field] && options[field].title) {
|
43194 | titleCfg = {
|
43195 | title: {
|
43196 | text: scale.alias || field
|
43197 | }
|
43198 | };
|
43199 | }
|
43200 | cfg = Util.deepMix({}, Global.axis[position], cfg, options[field]);
|
43201 | Util.mix(cfg, titleCfg);
|
43202 | cfg.ticks = scale.getTicks();
|
43203 |
|
43204 | if (coord.isPolar && !scale.isCategory) {
|
43205 | if (type === 'x' && Math.abs(coord.endAngle - coord.startAngle) === Math.PI * 2) {
|
43206 | cfg.ticks.pop();
|
43207 | }
|
43208 | }
|
43209 |
|
43210 | cfg.coord = coord;
|
43211 | if (cfg.label && Util.isNil(cfg.label.autoRotate)) {
|
43212 | cfg.label.autoRotate = true;
|
43213 | }
|
43214 | return cfg;
|
43215 | };
|
43216 |
|
43217 |
|
43218 |
|
43219 |
|
43220 | AxisController.prototype._getAxisCfg = function _getAxisCfg(coord, scale, verticalScale, dimType) {
|
43221 | var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
|
43222 | var viewId = arguments[5];
|
43223 |
|
43224 | var self = this;
|
43225 | var position = self._getAxisPosition(coord, dimType, index, scale.field);
|
43226 | var cfg = self._getAxisDefaultCfg(coord, scale, dimType, position);
|
43227 | if (!Util.isEmpty(cfg.grid) && verticalScale) {
|
43228 |
|
43229 | var gridPoints = [];
|
43230 | var verticalTicks = formatTicks(verticalScale.getTicks());
|
43231 |
|
43232 | if (verticalTicks.length) {
|
43233 | var ticks = cfg.ticks;
|
43234 | Util.each(ticks, function (tick, idx) {
|
43235 | var subPoints = [];
|
43236 | var value = tick.value;
|
43237 | if (cfg.grid.align === 'center') {
|
43238 | value = self._getMiddleValue(value, ticks, idx);
|
43239 | }
|
43240 | if (!Util.isNil(value)) {
|
43241 | var rangeX = coord.x;
|
43242 | var rangeY = coord.y;
|
43243 | Util.each(verticalTicks, function (verticalTick) {
|
43244 | var x = dimType === 'x' ? value : verticalTick.value;
|
43245 | var y = dimType === 'x' ? verticalTick.value : value;
|
43246 | var point = coord.convert({
|
43247 | x: x,
|
43248 | y: y
|
43249 | });
|
43250 | if (coord.isPolar) {
|
43251 | var center = coord.circleCentre;
|
43252 | if (rangeY.start > rangeY.end) {
|
43253 | y = 1 - y;
|
43254 | }
|
43255 | point.flag = rangeX.start > rangeX.end ? 0 : 1;
|
43256 | point.radius = Math.sqrt(Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2));
|
43257 | }
|
43258 | subPoints.push(point);
|
43259 | });
|
43260 | gridPoints.push({
|
43261 | _id: viewId + '-' + dimType + index + '-grid-' + tick.tickValue,
|
43262 | points: subPoints
|
43263 | });
|
43264 | }
|
43265 | });
|
43266 |
|
43267 |
|
43268 | if (ticks.length % 2 === 0 && cfg.grid.align === 'center' && cfg.grid.alternateColor) {
|
43269 | gridPoints.push({
|
43270 | points: [{ x: coord.end.x, y: coord.start.y }, { x: coord.end.x, y: coord.end.y }]
|
43271 | });
|
43272 | }
|
43273 | }
|
43274 | cfg.grid.items = gridPoints;
|
43275 | }
|
43276 | return cfg;
|
43277 | };
|
43278 |
|
43279 | AxisController.prototype._getHelixCfg = function _getHelixCfg(coord) {
|
43280 | var helixCfg = {};
|
43281 | var a = coord.a;
|
43282 | var startAngle = coord.startAngle;
|
43283 | var endAngle = coord.endAngle;
|
43284 | var index = 100;
|
43285 | var crp = [];
|
43286 | for (var i = 0; i <= index; i++) {
|
43287 | var point = coord.convert({
|
43288 | x: i / 100,
|
43289 | y: 0
|
43290 | });
|
43291 | crp.push(point.x);
|
43292 | crp.push(point.y);
|
43293 | }
|
43294 | var axisStart = coord.convert({
|
43295 | x: 0,
|
43296 | y: 0
|
43297 | });
|
43298 | helixCfg.a = a;
|
43299 | helixCfg.startAngle = startAngle;
|
43300 | helixCfg.endAngle = endAngle;
|
43301 | helixCfg.crp = crp;
|
43302 | helixCfg.axisStart = axisStart;
|
43303 | helixCfg.center = coord.center;
|
43304 | helixCfg.inner = coord.y.start;
|
43305 | return helixCfg;
|
43306 | };
|
43307 |
|
43308 | AxisController.prototype._drawAxis = function _drawAxis(coord, scale, verticalScale, dimType, viewId, xAxis, index) {
|
43309 | var container = this.container;
|
43310 | var C = void 0;
|
43311 | var appendCfg = void 0;
|
43312 |
|
43313 | if (coord.type === 'cartesian') {
|
43314 | C = Axis.Line;
|
43315 | appendCfg = this._getLineCfg(coord, scale, dimType, index);
|
43316 | } else if (coord.type === 'helix' && dimType === 'x') {
|
43317 | C = Axis.Helix;
|
43318 | appendCfg = this._getHelixCfg(coord);
|
43319 | } else if (dimType === 'x') {
|
43320 | C = Axis.Circle;
|
43321 | appendCfg = this._getCircleCfg(coord);
|
43322 | } else {
|
43323 | C = Axis.Line;
|
43324 | appendCfg = this._getRadiusCfg(coord);
|
43325 | }
|
43326 | var cfg = this._getAxisCfg(coord, scale, verticalScale, dimType, index, viewId);
|
43327 | cfg = Util.mix({}, cfg, appendCfg);
|
43328 |
|
43329 | if (dimType === 'y' && xAxis && xAxis.get('type') === 'circle') {
|
43330 | cfg.circle = xAxis;
|
43331 | }
|
43332 | cfg._id = viewId + '-' + dimType;
|
43333 | if (!Util.isNil(index)) {
|
43334 | cfg._id = viewId + '-' + dimType + index;
|
43335 | }
|
43336 |
|
43337 | var axis = container.addGroup(C, cfg);
|
43338 | this.axes.push(axis);
|
43339 | return axis;
|
43340 | };
|
43341 |
|
43342 | AxisController.prototype.createAxis = function createAxis(xScale, yScales, viewId) {
|
43343 | var self = this;
|
43344 | var coord = this.coord;
|
43345 | var coordType = coord.type;
|
43346 |
|
43347 |
|
43348 | if (coordType !== 'theta' && !(coordType === 'polar' && coord.isTransposed)) {
|
43349 | var xAxis = void 0;
|
43350 | if (xScale && !self._isHide(xScale.field)) {
|
43351 | xAxis = self._drawAxis(coord, xScale, yScales[0], 'x', viewId);
|
43352 | }
|
43353 | if (!Util.isEmpty(yScales) && coordType !== 'helix') {
|
43354 | Util.each(yScales, function (yScale, index) {
|
43355 | if (!self._isHide(yScale.field)) {
|
43356 | self._drawAxis(coord, yScale, xScale, 'y', viewId, xAxis, index);
|
43357 | }
|
43358 | });
|
43359 | }
|
43360 | }
|
43361 | };
|
43362 |
|
43363 | AxisController.prototype.changeVisible = function changeVisible(visible) {
|
43364 | var axes = this.axes;
|
43365 | Util.each(axes, function (axis) {
|
43366 | axis.set('visible', visible);
|
43367 | });
|
43368 | };
|
43369 |
|
43370 | AxisController.prototype.clear = function clear() {
|
43371 | var axes = this.axes;
|
43372 | Util.each(axes, function (axis) {
|
43373 | axis.remove();
|
43374 | });
|
43375 | this.axes = [];
|
43376 | };
|
43377 |
|
43378 | return AxisController;
|
43379 | }();
|
43380 |
|
43381 | module.exports = AxisController;
|
43382 |
|
43383 | }),
|
43384 |
|
43385 | (function(module, exports, __webpack_require__) {
|
43386 |
|
43387 |
|
43388 |
|
43389 |
|
43390 |
|
43391 | module.exports = {
|
43392 | Line: __webpack_require__(336),
|
43393 | Circle: __webpack_require__(338),
|
43394 | Helix: __webpack_require__(339),
|
43395 | PolyLine: __webpack_require__(340)
|
43396 | };
|
43397 |
|
43398 | }),
|
43399 |
|
43400 | (function(module, exports, __webpack_require__) {
|
43401 |
|
43402 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
43403 |
|
43404 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
43405 |
|
43406 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
43407 |
|
43408 |
|
43409 |
|
43410 |
|
43411 |
|
43412 | var Base = __webpack_require__(44);
|
43413 | var Util = __webpack_require__(0);
|
43414 |
|
43415 | var _require = __webpack_require__(2),
|
43416 | MatrixUtil = _require.MatrixUtil;
|
43417 |
|
43418 | var vec2 = MatrixUtil.vec2;
|
43419 |
|
43420 | var Line = function (_Base) {
|
43421 | _inherits(Line, _Base);
|
43422 |
|
43423 | function Line() {
|
43424 | _classCallCheck(this, Line);
|
43425 |
|
43426 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
43427 | }
|
43428 |
|
43429 | Line.prototype.getDefaultCfg = function getDefaultCfg() {
|
43430 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
43431 | return Util.mix({}, cfg, {
|
43432 | x: null,
|
43433 | y: null,
|
43434 | line: {
|
43435 | lineWidth: 1,
|
43436 | stroke: '#C0D0E0'
|
43437 | },
|
43438 | tickLine: {
|
43439 | lineWidth: 1,
|
43440 | stroke: '#C0D0E0',
|
43441 | length: 5
|
43442 | },
|
43443 | isVertical: false,
|
43444 | start: null,
|
43445 | end: null
|
43446 | });
|
43447 | };
|
43448 |
|
43449 | Line.prototype._getAvgLabelLength = function _getAvgLabelLength(labelsGroup) {
|
43450 | var labels = labelsGroup.get('children');
|
43451 | return labels[1].attr('x') - labels[0].attr('x');
|
43452 | };
|
43453 |
|
43454 | |
43455 |
|
43456 |
|
43457 |
|
43458 |
|
43459 |
|
43460 |
|
43461 |
|
43462 | Line.prototype.getSideVector = function getSideVector(offset) {
|
43463 | var self = this;
|
43464 | var factor = self.get('factor');
|
43465 | var isVertical = self.get('isVertical');
|
43466 | var start = self.get('start');
|
43467 | var end = self.get('end');
|
43468 | var axisVector = self.getAxisVector();
|
43469 | var normal = vec2.normalize([], axisVector);
|
43470 | var direction = false;
|
43471 | if (isVertical && start.y < end.y || !isVertical && start.x > end.x) {
|
43472 | direction = true;
|
43473 | }
|
43474 | var verticalVector = vec2.vertical([], normal, direction);
|
43475 | return vec2.scale([], verticalVector, offset * factor);
|
43476 | };
|
43477 |
|
43478 | Line.prototype.getAxisVector = function getAxisVector() {
|
43479 | var start = this.get('start');
|
43480 | var end = this.get('end');
|
43481 | return [end.x - start.x, end.y - start.y];
|
43482 | };
|
43483 |
|
43484 | Line.prototype.getLinePath = function getLinePath() {
|
43485 | var self = this;
|
43486 | var start = self.get('start');
|
43487 | var end = self.get('end');
|
43488 | var path = [];
|
43489 | path.push(['M', start.x, start.y]);
|
43490 | path.push(['L', end.x, end.y]);
|
43491 | return path;
|
43492 | };
|
43493 |
|
43494 | Line.prototype.getTickEnd = function getTickEnd(start, value) {
|
43495 | var self = this;
|
43496 | var offsetVector = self.getSideVector(value);
|
43497 | return {
|
43498 | x: start.x + offsetVector[0],
|
43499 | y: start.y + offsetVector[1]
|
43500 | };
|
43501 | };
|
43502 |
|
43503 | Line.prototype.getTickPoint = function getTickPoint(tickValue) {
|
43504 | var self = this;
|
43505 | var start = self.get('start');
|
43506 | var end = self.get('end');
|
43507 | var rangeX = end.x - start.x;
|
43508 | var rangeY = end.y - start.y;
|
43509 | return {
|
43510 | x: start.x + rangeX * tickValue,
|
43511 | y: start.y + rangeY * tickValue
|
43512 | };
|
43513 | };
|
43514 |
|
43515 | Line.prototype.renderTitle = function renderTitle() {
|
43516 | var self = this;
|
43517 | var title = self.get('title');
|
43518 | var offsetPoint = self.getTickPoint(0.5);
|
43519 | var titleOffset = title.offset;
|
43520 | if (!titleOffset) {
|
43521 |
|
43522 | titleOffset = 20;
|
43523 | var labelsGroup = self.get('labelsGroup');
|
43524 | if (labelsGroup) {
|
43525 | var labelLength = self.getMaxLabelWidth(labelsGroup);
|
43526 | var labelOffset = self.get('label').offset || self.get('_labelOffset');
|
43527 | titleOffset += labelLength + labelOffset;
|
43528 | }
|
43529 | }
|
43530 |
|
43531 | var textStyle = title.textStyle;
|
43532 | var cfg = Util.mix({}, textStyle);
|
43533 | if (title.text) {
|
43534 | var vector = self.getAxisVector();
|
43535 |
|
43536 | if (title.autoRotate && !textStyle.rotate) {
|
43537 |
|
43538 | var angle = 0;
|
43539 | if (!Util.snapEqual(vector[1], 0)) {
|
43540 |
|
43541 | var v1 = [1, 0];
|
43542 | var v2 = [vector[0], vector[1]];
|
43543 | angle = vec2.angleTo(v2, v1, true);
|
43544 | }
|
43545 |
|
43546 | cfg.rotate = angle * (180 / Math.PI);
|
43547 | } else if (textStyle.rotate) {
|
43548 |
|
43549 | cfg.rotate = textStyle.rotate / 180 * Math.PI;
|
43550 | }
|
43551 |
|
43552 | var sideVector = self.getSideVector(titleOffset);
|
43553 | var point = void 0;
|
43554 | var position = title.position;
|
43555 | if (position === 'start') {
|
43556 | point = {
|
43557 | x: this.get('start').x + sideVector[0],
|
43558 | y: this.get('start').y + sideVector[1]
|
43559 | };
|
43560 | } else if (position === 'end') {
|
43561 | point = {
|
43562 | x: this.get('end').x + sideVector[0],
|
43563 | y: this.get('end').y + sideVector[1]
|
43564 | };
|
43565 | } else {
|
43566 | point = {
|
43567 | x: offsetPoint.x + sideVector[0],
|
43568 | y: offsetPoint.y + sideVector[1]
|
43569 | };
|
43570 | }
|
43571 |
|
43572 | cfg.x = point.x;
|
43573 | cfg.y = point.y;
|
43574 | cfg.text = title.text;
|
43575 |
|
43576 | var titleShape = self.addShape('Text', {
|
43577 | zIndex: 2,
|
43578 | attrs: cfg
|
43579 | });
|
43580 | titleShape.name = 'axis-title';
|
43581 | self.get('appendInfo') && titleShape.setSilent('appendInfo', self.get('appendInfo'));
|
43582 | }
|
43583 | };
|
43584 |
|
43585 | Line.prototype.autoRotateLabels = function autoRotateLabels() {
|
43586 | var self = this;
|
43587 | var labelsGroup = self.get('labelsGroup');
|
43588 | var title = self.get('title');
|
43589 | if (labelsGroup) {
|
43590 | var offset = self.get('label').offset;
|
43591 | var append = 12;
|
43592 | var titleOffset = title ? title.offset : 48;
|
43593 | if (titleOffset < 0) {
|
43594 |
|
43595 | return;
|
43596 | }
|
43597 | var vector = self.getAxisVector();
|
43598 | var angle = void 0;
|
43599 | var maxWidth = void 0;
|
43600 | if (Util.snapEqual(vector[0], 0) && title && title.text) {
|
43601 |
|
43602 | maxWidth = self.getMaxLabelWidth(labelsGroup);
|
43603 | if (maxWidth > titleOffset - offset - append) {
|
43604 | angle = Math.acos((titleOffset - offset - append) / maxWidth) * -1;
|
43605 | }
|
43606 | } else if (Util.snapEqual(vector[1], 0) && labelsGroup.getCount() > 1) {
|
43607 |
|
43608 | var avgWidth = Math.abs(self._getAvgLabelLength(labelsGroup));
|
43609 | maxWidth = self.getMaxLabelWidth(labelsGroup);
|
43610 | if (maxWidth > avgWidth) {
|
43611 | angle = Math.asin((titleOffset - offset - append) * 1.25 / maxWidth);
|
43612 | }
|
43613 | }
|
43614 |
|
43615 | if (angle) {
|
43616 | var factor = self.get('factor');
|
43617 | Util.each(labelsGroup.get('children'), function (label) {
|
43618 | label.rotateAtStart(angle);
|
43619 | if (Util.snapEqual(vector[1], 0)) {
|
43620 | if (factor > 0) {
|
43621 | label.attr('textAlign', 'left');
|
43622 | } else {
|
43623 | label.attr('textAlign', 'right');
|
43624 | }
|
43625 | }
|
43626 | });
|
43627 | }
|
43628 | }
|
43629 | };
|
43630 |
|
43631 | return Line;
|
43632 | }(Base);
|
43633 |
|
43634 | module.exports = Line;
|
43635 |
|
43636 | }),
|
43637 |
|
43638 | (function(module, exports, __webpack_require__) {
|
43639 |
|
43640 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
43641 |
|
43642 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
43643 |
|
43644 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
43645 |
|
43646 |
|
43647 |
|
43648 |
|
43649 |
|
43650 | var _require = __webpack_require__(2),
|
43651 | Group = _require.Group;
|
43652 |
|
43653 | var Util = __webpack_require__(0);
|
43654 |
|
43655 | var Grid = function (_Group) {
|
43656 | _inherits(Grid, _Group);
|
43657 |
|
43658 | function Grid() {
|
43659 | _classCallCheck(this, Grid);
|
43660 |
|
43661 | return _possibleConstructorReturn(this, _Group.apply(this, arguments));
|
43662 | }
|
43663 |
|
43664 | Grid.prototype.getDefaultCfg = function getDefaultCfg() {
|
43665 | return {
|
43666 | zIndex: 1,
|
43667 | |
43668 |
|
43669 |
|
43670 |
|
43671 |
|
43672 |
|
43673 | type: 'line',
|
43674 | |
43675 |
|
43676 |
|
43677 |
|
43678 | lineStyle: null,
|
43679 | |
43680 |
|
43681 |
|
43682 |
|
43683 | items: null,
|
43684 | |
43685 |
|
43686 |
|
43687 |
|
43688 | alternateColor: null,
|
43689 | matrix: null,
|
43690 | |
43691 |
|
43692 |
|
43693 |
|
43694 | hideFirstLine: false,
|
43695 | |
43696 |
|
43697 |
|
43698 |
|
43699 | hideLastLine: false
|
43700 | };
|
43701 | };
|
43702 |
|
43703 | Grid.prototype._renderUI = function _renderUI() {
|
43704 | _Group.prototype._renderUI.call(this);
|
43705 | this._drawLines();
|
43706 | };
|
43707 |
|
43708 | Grid.prototype._drawLines = function _drawLines() {
|
43709 | var self = this;
|
43710 | var lineStyle = self.get('lineStyle');
|
43711 | var items = self.get('items');
|
43712 | if (items && items.length) {
|
43713 | self._precessItems(items);
|
43714 | self._drawGridLines(items, lineStyle);
|
43715 | }
|
43716 | };
|
43717 |
|
43718 | Grid.prototype._precessItems = function _precessItems(items) {
|
43719 | var self = this;
|
43720 | var preItem = void 0;
|
43721 | Util.each(items, function (item, index) {
|
43722 | if (preItem && self.get('alternateColor')) {
|
43723 | self._drawAlternativeBg(item, preItem, index);
|
43724 | }
|
43725 |
|
43726 | preItem = item;
|
43727 | });
|
43728 | };
|
43729 |
|
43730 | Grid.prototype._drawGridLines = function _drawGridLines(items, lineStyle) {
|
43731 | var self = this;
|
43732 | var type = this.get('type');
|
43733 | var gridLine = void 0;
|
43734 | var path = void 0;
|
43735 | var cfg = void 0;
|
43736 | var points = void 0;
|
43737 | var itemsLength = items.length;
|
43738 |
|
43739 | if (type === 'line' || type === 'polygon') {
|
43740 | Util.each(items, function (item, idx) {
|
43741 | if (self.get('hideFirstLine') && idx === 0) {
|
43742 |
|
43743 | return;
|
43744 | }
|
43745 | if (self.get('hideLastLine') && idx === itemsLength - 1) {
|
43746 |
|
43747 | return;
|
43748 | }
|
43749 |
|
43750 | points = item.points;
|
43751 | path = [];
|
43752 | if (type === 'line') {
|
43753 | path.push(['M', points[0].x, points[0].y]);
|
43754 | path.push(['L', points[points.length - 1].x, points[points.length - 1].y]);
|
43755 | } else {
|
43756 | Util.each(points, function (point, index) {
|
43757 | if (index === 0) {
|
43758 | path.push(['M', point.x, point.y]);
|
43759 | } else {
|
43760 | path.push(['L', point.x, point.y]);
|
43761 | }
|
43762 | });
|
43763 | }
|
43764 |
|
43765 | cfg = Util.mix({}, lineStyle, {
|
43766 | path: path
|
43767 | });
|
43768 | gridLine = self.addShape('path', {
|
43769 | attrs: cfg
|
43770 | });
|
43771 | gridLine.name = 'axis-grid';
|
43772 | gridLine._id = item._id;
|
43773 | gridLine.set('coord', self.get('coord'));
|
43774 | self.get('appendInfo') && gridLine.setSilent('appendInfo', self.get('appendInfo'));
|
43775 | });
|
43776 | } else {
|
43777 | Util.each(items, function (item, idx) {
|
43778 | if (self.get('hideFirstLine') && idx === 0) {
|
43779 |
|
43780 | return;
|
43781 | }
|
43782 | if (self.get('hideLastLine') && idx === itemsLength - 1) {
|
43783 |
|
43784 | return;
|
43785 | }
|
43786 |
|
43787 | points = item.points;
|
43788 | path = [];
|
43789 | Util.each(points, function (point, index) {
|
43790 | var radius = point.radius;
|
43791 | if (index === 0) {
|
43792 | path.push(['M', point.x, point.y]);
|
43793 | } else {
|
43794 | path.push(['A', radius, radius, 0, 0, point.flag, point.x, point.y]);
|
43795 | }
|
43796 | });
|
43797 | cfg = Util.mix({}, lineStyle, {
|
43798 | path: path
|
43799 | });
|
43800 | gridLine = self.addShape('path', {
|
43801 | attrs: cfg
|
43802 | });
|
43803 | gridLine.name = 'axis-grid';
|
43804 | gridLine._id = item._id;
|
43805 | gridLine.set('coord', self.get('coord'));
|
43806 | self.get('appendInfo') && gridLine.setSilent('appendInfo', self.get('appendInfo'));
|
43807 | });
|
43808 | }
|
43809 | };
|
43810 |
|
43811 | Grid.prototype._drawAlternativeBg = function _drawAlternativeBg(item, preItem, index) {
|
43812 | var self = this;
|
43813 | var alternateColor = self.get('alternateColor');
|
43814 | var attrs = void 0;
|
43815 | var oddColor = void 0;
|
43816 | var evenColor = void 0;
|
43817 |
|
43818 | if (Util.isString(alternateColor)) {
|
43819 | oddColor = alternateColor;
|
43820 | } else if (Util.isArray(alternateColor)) {
|
43821 | oddColor = alternateColor[0];
|
43822 | evenColor = alternateColor[1];
|
43823 | }
|
43824 |
|
43825 | if (index % 2 === 0) {
|
43826 | if (evenColor) {
|
43827 | attrs = self._getBackItem(preItem.points, item.points, evenColor);
|
43828 | }
|
43829 | } else if (oddColor) {
|
43830 | attrs = self._getBackItem(preItem.points, item.points, oddColor);
|
43831 | }
|
43832 |
|
43833 | var shape = self.addShape('Path', {
|
43834 | attrs: attrs
|
43835 | });
|
43836 | shape.name = 'axis-grid-rect';
|
43837 | shape._id = item._id && item._id.replace('grid', 'grid-rect');
|
43838 | shape.set('coord', self.get('coord'));
|
43839 | self.get('appendInfo') && shape.setSilent('appendInfo', self.get('appendInfo'));
|
43840 | };
|
43841 |
|
43842 | Grid.prototype._getBackItem = function _getBackItem(start, end, bgColor) {
|
43843 | var path = [];
|
43844 | var type = this.get('type');
|
43845 |
|
43846 | if (type === 'line') {
|
43847 | path.push(['M', start[0].x, start[0].y]);
|
43848 | path.push(['L', start[start.length - 1].x, start[start.length - 1].y]);
|
43849 | path.push(['L', end[end.length - 1].x, end[end.length - 1].y]);
|
43850 | path.push(['L', end[0].x, end[0].y]);
|
43851 | path.push(['Z']);
|
43852 | } else if (type === 'polygon') {
|
43853 | Util.each(start, function (subItem, index) {
|
43854 | if (index === 0) {
|
43855 | path.push(['M', subItem.x, subItem.y]);
|
43856 | } else {
|
43857 | path.push(['L', subItem.x, subItem.y]);
|
43858 | }
|
43859 | });
|
43860 | for (var i = end.length - 1; i >= 0; i--) {
|
43861 | path.push(['L', end[i].x, end[i].y]);
|
43862 | }
|
43863 | path.push(['Z']);
|
43864 | } else {
|
43865 | var flag = start[0].flag;
|
43866 | Util.each(start, function (subItem, index) {
|
43867 | var radius = subItem.radius;
|
43868 | if (index === 0) {
|
43869 | path.push(['M', subItem.x, subItem.y]);
|
43870 | } else {
|
43871 | path.push(['A', radius, radius, 0, 0, subItem.flag, subItem.x, subItem.y]);
|
43872 | }
|
43873 | });
|
43874 | for (var j = end.length - 1; j >= 0; j--) {
|
43875 | var endSubItem = end[j];
|
43876 | var endRadius = endSubItem.radius;
|
43877 | if (j === end.length - 1) {
|
43878 | path.push(['M', endSubItem.x, endSubItem.y]);
|
43879 | } else {
|
43880 | path.push(['A', endRadius, endRadius, 0, 0, flag === 1 ? 0 : 1, endSubItem.x, endSubItem.y]);
|
43881 | }
|
43882 | }
|
43883 | }
|
43884 |
|
43885 | return {
|
43886 | fill: bgColor,
|
43887 | path: path
|
43888 | };
|
43889 | };
|
43890 |
|
43891 | return Grid;
|
43892 | }(Group);
|
43893 |
|
43894 | module.exports = Grid;
|
43895 |
|
43896 | }),
|
43897 |
|
43898 | (function(module, exports, __webpack_require__) {
|
43899 |
|
43900 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
43901 |
|
43902 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
43903 |
|
43904 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
43905 |
|
43906 |
|
43907 |
|
43908 |
|
43909 |
|
43910 | var Util = __webpack_require__(0);
|
43911 | var Base = __webpack_require__(44);
|
43912 |
|
43913 | var vec2 = __webpack_require__(2).MatrixUtil.vec2;
|
43914 |
|
43915 | var Circle = function (_Base) {
|
43916 | _inherits(Circle, _Base);
|
43917 |
|
43918 | function Circle() {
|
43919 | _classCallCheck(this, Circle);
|
43920 |
|
43921 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
43922 | }
|
43923 |
|
43924 | Circle.prototype.getDefaultCfg = function getDefaultCfg() {
|
43925 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
43926 |
|
43927 | return Util.mix({}, cfg, {
|
43928 | |
43929 |
|
43930 |
|
43931 |
|
43932 | type: 'circle',
|
43933 | |
43934 |
|
43935 |
|
43936 |
|
43937 | tickInterval: null,
|
43938 | |
43939 |
|
43940 |
|
43941 |
|
43942 | startAngle: -Math.PI / 2,
|
43943 | |
43944 |
|
43945 |
|
43946 |
|
43947 | endAngle: Math.PI * 3 / 2,
|
43948 | line: {
|
43949 | lineWidth: 1,
|
43950 | stroke: '#C0D0E0'
|
43951 | },
|
43952 | tickLine: {
|
43953 | lineWidth: 1,
|
43954 | stroke: '#C0D0E0',
|
43955 | length: 5
|
43956 | },
|
43957 | |
43958 |
|
43959 |
|
43960 |
|
43961 | _labelOffset: 5
|
43962 | });
|
43963 | };
|
43964 |
|
43965 | Circle.prototype.parseTick = function parseTick(tick, index, length) {
|
43966 | return {
|
43967 | text: tick,
|
43968 | value: index / length
|
43969 | };
|
43970 | };
|
43971 |
|
43972 | Circle.prototype._getCirclePoint = function _getCirclePoint(angle, radius) {
|
43973 | var self = this;
|
43974 | var center = self.get('center');
|
43975 | radius = radius || self.get('radius');
|
43976 | return {
|
43977 | x: center.x + Math.cos(angle) * radius,
|
43978 | y: center.y + Math.sin(angle) * radius
|
43979 | };
|
43980 | };
|
43981 |
|
43982 | Circle.prototype.getTickPoint = function getTickPoint(value) {
|
43983 | var self = this;
|
43984 | var startAngle = self.get('startAngle');
|
43985 | var endAngle = self.get('endAngle');
|
43986 | var angle = startAngle + (endAngle - startAngle) * value;
|
43987 | return self._getCirclePoint(angle);
|
43988 | };
|
43989 |
|
43990 | Circle.prototype.getSideVector = function getSideVector(offset, point) {
|
43991 | var self = this;
|
43992 | var center = self.get('center');
|
43993 | var vector = [point.x - center.x, point.y - center.y];
|
43994 | if (!Util.isNil(offset)) {
|
43995 | var vecLen = vec2.length(vector);
|
43996 | vec2.scale(vector, vector, offset / vecLen);
|
43997 | }
|
43998 | return vector;
|
43999 | };
|
44000 |
|
44001 | Circle.prototype.getSidePoint = function getSidePoint(point, offset) {
|
44002 | var self = this;
|
44003 | var vector = self.getSideVector(offset, point);
|
44004 |
|
44005 | return {
|
44006 | x: point.x + vector[0],
|
44007 | y: point.y + vector[1]
|
44008 | };
|
44009 | };
|
44010 |
|
44011 | Circle.prototype.getTickEnd = function getTickEnd(start, length) {
|
44012 | var self = this;
|
44013 | var tickLine = self.get('tickLine');
|
44014 | length = length ? length : tickLine.length;
|
44015 | return self.getSidePoint(start, length);
|
44016 | };
|
44017 |
|
44018 | Circle.prototype.getTextAnchor = function getTextAnchor(vector) {
|
44019 | var align = void 0;
|
44020 | if (Util.snapEqual(vector[0], 0)) {
|
44021 | align = 'center';
|
44022 | } else if (vector[0] > 0) {
|
44023 | align = 'left';
|
44024 | } else if (vector[0] < 0) {
|
44025 | align = 'right';
|
44026 | }
|
44027 | return align;
|
44028 | };
|
44029 |
|
44030 | Circle.prototype.getLinePath = function getLinePath() {
|
44031 | var self = this;
|
44032 | var center = self.get('center');
|
44033 | var x = center.x;
|
44034 | var y = center.y;
|
44035 | var rx = self.get('radius');
|
44036 | var ry = rx;
|
44037 | var startAngle = self.get('startAngle');
|
44038 | var endAngle = self.get('endAngle');
|
44039 | var inner = self.get('inner');
|
44040 |
|
44041 | var path = [];
|
44042 | if (Math.abs(endAngle - startAngle) === Math.PI * 2) {
|
44043 | path = [['M', x, y], ['m', 0, -ry], ['a', rx, ry, 0, 1, 1, 0, 2 * ry], ['a', rx, ry, 0, 1, 1, 0, -2 * ry], ['z']];
|
44044 | } else {
|
44045 | var startPoint = self._getCirclePoint(startAngle);
|
44046 | var endPoint = self._getCirclePoint(endAngle);
|
44047 | var large = Math.abs(endAngle - startAngle) > Math.PI ? 1 : 0;
|
44048 | var sweep = startAngle > endAngle ? 0 : 1;
|
44049 | if (!inner) {
|
44050 | path = [['M', x, y], ['L', startPoint.x, startPoint.y], ['A', rx, ry, 0, large, sweep, endPoint.x, endPoint.y], ['L', x, y]];
|
44051 | } else {
|
44052 | var innerStartVector = self.getSideVector(inner * rx, startPoint);
|
44053 | var innerEndVector = self.getSideVector(inner * rx, endPoint);
|
44054 | var innerStartPoint = {
|
44055 | x: innerStartVector[0] + x,
|
44056 | y: innerStartVector[1] + y
|
44057 | };
|
44058 | var innerEndPoint = {
|
44059 | x: innerEndVector[0] + x,
|
44060 | y: innerEndVector[1] + y
|
44061 | };
|
44062 |
|
44063 | path = [['M', innerStartPoint.x, innerStartPoint.y], ['L', startPoint.x, startPoint.y], ['A', rx, ry, 0, large, sweep, endPoint.x, endPoint.y], ['L', innerEndPoint.x, innerEndPoint.y], ['A', rx * inner, ry * inner, 0, large, Math.abs(sweep - 1), innerStartPoint.x, innerStartPoint.y]];
|
44064 | }
|
44065 | }
|
44066 | return path;
|
44067 | };
|
44068 |
|
44069 | Circle.prototype.addLabel = function addLabel(tick, point, index) {
|
44070 | var self = this;
|
44071 | var offset = self.get('label').offset || self.get('_labelOffset') || 0.001;
|
44072 | point = self.getSidePoint(point, offset);
|
44073 | _Base.prototype.addLabel.call(this, tick, point, index);
|
44074 | };
|
44075 |
|
44076 | Circle.prototype.autoRotateLabels = function autoRotateLabels() {
|
44077 | var self = this;
|
44078 | var ticks = self.get('ticks');
|
44079 | var labelsGroup = self.get('labelsGroup');
|
44080 | if (labelsGroup && ticks.length > 12) {
|
44081 |
|
44082 | var radius = self.get('radius');
|
44083 | var startAngle = self.get('startAngle');
|
44084 | var endAngle = self.get('endAngle');
|
44085 | var totalAngle = endAngle - startAngle;
|
44086 | var avgAngle = totalAngle / (ticks.length - 1);
|
44087 | var avgWidth = Math.sin(avgAngle / 2) * radius * 2;
|
44088 | var maxLength = self.getMaxLabelWidth(labelsGroup);
|
44089 | Util.each(labelsGroup.get('children'), function (label, index) {
|
44090 | var tick = ticks[index];
|
44091 | var angle = tick.value * totalAngle + startAngle;
|
44092 | var mode = angle % (Math.PI * 2);
|
44093 | if (maxLength < avgWidth) {
|
44094 |
|
44095 | if (mode <= 0) {
|
44096 | angle = angle + Math.PI;
|
44097 | }
|
44098 | if (mode > Math.PI) {
|
44099 | angle = angle - Math.PI;
|
44100 | }
|
44101 | angle = angle - Math.PI / 2;
|
44102 | label.attr('textAlign', 'center');
|
44103 | } else {
|
44104 | if (mode > Math.PI / 2) {
|
44105 | angle = angle - Math.PI;
|
44106 | } else if (mode < Math.PI / 2 * -1) {
|
44107 | angle = angle + Math.PI;
|
44108 | }
|
44109 | }
|
44110 | label.rotateAtStart(angle);
|
44111 | });
|
44112 | }
|
44113 | };
|
44114 |
|
44115 | return Circle;
|
44116 | }(Base);
|
44117 |
|
44118 | module.exports = Circle;
|
44119 |
|
44120 | }),
|
44121 |
|
44122 | (function(module, exports, __webpack_require__) {
|
44123 |
|
44124 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
44125 |
|
44126 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
44127 |
|
44128 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
44129 |
|
44130 |
|
44131 |
|
44132 |
|
44133 |
|
44134 | var Util = __webpack_require__(0);
|
44135 | var Base = __webpack_require__(44);
|
44136 |
|
44137 | var _require = __webpack_require__(2),
|
44138 | MatrixUtil = _require.MatrixUtil,
|
44139 | PathUtil = _require.PathUtil;
|
44140 |
|
44141 | var vec2 = MatrixUtil.vec2;
|
44142 |
|
44143 | var Helix = function (_Base) {
|
44144 | _inherits(Helix, _Base);
|
44145 |
|
44146 | function Helix() {
|
44147 | _classCallCheck(this, Helix);
|
44148 |
|
44149 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
44150 | }
|
44151 |
|
44152 | Helix.prototype.getDefaultCfg = function getDefaultCfg() {
|
44153 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
44154 |
|
44155 | return Util.mix({}, cfg, {
|
44156 | type: 'helix',
|
44157 | line: {
|
44158 | lineWidth: 1,
|
44159 | stroke: '#C0D0E0'
|
44160 | },
|
44161 | tickLine: {
|
44162 | lineWidth: 1,
|
44163 | stroke: '#C0D0E0',
|
44164 | length: 5
|
44165 | },
|
44166 | startAngle: 1.25 * Math.PI,
|
44167 | endAngle: 7.25 * Math.PI,
|
44168 |
|
44169 | a: 0,
|
44170 |
|
44171 | center: null,
|
44172 |
|
44173 | axisStart: null,
|
44174 |
|
44175 | crp: []
|
44176 | });
|
44177 | };
|
44178 |
|
44179 | Helix.prototype.getLinePath = function getLinePath() {
|
44180 | var self = this;
|
44181 | var crp = self.get('crp');
|
44182 | var axisStart = self.get('axisStart');
|
44183 | var path = PathUtil.catmullRomToBezier(crp);
|
44184 | path.unshift(['M', axisStart.x, axisStart.y]);
|
44185 | return path;
|
44186 | };
|
44187 |
|
44188 | Helix.prototype.getTickPoint = function getTickPoint(value) {
|
44189 | var self = this;
|
44190 | var startAngle = self.get('startAngle');
|
44191 | var endAngle = self.get('endAngle');
|
44192 | var angle = startAngle + (endAngle - startAngle) * value;
|
44193 | return self._getHelixPoint(angle);
|
44194 | };
|
44195 |
|
44196 | Helix.prototype._getHelixPoint = function _getHelixPoint(angle) {
|
44197 | var self = this;
|
44198 | var center = self.get('center');
|
44199 | var a = self.get('a');
|
44200 | var radius = a * angle + self.get('inner');
|
44201 | return {
|
44202 | x: center.x + Math.cos(angle) * radius,
|
44203 | y: center.y + Math.sin(angle) * radius
|
44204 | };
|
44205 | };
|
44206 |
|
44207 | Helix.prototype.getSideVector = function getSideVector(offset, point) {
|
44208 | var self = this;
|
44209 | var center = self.get('center');
|
44210 | var vector = [point.x - center.x, point.y - center.y];
|
44211 | if (offset) {
|
44212 | var vecLen = vec2.length(vector);
|
44213 | vec2.scale(vector, vector, offset / vecLen);
|
44214 | }
|
44215 | return vector;
|
44216 | };
|
44217 |
|
44218 | Helix.prototype.getSidePoint = function getSidePoint(point, offset) {
|
44219 | var self = this;
|
44220 | var vector = self.getSideVector(offset, point);
|
44221 |
|
44222 | return {
|
44223 | x: point.x + vector[0],
|
44224 | y: point.y + vector[1]
|
44225 | };
|
44226 | };
|
44227 |
|
44228 | Helix.prototype.getTickEnd = function getTickEnd(start, length) {
|
44229 | var self = this;
|
44230 | var tickLine = self.get('tickLine');
|
44231 | length = length ? length : tickLine.length;
|
44232 | return self.getSidePoint(start, length);
|
44233 | };
|
44234 |
|
44235 | return Helix;
|
44236 | }(Base);
|
44237 |
|
44238 | module.exports = Helix;
|
44239 |
|
44240 | }),
|
44241 |
|
44242 | (function(module, exports, __webpack_require__) {
|
44243 |
|
44244 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
44245 |
|
44246 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
44247 |
|
44248 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
44249 |
|
44250 |
|
44251 |
|
44252 |
|
44253 |
|
44254 | var Util = __webpack_require__(0);
|
44255 | var Base = __webpack_require__(44);
|
44256 |
|
44257 | var _require = __webpack_require__(2),
|
44258 | MatrixUtil = _require.MatrixUtil,
|
44259 | PathUtil = _require.PathUtil;
|
44260 |
|
44261 | var vec2 = MatrixUtil.vec2;
|
44262 |
|
44263 | var Polyline = function (_Base) {
|
44264 | _inherits(Polyline, _Base);
|
44265 |
|
44266 | function Polyline() {
|
44267 | _classCallCheck(this, Polyline);
|
44268 |
|
44269 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
44270 | }
|
44271 |
|
44272 | Polyline.prototype.getDefaultCfg = function getDefaultCfg() {
|
44273 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
44274 |
|
44275 | return Util.mix({}, cfg, {
|
44276 | type: 'polyline'
|
44277 | });
|
44278 | };
|
44279 |
|
44280 | Polyline.prototype.getLinePath = function getLinePath() {
|
44281 | var self = this;
|
44282 | var tickPoints = self.get('tickPoints');
|
44283 | var start = self.get('start');
|
44284 | var end = self.get('end');
|
44285 | var points = [];
|
44286 | points.push(start.x);
|
44287 | points.push(start.y);
|
44288 | Util.each(tickPoints, function (tick) {
|
44289 | points.push(tick.x);
|
44290 | points.push(tick.y);
|
44291 | });
|
44292 | points.push(end.x);
|
44293 | points.push(end.y);
|
44294 |
|
44295 | var path = PathUtil.catmullRomToBezier(points);
|
44296 | path.unshift(['M', start.x, start.y]);
|
44297 | return path;
|
44298 | };
|
44299 |
|
44300 | Polyline.prototype.getTickPoint = function getTickPoint(value, index) {
|
44301 | var tickPoints = this.get('tickPoints');
|
44302 | return tickPoints[index];
|
44303 | };
|
44304 |
|
44305 | Polyline.prototype.getTickEnd = function getTickEnd(start, value, index) {
|
44306 | var self = this;
|
44307 | var lineAttrs = self.get('tickLine');
|
44308 | var tickLength = value ? value : lineAttrs.length;
|
44309 | var offsetVector = self.getSideVector(tickLength, start, index);
|
44310 | return {
|
44311 | x: start.x + offsetVector[0],
|
44312 | y: start.y + offsetVector[1]
|
44313 | };
|
44314 | };
|
44315 |
|
44316 | Polyline.prototype.getSideVector = function getSideVector(offset, point, index) {
|
44317 | var self = this;
|
44318 | var preTickPoint = void 0;
|
44319 | if (index === 0) {
|
44320 | preTickPoint = self.get('start');
|
44321 | } else {
|
44322 | var tickPoints = self.get('tickPoints');
|
44323 | preTickPoint = tickPoints[index - 1];
|
44324 | }
|
44325 |
|
44326 | var vector = [point.x - preTickPoint.x, point.y - preTickPoint.y];
|
44327 | var normal = vec2.normalize([], vector);
|
44328 | var verticalVector = vec2.vertical([], normal, false);
|
44329 | return vec2.scale([], verticalVector, offset);
|
44330 | };
|
44331 |
|
44332 | return Polyline;
|
44333 | }(Base);
|
44334 |
|
44335 | module.exports = Polyline;
|
44336 |
|
44337 | }),
|
44338 |
|
44339 | (function(module, exports, __webpack_require__) {
|
44340 |
|
44341 |
|
44342 |
|
44343 |
|
44344 |
|
44345 | module.exports = {
|
44346 | Line: __webpack_require__(342),
|
44347 | Text: __webpack_require__(343),
|
44348 | Image: __webpack_require__(344),
|
44349 | Region: __webpack_require__(345),
|
44350 | Html: __webpack_require__(346),
|
44351 | Arc: __webpack_require__(347)
|
44352 | };
|
44353 |
|
44354 | }),
|
44355 |
|
44356 | (function(module, exports, __webpack_require__) {
|
44357 |
|
44358 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
44359 |
|
44360 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
44361 |
|
44362 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
44363 |
|
44364 |
|
44365 |
|
44366 |
|
44367 |
|
44368 | var Util = __webpack_require__(0);
|
44369 | var Base = __webpack_require__(17);
|
44370 |
|
44371 | var vec2 = __webpack_require__(2).MatrixUtil.vec2;
|
44372 |
|
44373 | var Line = function (_Base) {
|
44374 | _inherits(Line, _Base);
|
44375 |
|
44376 | function Line() {
|
44377 | _classCallCheck(this, Line);
|
44378 |
|
44379 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
44380 | }
|
44381 |
|
44382 | Line.prototype.getDefaultCfg = function getDefaultCfg() {
|
44383 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
44384 | return Util.mix({}, cfg, {
|
44385 | |
44386 |
|
44387 |
|
44388 |
|
44389 | type: 'line',
|
44390 | zIndex: 15,
|
44391 | |
44392 |
|
44393 |
|
44394 |
|
44395 | start: null,
|
44396 | |
44397 |
|
44398 |
|
44399 |
|
44400 | end: null,
|
44401 | |
44402 |
|
44403 |
|
44404 |
|
44405 | lineStyle: {
|
44406 | stroke: '#000',
|
44407 | lineWidth: 1
|
44408 | },
|
44409 | |
44410 |
|
44411 |
|
44412 |
|
44413 | text: {
|
44414 | position: 'end',
|
44415 | autoRotate: true,
|
44416 | style: {
|
44417 | fill: '#999',
|
44418 | fontSize: 12,
|
44419 | fontWeight: 500,
|
44420 | fontFamily: 'sans-serif'
|
44421 | },
|
44422 | content: null
|
44423 | }
|
44424 | });
|
44425 | };
|
44426 |
|
44427 | Line.prototype.render = function render(coord, group) {
|
44428 | var self = this;
|
44429 | var start = self.parsePoint(coord, self.start);
|
44430 | var end = self.parsePoint(coord, self.end);
|
44431 | var guideLineGroup = group.addGroup();
|
44432 |
|
44433 | self._drawLines(start, end, guideLineGroup);
|
44434 | if (this.text && this.text.content) {
|
44435 | self._drawText(start, end, guideLineGroup);
|
44436 | }
|
44437 | self.el = guideLineGroup;
|
44438 | };
|
44439 |
|
44440 | Line.prototype._drawLines = function _drawLines(start, end, group) {
|
44441 | var path = [['M', start.x, start.y], ['L', end.x, end.y]];
|
44442 | var guideLine = group.addShape('Path', {
|
44443 | attrs: Util.mix({
|
44444 | path: path
|
44445 | }, this.lineStyle)
|
44446 | });
|
44447 | guideLine.name = 'guide-line';
|
44448 | this.appendInfo && guideLine.setSilent('appendInfo', this.appendInfo);
|
44449 | };
|
44450 |
|
44451 | Line.prototype._drawText = function _drawText(start, end, group) {
|
44452 | var textCfg = this.text;
|
44453 | var position = textCfg.position;
|
44454 | var textStyle = textCfg.style;
|
44455 |
|
44456 | var percent = void 0;
|
44457 | if (position === 'start') {
|
44458 | percent = 0;
|
44459 | } else if (position === 'center') {
|
44460 | percent = 0.5;
|
44461 | } else if (Util.isString(position) && position.indexOf('%') !== -1) {
|
44462 | percent = parseInt(position, 10) / 100;
|
44463 | } else if (Util.isNumber(position)) {
|
44464 | percent = position;
|
44465 | } else {
|
44466 | percent = 1;
|
44467 | }
|
44468 |
|
44469 | if (percent > 1 || percent < 0) {
|
44470 | percent = 1;
|
44471 | }
|
44472 |
|
44473 | var cfg = {
|
44474 | x: start.x + (end.x - start.x) * percent,
|
44475 | y: start.y + (end.y - start.y) * percent
|
44476 | };
|
44477 |
|
44478 | if (textCfg.offsetX) {
|
44479 |
|
44480 | cfg.x += textCfg.offsetX;
|
44481 | }
|
44482 |
|
44483 | if (textCfg.offsetY) {
|
44484 |
|
44485 | cfg.y += textCfg.offsetY;
|
44486 | }
|
44487 |
|
44488 | cfg.text = textCfg.content;
|
44489 | cfg = Util.mix({}, cfg, textStyle);
|
44490 | if (textCfg.autoRotate && !textStyle.rotate) {
|
44491 | var angle = vec2.angleTo([end.x - start.x, end.y - start.y], [1, 0], 1);
|
44492 | cfg.rotate = angle;
|
44493 | } else if (textStyle.rotate) {
|
44494 | cfg.rotate = textStyle.rotate * Math.PI / 180;
|
44495 | }
|
44496 |
|
44497 | var shape = group.addShape('Text', {
|
44498 | attrs: cfg
|
44499 | });
|
44500 | shape.name = 'guide-line-text';
|
44501 | this.appendInfo && shape.setSilent('appendInfo', this.appendInfo);
|
44502 | };
|
44503 |
|
44504 | return Line;
|
44505 | }(Base);
|
44506 |
|
44507 | module.exports = Line;
|
44508 |
|
44509 | }),
|
44510 |
|
44511 | (function(module, exports, __webpack_require__) {
|
44512 |
|
44513 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
44514 |
|
44515 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
44516 |
|
44517 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
44518 |
|
44519 |
|
44520 |
|
44521 |
|
44522 |
|
44523 | var Util = __webpack_require__(0);
|
44524 | var Base = __webpack_require__(17);
|
44525 |
|
44526 | var Text = function (_Base) {
|
44527 | _inherits(Text, _Base);
|
44528 |
|
44529 | function Text() {
|
44530 | _classCallCheck(this, Text);
|
44531 |
|
44532 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
44533 | }
|
44534 |
|
44535 | Text.prototype.getDefaultCfg = function getDefaultCfg() {
|
44536 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
44537 | return Util.mix({}, cfg, {
|
44538 | |
44539 |
|
44540 |
|
44541 |
|
44542 | type: 'text',
|
44543 |
|
44544 | zIndex: 15,
|
44545 | |
44546 |
|
44547 |
|
44548 |
|
44549 | position: null,
|
44550 | |
44551 |
|
44552 |
|
44553 |
|
44554 | content: null,
|
44555 | |
44556 |
|
44557 |
|
44558 |
|
44559 | style: {
|
44560 | fill: '#999',
|
44561 | fontSize: 12,
|
44562 | fontWeight: 500,
|
44563 | textAlign: 'center'
|
44564 | },
|
44565 | |
44566 |
|
44567 |
|
44568 |
|
44569 | offsetX: null,
|
44570 | |
44571 |
|
44572 |
|
44573 |
|
44574 | offsetY: null
|
44575 | });
|
44576 | };
|
44577 |
|
44578 | Text.prototype.render = function render(coord, group) {
|
44579 | var self = this;
|
44580 | var position = self.position;
|
44581 | var point = self.parsePoint(coord, position);
|
44582 | var textStyle = Util.mix({}, this.style);
|
44583 |
|
44584 | if (self.offsetX) {
|
44585 | point.x += self.offsetX;
|
44586 | }
|
44587 |
|
44588 | if (self.offsetY) {
|
44589 | point.y += self.offsetY;
|
44590 | }
|
44591 |
|
44592 | if (textStyle.rotate) {
|
44593 | textStyle.rotate = textStyle.rotate * Math.PI / 180;
|
44594 | }
|
44595 |
|
44596 | var guideText = group.addShape('Text', {
|
44597 | zIndex: self.zIndex,
|
44598 | attrs: Util.mix({
|
44599 | text: self.content
|
44600 | }, textStyle, point)
|
44601 | });
|
44602 | guideText.name = 'guide-text';
|
44603 | self.appendInfo && guideText.setSilent('appendInfo', self.appendInfo);
|
44604 | self.el = guideText;
|
44605 | };
|
44606 |
|
44607 | return Text;
|
44608 | }(Base);
|
44609 |
|
44610 | module.exports = Text;
|
44611 |
|
44612 | }),
|
44613 |
|
44614 | (function(module, exports, __webpack_require__) {
|
44615 |
|
44616 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
44617 |
|
44618 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
44619 |
|
44620 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
44621 |
|
44622 |
|
44623 |
|
44624 |
|
44625 |
|
44626 | var Util = __webpack_require__(0);
|
44627 | var Base = __webpack_require__(17);
|
44628 |
|
44629 | var Image = function (_Base) {
|
44630 | _inherits(Image, _Base);
|
44631 |
|
44632 | function Image() {
|
44633 | _classCallCheck(this, Image);
|
44634 |
|
44635 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
44636 | }
|
44637 |
|
44638 | Image.prototype.getDefaultCfg = function getDefaultCfg() {
|
44639 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
44640 | return Util.mix({}, cfg, {
|
44641 | |
44642 |
|
44643 |
|
44644 |
|
44645 | type: 'image',
|
44646 | zIndex: 1,
|
44647 | |
44648 |
|
44649 |
|
44650 |
|
44651 | start: null,
|
44652 | |
44653 |
|
44654 |
|
44655 |
|
44656 | end: null,
|
44657 | |
44658 |
|
44659 |
|
44660 |
|
44661 | src: null,
|
44662 | |
44663 |
|
44664 |
|
44665 |
|
44666 | offsetX: null,
|
44667 | |
44668 |
|
44669 |
|
44670 |
|
44671 | offsetY: null
|
44672 | });
|
44673 | };
|
44674 |
|
44675 | Image.prototype.render = function render(coord, group) {
|
44676 | var self = this;
|
44677 | var start = self.parsePoint(coord, self.start);
|
44678 |
|
44679 | var cfg = {
|
44680 | x: start.x,
|
44681 | y: start.y
|
44682 | };
|
44683 | cfg.img = self.src;
|
44684 |
|
44685 | if (!self.end) {
|
44686 |
|
44687 | if (self.width) {
|
44688 | cfg.width = self.width;
|
44689 | }
|
44690 |
|
44691 | if (self.height) {
|
44692 | cfg.height = self.height;
|
44693 | }
|
44694 | } else {
|
44695 | var end = self.parsePoint(coord, self.end);
|
44696 | cfg.width = Math.abs(end.x - start.x);
|
44697 | cfg.height = Math.abs(start.y - end.y);
|
44698 | }
|
44699 |
|
44700 | if (self.offsetX) {
|
44701 | cfg.x += self.offsetX;
|
44702 | }
|
44703 |
|
44704 | if (self.offsetY) {
|
44705 | cfg.y += self.offsetY;
|
44706 | }
|
44707 |
|
44708 | var imgGuide = group.addShape('Image', {
|
44709 | zIndex: 1,
|
44710 | attrs: cfg
|
44711 | });
|
44712 | imgGuide.name = 'guide-image';
|
44713 | self.appendInfo && imgGuide.setSilent('appendInfo', self.appendInfo);
|
44714 | self.el = imgGuide;
|
44715 | };
|
44716 |
|
44717 | return Image;
|
44718 | }(Base);
|
44719 |
|
44720 | module.exports = Image;
|
44721 |
|
44722 | }),
|
44723 |
|
44724 | (function(module, exports, __webpack_require__) {
|
44725 |
|
44726 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
44727 |
|
44728 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
44729 |
|
44730 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
44731 |
|
44732 |
|
44733 |
|
44734 |
|
44735 |
|
44736 | var Util = __webpack_require__(0);
|
44737 | var Base = __webpack_require__(17);
|
44738 |
|
44739 | var Region = function (_Base) {
|
44740 | _inherits(Region, _Base);
|
44741 |
|
44742 | function Region() {
|
44743 | _classCallCheck(this, Region);
|
44744 |
|
44745 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
44746 | }
|
44747 |
|
44748 | Region.prototype.getDefaultCfg = function getDefaultCfg() {
|
44749 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
44750 |
|
44751 | return Util.mix({}, cfg, {
|
44752 | type: 'region',
|
44753 | zIndex: 1,
|
44754 | start: null,
|
44755 | end: null,
|
44756 | style: {
|
44757 | lineWidth: 0,
|
44758 | fill: '#CCD7EB',
|
44759 | opacity: 0.4
|
44760 | }
|
44761 | });
|
44762 | };
|
44763 |
|
44764 | Region.prototype.render = function render(coord, group) {
|
44765 | var self = this;
|
44766 | var rectStyle = self.style;
|
44767 | var path = self._getPath(coord);
|
44768 |
|
44769 | var regionGroup = group.addShape('path', {
|
44770 | zIndex: self.zIndex,
|
44771 | attrs: Util.mix({
|
44772 | path: path
|
44773 | }, rectStyle)
|
44774 | });
|
44775 | regionGroup.name = 'guide-region';
|
44776 | self.appendInfo && regionGroup.setSilent('appendInfo', self.appendInfo);
|
44777 | self.el = regionGroup;
|
44778 | };
|
44779 |
|
44780 | Region.prototype._getPath = function _getPath(coord) {
|
44781 | var self = this;
|
44782 | var start = self.parsePoint(coord, self.start);
|
44783 | var end = self.parsePoint(coord, self.end);
|
44784 | var path = [];
|
44785 | path.push(['M', start.x, start.y]);
|
44786 | path.push(['L', end.x, start.y]);
|
44787 | path.push(['L', end.x, end.y]);
|
44788 | path.push(['L', start.x, end.y]);
|
44789 | path.push(['z']);
|
44790 | return path;
|
44791 | };
|
44792 |
|
44793 | return Region;
|
44794 | }(Base);
|
44795 |
|
44796 | module.exports = Region;
|
44797 |
|
44798 | }),
|
44799 |
|
44800 | (function(module, exports, __webpack_require__) {
|
44801 |
|
44802 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
44803 |
|
44804 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
44805 |
|
44806 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
44807 |
|
44808 |
|
44809 |
|
44810 |
|
44811 |
|
44812 | var Util = __webpack_require__(0);
|
44813 |
|
44814 | var _require = __webpack_require__(2),
|
44815 | DomUtil = _require.DomUtil;
|
44816 |
|
44817 | var Base = __webpack_require__(17);
|
44818 |
|
44819 | var Html = function (_Base) {
|
44820 | _inherits(Html, _Base);
|
44821 |
|
44822 | function Html() {
|
44823 | _classCallCheck(this, Html);
|
44824 |
|
44825 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
44826 | }
|
44827 |
|
44828 | Html.prototype.getDefaultCfg = function getDefaultCfg() {
|
44829 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
44830 | return Util.mix({}, cfg, {
|
44831 | |
44832 |
|
44833 |
|
44834 |
|
44835 | type: 'html',
|
44836 | zIndex: 15,
|
44837 | |
44838 |
|
44839 |
|
44840 |
|
44841 | position: null,
|
44842 | |
44843 |
|
44844 |
|
44845 |
|
44846 | alignX: 'middle',
|
44847 | |
44848 |
|
44849 |
|
44850 |
|
44851 | alignY: 'middle',
|
44852 | |
44853 |
|
44854 |
|
44855 |
|
44856 | offsetX: null,
|
44857 | |
44858 |
|
44859 |
|
44860 |
|
44861 | offsetY: null,
|
44862 | |
44863 |
|
44864 |
|
44865 |
|
44866 | html: null
|
44867 | });
|
44868 | };
|
44869 |
|
44870 | Html.prototype.render = function render(coord, group) {
|
44871 | var self = this;
|
44872 | var position = self.parsePoint(coord, self.position);
|
44873 |
|
44874 | var parentNode = group.get('canvas').get('el').parentNode;
|
44875 | var wrapperNode = DomUtil.createDom('<div class="g-guide"></div>');
|
44876 | parentNode.appendChild(wrapperNode);
|
44877 |
|
44878 | var html = self.html;
|
44879 | if (Util.isFunction(html)) {
|
44880 | html = html(self.xScales, self.yScales);
|
44881 | }
|
44882 | var htmlNode = DomUtil.createDom(html);
|
44883 | wrapperNode.appendChild(htmlNode);
|
44884 | self._setDomPosition(wrapperNode, htmlNode, position);
|
44885 | self.el = wrapperNode;
|
44886 | };
|
44887 |
|
44888 | Html.prototype._setDomPosition = function _setDomPosition(parentDom, childDom, point) {
|
44889 | var self = this;
|
44890 | var alignX = self.alignX;
|
44891 | var alignY = self.alignY;
|
44892 | var domWidth = DomUtil.getOuterWidth(childDom);
|
44893 | var domHeight = DomUtil.getOuterHeight(childDom);
|
44894 |
|
44895 | var position = {
|
44896 | x: point.x,
|
44897 | y: point.y
|
44898 | };
|
44899 |
|
44900 | if (alignX === 'middle' && alignY === 'top') {
|
44901 | position.x -= Util.round(domWidth / 2);
|
44902 | } else if (alignX === 'middle' && alignY === 'bottom') {
|
44903 | position.x -= Util.round(domWidth / 2);
|
44904 | position.y -= Util.round(domHeight);
|
44905 | } else if (alignX === 'left' && alignY === 'bottom') {
|
44906 | position.y -= Util.round(domHeight);
|
44907 | } else if (alignX === 'left' && alignY === 'middle') {
|
44908 | position.y -= Util.round(domHeight / 2);
|
44909 | } else if (alignX === 'left' && alignY === 'top') {
|
44910 | position.x = point.x;
|
44911 | position.y = point.y;
|
44912 | } else if (alignX === 'right' && alignY === 'bottom') {
|
44913 | position.x -= Util.round(domWidth);
|
44914 | position.y -= Util.round(domHeight);
|
44915 | } else if (alignX === 'right' && alignY === 'middle') {
|
44916 | position.x -= Util.round(domWidth);
|
44917 | position.y -= Util.round(domHeight / 2);
|
44918 | } else if (alignX === 'right' && alignY === 'top') {
|
44919 | position.x -= Util.round(domWidth);
|
44920 | } else {
|
44921 |
|
44922 | position.x -= Util.round(domWidth / 2);
|
44923 | position.y -= Util.round(domHeight / 2);
|
44924 | }
|
44925 |
|
44926 | if (self.offsetX) {
|
44927 | position.x += self.offsetX;
|
44928 | }
|
44929 |
|
44930 | if (self.offsetY) {
|
44931 | position.y += self.offsetY;
|
44932 | }
|
44933 |
|
44934 | DomUtil.modifyCSS(parentDom, {
|
44935 | position: 'absolute',
|
44936 | top: Math.round(position.y) + 'px',
|
44937 | left: Math.round(position.x) + 'px',
|
44938 | visibility: 'visible',
|
44939 | zIndex: self.zIndex
|
44940 | });
|
44941 | };
|
44942 |
|
44943 | Html.prototype.remove = function remove() {
|
44944 | var self = this;
|
44945 | var el = self.el;
|
44946 | if (el) {
|
44947 | el.parentNode.removeChild(el);
|
44948 | }
|
44949 | };
|
44950 |
|
44951 | return Html;
|
44952 | }(Base);
|
44953 |
|
44954 | module.exports = Html;
|
44955 |
|
44956 | }),
|
44957 |
|
44958 | (function(module, exports, __webpack_require__) {
|
44959 |
|
44960 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
44961 |
|
44962 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
44963 |
|
44964 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
44965 |
|
44966 |
|
44967 |
|
44968 |
|
44969 |
|
44970 | var Util = __webpack_require__(0);
|
44971 | var Base = __webpack_require__(17);
|
44972 |
|
44973 | var Arc = function (_Base) {
|
44974 | _inherits(Arc, _Base);
|
44975 |
|
44976 | function Arc() {
|
44977 | _classCallCheck(this, Arc);
|
44978 |
|
44979 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
44980 | }
|
44981 |
|
44982 | Arc.prototype.getDefaultCfg = function getDefaultCfg() {
|
44983 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
44984 | return Util.mix({}, cfg, {
|
44985 | |
44986 |
|
44987 |
|
44988 |
|
44989 | type: 'arc',
|
44990 | zIndex: 15,
|
44991 | |
44992 |
|
44993 |
|
44994 |
|
44995 | start: null,
|
44996 | |
44997 |
|
44998 |
|
44999 |
|
45000 | end: null,
|
45001 | |
45002 |
|
45003 |
|
45004 |
|
45005 | style: {
|
45006 | stroke: '#999',
|
45007 | lineWidth: 1
|
45008 | }
|
45009 | });
|
45010 | };
|
45011 |
|
45012 | Arc.prototype.render = function render(coord, group) {
|
45013 | var self = this;
|
45014 | var start = self.parsePoint(coord, self.start);
|
45015 | var end = self.parsePoint(coord, self.end);
|
45016 | var coordCenter = coord.getCenter();
|
45017 | var radius = Math.sqrt((start.x - coordCenter.x) * (start.x - coordCenter.x) + (start.y - coordCenter.y) * (start.y - coordCenter.y));
|
45018 | var startAngle = Math.atan2(start.y - coordCenter.y, start.x - coordCenter.x);
|
45019 | var endAngle = Math.atan2(end.y - coordCenter.y, end.x - coordCenter.x);
|
45020 |
|
45021 | var arcShape = group.addShape('arc', {
|
45022 | zIndex: self.zIndex,
|
45023 | attrs: Util.mix({
|
45024 | x: coordCenter.x,
|
45025 | y: coordCenter.y,
|
45026 | r: radius,
|
45027 | startAngle: startAngle,
|
45028 | endAngle: endAngle
|
45029 | }, self.style)
|
45030 | });
|
45031 | arcShape.name = 'guide-arc';
|
45032 | self.appendInfo && arcShape.setSilent('appendInfo', self.appendInfo);
|
45033 | self.el = arcShape;
|
45034 | };
|
45035 |
|
45036 | return Arc;
|
45037 | }(Base);
|
45038 |
|
45039 | module.exports = Arc;
|
45040 |
|
45041 | }),
|
45042 |
|
45043 | (function(module, exports, __webpack_require__) {
|
45044 |
|
45045 |
|
45046 |
|
45047 |
|
45048 |
|
45049 | module.exports = {
|
45050 | Category: __webpack_require__(349),
|
45051 | Color: __webpack_require__(350),
|
45052 | Size: __webpack_require__(352)
|
45053 | };
|
45054 |
|
45055 | }),
|
45056 |
|
45057 | (function(module, exports, __webpack_require__) {
|
45058 |
|
45059 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
45060 |
|
45061 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
45062 |
|
45063 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
45064 |
|
45065 |
|
45066 |
|
45067 |
|
45068 |
|
45069 | var Util = __webpack_require__(0);
|
45070 | var Base = __webpack_require__(122);
|
45071 |
|
45072 | var _require = __webpack_require__(2),
|
45073 | DomUtil = _require.DomUtil,
|
45074 | Event = _require.Event,
|
45075 | Group = _require.Group;
|
45076 |
|
45077 | var Global = __webpack_require__(1);
|
45078 | var LEGEND_STYLE = Global.legend.html;
|
45079 |
|
45080 | var CONTAINER_CLASS = 'g2-legend';
|
45081 | var TITLE_CLASS = 'g2-legend-title';
|
45082 | var LIST_CLASS = 'g2-legend-list';
|
45083 | var ITEM_CLASS = 'g2-legend-list-item';
|
45084 | var TEXT_CLASS = 'g2-legend-text';
|
45085 | var MARKER_CLASS = 'g2-legend-marker';
|
45086 |
|
45087 | function findNodeByClass(node, className) {
|
45088 | return node.getElementsByClassName(className)[0];
|
45089 | }
|
45090 |
|
45091 | function getParentNode(node, className) {
|
45092 | var nodeClass = node.className;
|
45093 | nodeClass = nodeClass.split(' ');
|
45094 | if (nodeClass.indexOf(className) > -1) {
|
45095 | return node;
|
45096 | }
|
45097 |
|
45098 | if (node.parentNode) {
|
45099 | if (node.parentNode.className === CONTAINER_CLASS) {
|
45100 | return node.parentNode;
|
45101 | }
|
45102 | return getParentNode(node.parentNode, className);
|
45103 | }
|
45104 |
|
45105 | return null;
|
45106 | }
|
45107 |
|
45108 | function findItem(items, refer) {
|
45109 | var rst = null;
|
45110 | var value = refer instanceof Group ? refer.get('value') : refer;
|
45111 | Util.each(items, function (item) {
|
45112 | if (item.value === value) {
|
45113 | rst = item;
|
45114 | return false;
|
45115 | }
|
45116 | });
|
45117 |
|
45118 | return rst;
|
45119 | }
|
45120 |
|
45121 | function findShapeByName(group, name) {
|
45122 | return group.findBy(function (node) {
|
45123 | return node.name === name;
|
45124 | });
|
45125 | }
|
45126 |
|
45127 | var Category = function (_Base) {
|
45128 | _inherits(Category, _Base);
|
45129 |
|
45130 | function Category() {
|
45131 | _classCallCheck(this, Category);
|
45132 |
|
45133 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
45134 | }
|
45135 |
|
45136 | Category.prototype.getDefaultCfg = function getDefaultCfg() {
|
45137 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
45138 | return Util.mix({}, cfg, {
|
45139 | |
45140 |
|
45141 |
|
45142 |
|
45143 | type: 'category-legend',
|
45144 | |
45145 |
|
45146 |
|
45147 |
|
45148 | items: null,
|
45149 | |
45150 |
|
45151 |
|
45152 |
|
45153 |
|
45154 | itemGap: 5,
|
45155 | |
45156 |
|
45157 |
|
45158 |
|
45159 |
|
45160 | titleGap: 15,
|
45161 | |
45162 |
|
45163 |
|
45164 |
|
45165 |
|
45166 | itemMarginBottom: 8,
|
45167 | |
45168 |
|
45169 |
|
45170 |
|
45171 | itemsGroup: null,
|
45172 | |
45173 |
|
45174 |
|
45175 |
|
45176 | layout: 'horizontal',
|
45177 | |
45178 |
|
45179 |
|
45180 |
|
45181 | allowAllCanceled: false,
|
45182 | |
45183 |
|
45184 |
|
45185 |
|
45186 | backPadding: [0, 0, 0, 0],
|
45187 | |
45188 |
|
45189 |
|
45190 |
|
45191 | checkable: true,
|
45192 | |
45193 |
|
45194 |
|
45195 |
|
45196 | unCheckColor: '#ccc',
|
45197 | |
45198 |
|
45199 |
|
45200 |
|
45201 | background: {
|
45202 | fill: '#fff',
|
45203 | fillOpacity: 0
|
45204 | },
|
45205 | |
45206 |
|
45207 |
|
45208 |
|
45209 | itemWidth: null,
|
45210 | textStyle: {
|
45211 | fill: '#333',
|
45212 | fontSize: 12,
|
45213 | textAlign: 'start',
|
45214 | textBaseline: 'middle',
|
45215 | fontFamily: Global.fontFamily
|
45216 | },
|
45217 | |
45218 |
|
45219 |
|
45220 |
|
45221 | _wordSpaceing: 8,
|
45222 | |
45223 |
|
45224 |
|
45225 |
|
45226 | useHtml: false,
|
45227 | |
45228 |
|
45229 |
|
45230 |
|
45231 | autoPosition: true,
|
45232 | container: null,
|
45233 | |
45234 |
|
45235 |
|
45236 |
|
45237 | containerTpl: '<div class="' + CONTAINER_CLASS + '">' + '<h4 class="' + TITLE_CLASS + '"></h4>' + '<ul class="' + LIST_CLASS + '"></ul>' + '</div>',
|
45238 | |
45239 |
|
45240 |
|
45241 |
|
45242 | _defaultItemTpl: '<li class="' + ITEM_CLASS + ' item-{index} {checked}" data-color="{originColor}" data-value="{originValue}">' + '<i class="' + MARKER_CLASS + '" style="background-color:{color};"></i>' + '<span class="' + TEXT_CLASS + '">{value}</span></li>',
|
45243 | |
45244 |
|
45245 |
|
45246 |
|
45247 | itemTpl: null,
|
45248 | |
45249 |
|
45250 |
|
45251 |
|
45252 | clickable: true,
|
45253 | |
45254 |
|
45255 |
|
45256 |
|
45257 |
|
45258 | selectedMode: 'multiple',
|
45259 | |
45260 |
|
45261 |
|
45262 |
|
45263 | reversed: false,
|
45264 | |
45265 |
|
45266 |
|
45267 |
|
45268 | autoWrap: true
|
45269 | });
|
45270 | };
|
45271 |
|
45272 | Category.prototype._beforeRenderUI = function _beforeRenderUI() {
|
45273 | _Base.prototype._beforeRenderUI.call(this);
|
45274 | };
|
45275 |
|
45276 | Category.prototype._renderUI = function _renderUI() {
|
45277 | if (!this.get('useHtml')) {
|
45278 | _Base.prototype._renderUI.call(this);
|
45279 | this._renderItems();
|
45280 | this.get('autoWrap') && this._adjustItems();
|
45281 | this._renderBack();
|
45282 | } else {
|
45283 |
|
45284 | this._renderHTML();
|
45285 | }
|
45286 | };
|
45287 |
|
45288 | Category.prototype._bindUI = function _bindUI() {
|
45289 | if (this.get('hoverable')) {
|
45290 | this.on('mousemove', Util.wrapBehavior(this, '_onMousemove'));
|
45291 | this.on('mouseleave', Util.wrapBehavior(this, '_onMouseleave'));
|
45292 | }
|
45293 |
|
45294 | if (this.get('clickable')) {
|
45295 | this.on('click', Util.wrapBehavior(this, '_onClick'));
|
45296 | }
|
45297 | };
|
45298 |
|
45299 | Category.prototype._getLegendItem = function _getLegendItem(target) {
|
45300 | var item = target.get('parent');
|
45301 | if (item && item.name === 'legendGroup') {
|
45302 | return item;
|
45303 | }
|
45304 | return null;
|
45305 | };
|
45306 |
|
45307 | Category.prototype._onMousemove = function _onMousemove(ev) {
|
45308 | var item = this._getLegendItem(ev.currentTarget);
|
45309 | if (item && item.get('checked')) {
|
45310 | var items = this.get('items');
|
45311 | var itemhover = new Event('itemhover', ev, true, true);
|
45312 | itemhover.item = findItem(items, item);
|
45313 | itemhover.checked = item.get('checked');
|
45314 | this.emit('itemhover', itemhover);
|
45315 | } else if (!item) {
|
45316 | this.emit('itemunhover', ev);
|
45317 | }
|
45318 |
|
45319 | return;
|
45320 | };
|
45321 |
|
45322 | Category.prototype._onMouseleave = function _onMouseleave(ev) {
|
45323 | this.emit('itemunhover', ev);
|
45324 | return;
|
45325 | };
|
45326 |
|
45327 | Category.prototype._onClick = function _onClick(ev) {
|
45328 | var clickedItem = this._getLegendItem(ev.currentTarget);
|
45329 | var items = this.get('items');
|
45330 | if (clickedItem && !clickedItem.get('destroyed')) {
|
45331 | var checked = clickedItem.get('checked');
|
45332 | if (!this.get('allowAllCanceled') && checked && this.getCheckedCount() === 1) {
|
45333 | return;
|
45334 | }
|
45335 | var mode = this.get('selectedMode');
|
45336 | var item = findItem(items, clickedItem);
|
45337 | var itemclick = new Event('itemclick', ev, true, true);
|
45338 | itemclick.item = item;
|
45339 | itemclick.currentTarget = clickedItem;
|
45340 | itemclick.checked = mode === 'single' ? true : !checked;
|
45341 |
|
45342 | var unCheckColor = this.get('unCheckColor');
|
45343 | var checkColor = this.get('textStyle').fill;
|
45344 | var markerItem = void 0;
|
45345 | var textItem = void 0;
|
45346 | var legendItem = void 0;
|
45347 | if (mode === 'single') {
|
45348 | var itemsGroup = this.get('itemsGroup');
|
45349 | var children = itemsGroup.get('children');
|
45350 | Util.each(children, function (child) {
|
45351 | markerItem = findShapeByName(child, 'legend-marker');
|
45352 | textItem = findShapeByName(child, 'legend-text');
|
45353 | legendItem = findShapeByName(child, 'legend-item');
|
45354 | if (child !== clickedItem) {
|
45355 | if (markerItem.attr('fill')) {
|
45356 | markerItem.attr('fill', unCheckColor);
|
45357 | }
|
45358 | if (markerItem.attr('stroke')) {
|
45359 | markerItem.attr('stroke', unCheckColor);
|
45360 | }
|
45361 | textItem.attr('fill', unCheckColor);
|
45362 | markerItem.setSilent('checked', false);
|
45363 | textItem.setSilent('checked', false);
|
45364 | legendItem.setSilent('checked', false);
|
45365 | child.setSilent('checked', false);
|
45366 | } else {
|
45367 | if (markerItem.attr('fill')) {
|
45368 | markerItem.attr('fill', item.marker.fill);
|
45369 | }
|
45370 | if (markerItem.attr('stroke')) {
|
45371 | markerItem.attr('stroke', item.marker.stroke);
|
45372 | }
|
45373 | textItem.attr('fill', checkColor);
|
45374 | markerItem.setSilent('checked', true);
|
45375 | textItem.setSilent('checked', true);
|
45376 | legendItem.setSilent('checked', true);
|
45377 | child.setSilent('checked', true);
|
45378 | }
|
45379 | });
|
45380 | } else {
|
45381 | markerItem = findShapeByName(clickedItem, 'legend-marker');
|
45382 | textItem = findShapeByName(clickedItem, 'legend-text');
|
45383 | legendItem = findShapeByName(clickedItem, 'legend-item');
|
45384 |
|
45385 | if (markerItem.attr('fill')) {
|
45386 | markerItem.attr('fill', checked ? unCheckColor : item.marker.fill);
|
45387 | }
|
45388 | if (markerItem.attr('stroke')) {
|
45389 | markerItem.attr('stroke', checked ? unCheckColor : item.marker.stroke);
|
45390 | }
|
45391 | textItem.attr('fill', checked ? unCheckColor : checkColor);
|
45392 | clickedItem.setSilent('checked', !checked);
|
45393 | markerItem.setSilent('checked', !checked);
|
45394 | textItem.setSilent('checked', !checked);
|
45395 | legendItem.setSilent('checked', !checked);
|
45396 | }
|
45397 | this.emit('itemclick', itemclick);
|
45398 | }
|
45399 | return;
|
45400 | };
|
45401 |
|
45402 | Category.prototype._renderHTML = function _renderHTML() {
|
45403 | var _this2 = this;
|
45404 |
|
45405 | var self = this;
|
45406 | var canvas = self.get('canvas');
|
45407 | var outterNode = canvas.get('el').parentNode;
|
45408 | var title = this.get('title');
|
45409 | var containerTpl = self.get('containerTpl');
|
45410 | var legendWrapper = DomUtil.createDom(containerTpl);
|
45411 | var titleDom = findNodeByClass(legendWrapper, TITLE_CLASS);
|
45412 | var itemListDom = findNodeByClass(legendWrapper, LIST_CLASS);
|
45413 | var unCheckedColor = self.get('unCheckColor');
|
45414 | var mode = self.get('selectedMode');
|
45415 |
|
45416 | DomUtil.modifyCSS(itemListDom, Util.mix({}, LEGEND_STYLE[LIST_CLASS], self.get(LIST_CLASS)));
|
45417 |
|
45418 | if (titleDom) {
|
45419 | if (title && title.text) {
|
45420 | titleDom.innerHTML = title.text;
|
45421 | DomUtil.modifyCSS(titleDom, Util.mix({}, LEGEND_STYLE[TITLE_CLASS], self.get(TITLE_CLASS)));
|
45422 | } else {
|
45423 | legendWrapper.removeChild(titleDom);
|
45424 | }
|
45425 | }
|
45426 |
|
45427 |
|
45428 | var items = self.get('items');
|
45429 | var itemTpl = self.get('_defaultItemTpl');
|
45430 | var userItemTpl = self.get('itemTpl');
|
45431 | if (userItemTpl && userItemTpl !== itemTpl) {
|
45432 | itemTpl = userItemTpl;
|
45433 | }
|
45434 |
|
45435 | if (self.get('reversed')) {
|
45436 | items.reverse();
|
45437 | }
|
45438 |
|
45439 | var position = self.get('position');
|
45440 | var itemStyle = Util.mix({}, LEGEND_STYLE[ITEM_CLASS], {
|
45441 | display: position === 'right' || position === 'left' ? 'block' : 'inline-block'
|
45442 | }, self.get(ITEM_CLASS));
|
45443 | var markerStyle = Util.mix({}, LEGEND_STYLE[MARKER_CLASS], self.get(MARKER_CLASS));
|
45444 | Util.each(items, function (item, index) {
|
45445 | var checked = item.checked;
|
45446 | var value = self._formatItemValue(item.value);
|
45447 | var markerColor = item.marker.fill || item.marker.stroke;
|
45448 | var color = checked ? markerColor : unCheckedColor;
|
45449 | var domStr = void 0;
|
45450 | if (Util.isFunction(itemTpl)) {
|
45451 | domStr = itemTpl(value, color, checked, index);
|
45452 | } else {
|
45453 | domStr = itemTpl;
|
45454 | }
|
45455 | var itemDiv = Util.substitute(domStr, {
|
45456 | index: index,
|
45457 | checked: checked ? 'checked' : 'unChecked',
|
45458 | value: value,
|
45459 | color: color,
|
45460 | originColor: markerColor,
|
45461 | originValue: item.value
|
45462 | });
|
45463 | var itemDom = DomUtil.createDom(itemDiv);
|
45464 | var markerDom = findNodeByClass(itemDom, MARKER_CLASS);
|
45465 | DomUtil.modifyCSS(itemDom, itemStyle);
|
45466 | markerDom && DomUtil.modifyCSS(markerDom, markerStyle);
|
45467 |
|
45468 | if (!checked) {
|
45469 | itemDom.style.color = unCheckedColor;
|
45470 | if (markerDom) {
|
45471 | markerDom.style.backgroundColor = unCheckedColor;
|
45472 | }
|
45473 | }
|
45474 | itemListDom.appendChild(itemDom);
|
45475 | });
|
45476 |
|
45477 | if (self.get('clickable')) {
|
45478 | var childNodes = itemListDom.childNodes;
|
45479 |
|
45480 | legendWrapper.onclick = function (ev) {
|
45481 | var target = ev.target;
|
45482 | var targetClass = target.className;
|
45483 | targetClass = targetClass.split(' ');
|
45484 | if (targetClass.indexOf(CONTAINER_CLASS) > -1 || targetClass.indexOf(LIST_CLASS) > -1) {
|
45485 | return;
|
45486 | }
|
45487 | var parentDom = getParentNode(target, ITEM_CLASS);
|
45488 | var textDom = findNodeByClass(parentDom, TEXT_CLASS);
|
45489 | var markerDom = findNodeByClass(parentDom, MARKER_CLASS);
|
45490 | var clickedItem = findItem(items, parentDom.getAttribute('data-value'));
|
45491 |
|
45492 | if (!clickedItem) {
|
45493 | return;
|
45494 | }
|
45495 |
|
45496 | clickedItem.checked = mode === 'single' ? true : !clickedItem.checked;
|
45497 | var domClass = parentDom.className;
|
45498 | var originColor = parentDom.getAttribute('data-color');
|
45499 | if (mode === 'single') {
|
45500 |
|
45501 |
|
45502 | Util.each(childNodes, function (child) {
|
45503 | if (child !== parentDom) {
|
45504 | var childMarkerDom = findNodeByClass(child, MARKER_CLASS);
|
45505 | childMarkerDom.style.backgroundColor = unCheckedColor;
|
45506 | child.className = Util.replace(child.className, 'checked', 'unChecked');
|
45507 | child.style.color = unCheckedColor;
|
45508 |
|
45509 | var childItem = findItem(items, child.getAttribute('data-value'));
|
45510 | childItem.checked = false;
|
45511 | } else {
|
45512 | if (textDom) {
|
45513 | textDom.style.color = self.get('textStyle').fill;
|
45514 | }
|
45515 | if (markerDom) {
|
45516 | markerDom.style.backgroundColor = originColor;
|
45517 | }
|
45518 | parentDom.className = Util.replace(domClass, 'unChecked', 'checked');
|
45519 | }
|
45520 | });
|
45521 | } else {
|
45522 |
|
45523 | var clickedItemChecked = domClass.includes('checked');
|
45524 | var count = 0;
|
45525 | Util.each(childNodes, function (child) {
|
45526 | if (child.className.includes('checked')) {
|
45527 | count++;
|
45528 | }
|
45529 | });
|
45530 | if (!_this2.get('allowAllCanceled') && clickedItemChecked && count === 1) {
|
45531 | return;
|
45532 | }
|
45533 | if (clickedItemChecked) {
|
45534 | if (markerDom) {
|
45535 | markerDom.style.backgroundColor = unCheckedColor;
|
45536 | }
|
45537 | parentDom.className = Util.replace(domClass, 'checked', 'unChecked');
|
45538 | parentDom.style.color = unCheckedColor;
|
45539 | } else {
|
45540 | if (markerDom) {
|
45541 | markerDom.style.backgroundColor = originColor;
|
45542 | }
|
45543 | parentDom.className = Util.replace(domClass, 'unChecked', 'checked');
|
45544 | parentDom.style.color = self.get('textStyle').fill;
|
45545 | }
|
45546 | }
|
45547 |
|
45548 | self.emit('itemclick', {
|
45549 | item: clickedItem,
|
45550 | currentTarget: parentDom,
|
45551 | checked: mode === 'single' ? true : clickedItem.checked
|
45552 | });
|
45553 | };
|
45554 | }
|
45555 | if (self.get('hoverable')) {
|
45556 | legendWrapper.onmousemove = function (ev) {
|
45557 | var target = ev.target;
|
45558 | var targetClass = target.className;
|
45559 | targetClass = targetClass.split(' ');
|
45560 | if (targetClass.indexOf(CONTAINER_CLASS) > -1 || targetClass.indexOf(LIST_CLASS) > -1) {
|
45561 | return;
|
45562 | }
|
45563 | var parentDom = getParentNode(target, ITEM_CLASS);
|
45564 | var domClass = parentDom.className;
|
45565 | var hoveredItem = findItem(items, parentDom.getAttribute('data-value'));
|
45566 | if (hoveredItem && domClass.includes('checked')) {
|
45567 | self.emit('itemhover', {
|
45568 | item: hoveredItem,
|
45569 | currentTarget: parentDom,
|
45570 | checked: hoveredItem.checked
|
45571 | });
|
45572 | } else if (!hoveredItem) {
|
45573 | self.emit('itemunhover', ev);
|
45574 | }
|
45575 | };
|
45576 |
|
45577 | legendWrapper.onmouseout = function (ev) {
|
45578 | self.emit('itemunhover', ev);
|
45579 | };
|
45580 | }
|
45581 |
|
45582 | var container = self.get('container');
|
45583 | if (/^\#/.test(container)) {
|
45584 |
|
45585 | var id = container.replace('#', '');
|
45586 | container = document.getElementById(id);
|
45587 |
|
45588 | container.appendChild(legendWrapper);
|
45589 | } else {
|
45590 | var _position = self.get('position');
|
45591 | var _canvas = self.get('canvas');
|
45592 | var rangeStyle = {};
|
45593 | if (_position === 'left' || _position === 'right') {
|
45594 | rangeStyle = {
|
45595 | maxHeight: (self.get('maxLength') || _canvas.get('height')) + 'px'
|
45596 | };
|
45597 | } else {
|
45598 | rangeStyle = {
|
45599 | maxWidth: (self.get('maxLength') || _canvas.get('width')) + 'px'
|
45600 | };
|
45601 | }
|
45602 |
|
45603 | DomUtil.modifyCSS(legendWrapper, Util.mix({}, LEGEND_STYLE[CONTAINER_CLASS], rangeStyle, self.get(CONTAINER_CLASS)));
|
45604 | outterNode.appendChild(legendWrapper);
|
45605 | }
|
45606 | self.set('legendWrapper', legendWrapper);
|
45607 | };
|
45608 |
|
45609 | Category.prototype._renderItems = function _renderItems() {
|
45610 | var self = this;
|
45611 | var items = self.get('items');
|
45612 | if (self.get('reversed')) {
|
45613 | items.reverse();
|
45614 | }
|
45615 | Util.each(items, function (item, index) {
|
45616 | self._addItem(item, index);
|
45617 | });
|
45618 | };
|
45619 |
|
45620 | Category.prototype._renderBack = function _renderBack() {
|
45621 | var padding = this.get('backPadding');
|
45622 | var backAttrs = this.get('background');
|
45623 | this.renderBack(padding, backAttrs);
|
45624 | };
|
45625 |
|
45626 | Category.prototype._formatItemValue = function _formatItemValue(value) {
|
45627 | var formatter = this.get('itemFormatter');
|
45628 | if (formatter) {
|
45629 | value = formatter.call(this, value);
|
45630 | }
|
45631 | return value;
|
45632 | };
|
45633 |
|
45634 | Category.prototype._getNextX = function _getNextX() {
|
45635 | var layout = this.get('layout');
|
45636 | var itemGap = this.get('itemGap');
|
45637 | var itemsGroup = this.get('itemsGroup');
|
45638 | var itemWidth = this.get('itemWidth');
|
45639 | var children = itemsGroup.get('children');
|
45640 | var nextX = 0;
|
45641 |
|
45642 | if (layout === 'horizontal') {
|
45643 |
|
45644 | Util.each(children, function (v) {
|
45645 | nextX += (itemWidth ? itemWidth : v.getBBox().width) + itemGap;
|
45646 | });
|
45647 | }
|
45648 | return nextX;
|
45649 | };
|
45650 |
|
45651 | Category.prototype._getNextY = function _getNextY() {
|
45652 | var itemMarginBottom = this.get('itemMarginBottom');
|
45653 | var titleGap = this.get('titleShape') ? this.get('titleGap') : 0;
|
45654 | var layout = this.get('layout');
|
45655 | var itemsGroup = this.get('itemsGroup');
|
45656 | var titleShape = this.get('titleShape');
|
45657 | var children = itemsGroup.get('children');
|
45658 | var nextY = titleGap;
|
45659 | if (titleShape) {
|
45660 | nextY += titleShape.getBBox().height;
|
45661 | }
|
45662 |
|
45663 | if (layout === 'vertical') {
|
45664 |
|
45665 | Util.each(children, function (v) {
|
45666 | nextY += v.getBBox().height + itemMarginBottom;
|
45667 | });
|
45668 | }
|
45669 | return nextY;
|
45670 | };
|
45671 |
|
45672 | Category.prototype._addItem = function _addItem(item) {
|
45673 | var itemsGroup = this.get('itemsGroup');
|
45674 | var x = this._getNextX();
|
45675 | var y = this._getNextY();
|
45676 | var unCheckColor = this.get('unCheckColor');
|
45677 | var itemGroup = itemsGroup.addGroup({
|
45678 | x: x,
|
45679 | y: y,
|
45680 | value: item.value,
|
45681 | checked: item.checked
|
45682 | });
|
45683 |
|
45684 | var textStyle = this.get('textStyle');
|
45685 | var wordSpace = this.get('_wordSpaceing');
|
45686 | var startX = 0;
|
45687 |
|
45688 | if (item.marker) {
|
45689 |
|
45690 | var markerAttrs = Util.mix({}, item.marker, {
|
45691 | x: item.marker.radius + x,
|
45692 | y: y
|
45693 | });
|
45694 |
|
45695 | if (!item.checked) {
|
45696 | if (markerAttrs.fill) {
|
45697 | markerAttrs.fill = unCheckColor;
|
45698 | }
|
45699 | if (markerAttrs.stroke) {
|
45700 | markerAttrs.stroke = unCheckColor;
|
45701 | }
|
45702 | }
|
45703 |
|
45704 | var markerShape = itemGroup.addShape('marker', {
|
45705 | type: 'marker',
|
45706 | attrs: markerAttrs
|
45707 | });
|
45708 | markerShape.attr('cursor', 'pointer');
|
45709 | markerShape.name = 'legend-marker';
|
45710 | startX += markerShape.getBBox().width + wordSpace;
|
45711 | }
|
45712 |
|
45713 | var textAttrs = Util.mix({}, textStyle, {
|
45714 | x: startX + x,
|
45715 | y: y,
|
45716 | text: this._formatItemValue(item.value)
|
45717 | });
|
45718 | if (!item.checked) {
|
45719 | Util.mix(textAttrs, {
|
45720 | fill: unCheckColor
|
45721 | });
|
45722 | }
|
45723 |
|
45724 | var textShape = itemGroup.addShape('text', {
|
45725 | attrs: textAttrs
|
45726 | });
|
45727 | textShape.attr('cursor', 'pointer');
|
45728 | textShape.name = 'legend-text';
|
45729 | this.get('appendInfo') && textShape.setSilent('appendInfo', this.get('appendInfo'));
|
45730 |
|
45731 |
|
45732 | var bbox = itemGroup.getBBox();
|
45733 | var itemWidth = this.get('itemWidth');
|
45734 | var wrapperShape = itemGroup.addShape('rect', {
|
45735 | attrs: {
|
45736 | x: x,
|
45737 | y: y - bbox.height / 2,
|
45738 | fill: '#fff',
|
45739 | fillOpacity: 0,
|
45740 | width: itemWidth || bbox.width,
|
45741 | height: bbox.height
|
45742 | }
|
45743 | });
|
45744 | wrapperShape.attr('cursor', 'pointer');
|
45745 | wrapperShape.setSilent('origin', item);
|
45746 | wrapperShape.name = 'legend-item';
|
45747 | this.get('appendInfo') && wrapperShape.setSilent('appendInfo', this.get('appendInfo'));
|
45748 | itemGroup.name = 'legendGroup';
|
45749 | return itemGroup;
|
45750 | };
|
45751 |
|
45752 | Category.prototype._adjustHorizontal = function _adjustHorizontal() {
|
45753 | var itemsGroup = this.get('itemsGroup');
|
45754 | var children = itemsGroup.get('children');
|
45755 | var maxLength = this.get('maxLength');
|
45756 | var itemGap = this.get('itemGap');
|
45757 | var itemMarginBottom = this.get('itemMarginBottom');
|
45758 | var titleGap = this.get('titleShape') ? this.get('titleGap') : 0;
|
45759 | var row = 0;
|
45760 | var rowLength = 0;
|
45761 | var width = void 0;
|
45762 | var height = void 0;
|
45763 | var box = void 0;
|
45764 | var itemWidth = this.get('itemWidth');
|
45765 | if (itemsGroup.getBBox().width > maxLength) {
|
45766 | Util.each(children, function (child) {
|
45767 | box = child.getBBox();
|
45768 | width = itemWidth || box.width;
|
45769 | height = box.height + itemMarginBottom;
|
45770 |
|
45771 | if (maxLength - rowLength < width) {
|
45772 | row++;
|
45773 | rowLength = 0;
|
45774 | }
|
45775 | child.move(rowLength, row * height + titleGap);
|
45776 | rowLength += width + itemGap;
|
45777 | });
|
45778 | }
|
45779 | return;
|
45780 | };
|
45781 |
|
45782 | Category.prototype._adjustVertical = function _adjustVertical() {
|
45783 | var itemsGroup = this.get('itemsGroup');
|
45784 | var titleShape = this.get('titleShape');
|
45785 | var children = itemsGroup.get('children');
|
45786 | var maxLength = this.get('maxLength');
|
45787 | var itemGap = this.get('itemGap');
|
45788 | var itemMarginBottom = this.get('itemMarginBottom');
|
45789 | var titleGap = this.get('titleGap');
|
45790 | var titleHeight = titleShape ? titleShape.getBBox().height + titleGap : 0;
|
45791 | var itemWidth = this.get('itemWidth');
|
45792 | var colLength = titleHeight;
|
45793 | var width = void 0;
|
45794 | var height = void 0;
|
45795 | var box = void 0;
|
45796 | var maxItemWidth = 0;
|
45797 | var totalLength = 0;
|
45798 |
|
45799 | if (itemsGroup.getBBox().height > maxLength) {
|
45800 | Util.each(children, function (v) {
|
45801 | box = v.getBBox();
|
45802 | width = box.width;
|
45803 | height = box.height;
|
45804 |
|
45805 | if (itemWidth) {
|
45806 | maxItemWidth = itemWidth + itemGap;
|
45807 | } else if (width > maxItemWidth) {
|
45808 | maxItemWidth = width + itemGap;
|
45809 | }
|
45810 |
|
45811 | if (maxLength - colLength < height) {
|
45812 | colLength = titleHeight;
|
45813 | totalLength += maxItemWidth;
|
45814 | v.move(totalLength, titleHeight);
|
45815 | } else {
|
45816 | v.move(totalLength, colLength);
|
45817 | }
|
45818 |
|
45819 | colLength += height + itemMarginBottom;
|
45820 | });
|
45821 | }
|
45822 | return;
|
45823 | };
|
45824 |
|
45825 | Category.prototype._adjustItems = function _adjustItems() {
|
45826 | var layout = this.get('layout');
|
45827 | if (layout === 'horizontal') {
|
45828 | this._adjustHorizontal();
|
45829 | } else {
|
45830 | this._adjustVertical();
|
45831 | }
|
45832 | };
|
45833 |
|
45834 | Category.prototype.getWidth = function getWidth() {
|
45835 | if (this.get('useHtml')) {
|
45836 | return DomUtil.getOuterWidth(this.get('legendWrapper'));
|
45837 | }
|
45838 | return _Base.prototype.getWidth.call(this);
|
45839 | };
|
45840 |
|
45841 | Category.prototype.getHeight = function getHeight() {
|
45842 | if (this.get('useHtml')) {
|
45843 | return DomUtil.getOuterHeight(this.get('legendWrapper'));
|
45844 | }
|
45845 |
|
45846 | return _Base.prototype.getHeight.call(this);
|
45847 | };
|
45848 |
|
45849 | Category.prototype.move = function move(x, y) {
|
45850 | if (this.get('useHtml') && !/^\#/.test(this.get('container'))) {
|
45851 | DomUtil.modifyCSS(this.get('legendWrapper'), {
|
45852 | left: x + 'px',
|
45853 | top: y + 'px'
|
45854 | });
|
45855 | } else {
|
45856 | _Base.prototype.move.call(this, x, y);
|
45857 | }
|
45858 | };
|
45859 |
|
45860 | Category.prototype.remove = function remove() {
|
45861 | if (this.get('useHtml')) {
|
45862 |
|
45863 | var legendWrapper = this.get('legendWrapper');
|
45864 | if (legendWrapper && legendWrapper.parentNode) {
|
45865 | legendWrapper.parentNode.removeChild(legendWrapper);
|
45866 | }
|
45867 | }
|
45868 | _Base.prototype.remove.call(this);
|
45869 | };
|
45870 |
|
45871 | return Category;
|
45872 | }(Base);
|
45873 |
|
45874 | module.exports = Category;
|
45875 |
|
45876 | }),
|
45877 |
|
45878 | (function(module, exports, __webpack_require__) {
|
45879 |
|
45880 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
45881 |
|
45882 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
45883 |
|
45884 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
45885 |
|
45886 |
|
45887 |
|
45888 |
|
45889 |
|
45890 | var Util = __webpack_require__(0);
|
45891 | var Continuous = __webpack_require__(123);
|
45892 | var ColorUtil = __webpack_require__(64);
|
45893 |
|
45894 | var Color = function (_Continuous) {
|
45895 | _inherits(Color, _Continuous);
|
45896 |
|
45897 | function Color() {
|
45898 | _classCallCheck(this, Color);
|
45899 |
|
45900 | return _possibleConstructorReturn(this, _Continuous.apply(this, arguments));
|
45901 | }
|
45902 |
|
45903 | Color.prototype.getDefaultCfg = function getDefaultCfg() {
|
45904 | var cfg = _Continuous.prototype.getDefaultCfg.call(this);
|
45905 | return Util.mix({}, cfg, {
|
45906 | |
45907 |
|
45908 |
|
45909 |
|
45910 | type: 'color-legend',
|
45911 | |
45912 |
|
45913 |
|
45914 |
|
45915 |
|
45916 |
|
45917 | layout: 'vertical',
|
45918 | labelOffset: 15,
|
45919 | lineStyle: {
|
45920 | lineWidth: 1,
|
45921 | stroke: '#fff'
|
45922 | }
|
45923 | });
|
45924 | };
|
45925 |
|
45926 | Color.prototype._renderSliderShape = function _renderSliderShape() {
|
45927 | var slider = this.get('slider');
|
45928 | var backgroundElement = slider.get('backgroundElement');
|
45929 | var width = this.get('width');
|
45930 | var height = this.get('height');
|
45931 | var layout = this.get('layout');
|
45932 | var items = this.get('items');
|
45933 | var fill = '';
|
45934 | var rgbColor = void 0;
|
45935 |
|
45936 | if (layout === 'vertical') {
|
45937 | fill += 'l (90) ';
|
45938 | Util.each(items, function (v) {
|
45939 | rgbColor = ColorUtil.toRGB(v.attrValue);
|
45940 | fill += 1 - v.scaleValue + ':' + rgbColor + ' ';
|
45941 | });
|
45942 | } else {
|
45943 | fill += 'l (0) ';
|
45944 | Util.each(items, function (v) {
|
45945 | rgbColor = ColorUtil.toRGB(v.attrValue);
|
45946 | fill += v.scaleValue + ':' + rgbColor + ' ';
|
45947 | });
|
45948 | }
|
45949 | return this._addBackground(backgroundElement, 'Rect', {
|
45950 | x: 0,
|
45951 | y: 0,
|
45952 | width: width,
|
45953 | height: height,
|
45954 | fill: fill,
|
45955 | strokeOpacity: 0
|
45956 | });
|
45957 | };
|
45958 |
|
45959 | Color.prototype._renderBackground = function _renderBackground() {
|
45960 | var self = this;
|
45961 | var titleShape = this.get('titleShape');
|
45962 | var titleGap = this.get('titleGap');
|
45963 | titleGap = titleShape ? titleShape.getBBox().height + titleGap : titleGap;
|
45964 | var width = this.get('width');
|
45965 | var height = this.get('height');
|
45966 | var layout = this.get('layout');
|
45967 | var items = this.get('items');
|
45968 | var fill = '';
|
45969 | var rgbColor = void 0;
|
45970 |
|
45971 | var path = [];
|
45972 | var bgGroup = this.addGroup();
|
45973 |
|
45974 | if (layout === 'vertical') {
|
45975 | fill += 'l (90) ';
|
45976 | Util.each(items, function (v, index) {
|
45977 | if (index !== 0 && index !== items.length - 1) {
|
45978 | path.push(['M', 0, height - v.scaleValue * height]);
|
45979 | path.push(['L', width, height - v.scaleValue * height]);
|
45980 | }
|
45981 |
|
45982 | rgbColor = ColorUtil.toRGB(v.attrValue);
|
45983 | fill += 1 - v.scaleValue + ':' + rgbColor + ' ';
|
45984 | bgGroup.addShape('text', {
|
45985 | attrs: Util.mix({}, {
|
45986 | x: width + self.get('labelOffset') / 2,
|
45987 | y: height - v.scaleValue * height,
|
45988 | text: self._formatItemValue(v.value) + ''
|
45989 | }, self.get('textStyle'), {
|
45990 | textAlign: 'start'
|
45991 | })
|
45992 | });
|
45993 | });
|
45994 | } else {
|
45995 | fill += 'l (0) ';
|
45996 | Util.each(items, function (v, index) {
|
45997 | if (index !== 0 && index !== items.length - 1) {
|
45998 | path.push(['M', v.scaleValue * width, 0]);
|
45999 | path.push(['L', v.scaleValue * width, height]);
|
46000 | }
|
46001 | rgbColor = ColorUtil.toRGB(v.attrValue);
|
46002 | fill += v.scaleValue + ':' + rgbColor + ' ';
|
46003 | bgGroup.addShape('text', {
|
46004 | attrs: Util.mix({}, {
|
46005 | x: v.scaleValue * width,
|
46006 | y: height + self.get('labelOffset'),
|
46007 | text: self._formatItemValue(v.value) + ''
|
46008 | }, self.get('textStyle'))
|
46009 | });
|
46010 | });
|
46011 | }
|
46012 | bgGroup.addShape('rect', {
|
46013 | attrs: {
|
46014 | x: 0,
|
46015 | y: 0,
|
46016 | width: width,
|
46017 | height: height,
|
46018 | fill: fill,
|
46019 | strokeOpacity: 0
|
46020 | }
|
46021 | });
|
46022 |
|
46023 | bgGroup.addShape('path', {
|
46024 | attrs: Util.mix({
|
46025 | path: path
|
46026 | }, this.get('lineStyle'))
|
46027 | });
|
46028 |
|
46029 | bgGroup.move(0, titleGap);
|
46030 | };
|
46031 |
|
46032 | return Color;
|
46033 | }(Continuous);
|
46034 |
|
46035 | module.exports = Color;
|
46036 |
|
46037 | }),
|
46038 |
|
46039 | (function(module, exports, __webpack_require__) {
|
46040 |
|
46041 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
46042 |
|
46043 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
46044 |
|
46045 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
46046 |
|
46047 |
|
46048 |
|
46049 |
|
46050 |
|
46051 | var Util = __webpack_require__(0);
|
46052 |
|
46053 | var _require = __webpack_require__(2),
|
46054 | Group = _require.Group,
|
46055 | DomUtil = _require.DomUtil;
|
46056 |
|
46057 | var Slider = function (_Group) {
|
46058 | _inherits(Slider, _Group);
|
46059 |
|
46060 | function Slider() {
|
46061 | _classCallCheck(this, Slider);
|
46062 |
|
46063 | return _possibleConstructorReturn(this, _Group.apply(this, arguments));
|
46064 | }
|
46065 |
|
46066 | Slider.prototype.getDefaultCfg = function getDefaultCfg() {
|
46067 | return {
|
46068 | |
46069 |
|
46070 |
|
46071 |
|
46072 | range: null,
|
46073 | |
46074 |
|
46075 |
|
46076 |
|
46077 | middleAttr: null,
|
46078 | |
46079 |
|
46080 |
|
46081 |
|
46082 | backgroundElement: null,
|
46083 | |
46084 |
|
46085 |
|
46086 |
|
46087 | minHandleElement: null,
|
46088 | |
46089 |
|
46090 |
|
46091 |
|
46092 | maxHandleElement: null,
|
46093 | |
46094 |
|
46095 |
|
46096 |
|
46097 | middleHandleElement: null,
|
46098 | |
46099 |
|
46100 |
|
46101 |
|
46102 | currentTarget: null,
|
46103 | |
46104 |
|
46105 |
|
46106 |
|
46107 | layout: 'vertical',
|
46108 | |
46109 |
|
46110 |
|
46111 |
|
46112 | width: null,
|
46113 | |
46114 |
|
46115 |
|
46116 |
|
46117 | height: null,
|
46118 | |
46119 |
|
46120 |
|
46121 |
|
46122 | pageX: null,
|
46123 | |
46124 |
|
46125 |
|
46126 |
|
46127 | pageY: null
|
46128 | };
|
46129 | };
|
46130 |
|
46131 | Slider.prototype._beforeRenderUI = function _beforeRenderUI() {
|
46132 | var layout = this.get('layout');
|
46133 | var backgroundElement = this.get('backgroundElement');
|
46134 | var minHandleElement = this.get('minHandleElement');
|
46135 | var maxHandleElement = this.get('maxHandleElement');
|
46136 | var middleHandleElement = this.addShape('rect', {
|
46137 | attrs: this.get('middleAttr')
|
46138 | });
|
46139 | var trigerCursor = layout === 'vertical' ? 'ns-resize' : 'ew-resize';
|
46140 |
|
46141 | this.add([backgroundElement, minHandleElement, maxHandleElement]);
|
46142 | this.set('middleHandleElement', middleHandleElement);
|
46143 | backgroundElement.set('zIndex', 0);
|
46144 | middleHandleElement.set('zIndex', 1);
|
46145 | minHandleElement.set('zIndex', 2);
|
46146 | maxHandleElement.set('zIndex', 2);
|
46147 | middleHandleElement.attr('cursor', 'move');
|
46148 | minHandleElement.attr('cursor', trigerCursor);
|
46149 | maxHandleElement.attr('cursor', trigerCursor);
|
46150 | this.sort();
|
46151 | };
|
46152 |
|
46153 | Slider.prototype._renderUI = function _renderUI() {
|
46154 | if (this.get('layout') === 'horizontal') {
|
46155 | this._renderHorizontal();
|
46156 | } else {
|
46157 | this._renderVertical();
|
46158 | }
|
46159 | };
|
46160 |
|
46161 | Slider.prototype._transform = function _transform(layout) {
|
46162 | var range = this.get('range');
|
46163 | var minRatio = range[0] / 100;
|
46164 | var maxRatio = range[1] / 100;
|
46165 | var width = this.get('width');
|
46166 | var height = this.get('height');
|
46167 | var minHandleElement = this.get('minHandleElement');
|
46168 | var maxHandleElement = this.get('maxHandleElement');
|
46169 | var middleHandleElement = this.get('middleHandleElement');
|
46170 |
|
46171 | minHandleElement.initTransform();
|
46172 | maxHandleElement.initTransform();
|
46173 |
|
46174 | if (layout === 'horizontal') {
|
46175 | middleHandleElement.attr({
|
46176 | x: width * minRatio,
|
46177 | y: 0,
|
46178 | width: (maxRatio - minRatio) * width,
|
46179 | height: height
|
46180 | });
|
46181 | minHandleElement.translate(minRatio * width, height);
|
46182 | maxHandleElement.translate(maxRatio * width, height);
|
46183 | } else {
|
46184 | middleHandleElement.attr({
|
46185 | x: 0,
|
46186 | y: height * (1 - maxRatio),
|
46187 | width: width,
|
46188 | height: (maxRatio - minRatio) * height
|
46189 | });
|
46190 | minHandleElement.translate(width / 2, (1 - minRatio) * height);
|
46191 | maxHandleElement.translate(width / 2, (1 - maxRatio) * height);
|
46192 | }
|
46193 | };
|
46194 |
|
46195 | Slider.prototype._renderHorizontal = function _renderHorizontal() {
|
46196 | this._transform('horizontal');
|
46197 | };
|
46198 |
|
46199 | Slider.prototype._renderVertical = function _renderVertical() {
|
46200 | this._transform('vertical');
|
46201 | };
|
46202 |
|
46203 | Slider.prototype._bindUI = function _bindUI() {
|
46204 | this.on('mousedown', Util.wrapBehavior(this, '_onMouseDown'));
|
46205 | };
|
46206 |
|
46207 | Slider.prototype._isElement = function _isElement(target, name) {
|
46208 |
|
46209 | var element = this.get(name);
|
46210 | if (target === element) {
|
46211 | return true;
|
46212 | }
|
46213 | if (element.isGroup) {
|
46214 | var elementChildren = element.get('children');
|
46215 | return elementChildren.indexOf(target) > -1;
|
46216 | }
|
46217 | return false;
|
46218 | };
|
46219 |
|
46220 | Slider.prototype._getRange = function _getRange(diff, range) {
|
46221 | var rst = diff + range;
|
46222 | rst = rst > 100 ? 100 : rst;
|
46223 | rst = rst < 0 ? 0 : rst;
|
46224 | return rst;
|
46225 | };
|
46226 |
|
46227 | Slider.prototype._updateStatus = function _updateStatus(dim, ev) {
|
46228 | var totalLength = dim === 'x' ? this.get('width') : this.get('height');
|
46229 | dim = Util.upperFirst(dim);
|
46230 | var range = this.get('range');
|
46231 | var page = this.get('page' + dim);
|
46232 | var currentTarget = this.get('currentTarget');
|
46233 | var rangeStash = this.get('rangeStash');
|
46234 | var layout = this.get('layout');
|
46235 | var sign = layout === 'vertical' ? -1 : 1;
|
46236 | var currentPage = ev['page' + dim];
|
46237 | var diffPage = currentPage - page;
|
46238 | var diffRange = diffPage / totalLength * 100 * sign;
|
46239 | var diffStashRange = void 0;
|
46240 |
|
46241 | if (range[1] <= range[0]) {
|
46242 | if (this._isElement(currentTarget, 'minHandleElement') || this._isElement(currentTarget, 'maxHandleElement')) {
|
46243 | range[0] = this._getRange(diffRange, range[0]);
|
46244 | range[1] = this._getRange(diffRange, range[0]);
|
46245 | }
|
46246 | } else {
|
46247 | if (this._isElement(currentTarget, 'minHandleElement')) {
|
46248 | range[0] = this._getRange(diffRange, range[0]);
|
46249 | }
|
46250 | if (this._isElement(currentTarget, 'maxHandleElement')) {
|
46251 | range[1] = this._getRange(diffRange, range[1]);
|
46252 | }
|
46253 | }
|
46254 |
|
46255 | if (this._isElement(currentTarget, 'middleHandleElement')) {
|
46256 | diffStashRange = rangeStash[1] - rangeStash[0];
|
46257 | range[0] = this._getRange(diffRange, range[0]);
|
46258 | range[1] = range[0] + diffStashRange;
|
46259 | if (range[1] > 100) {
|
46260 | range[1] = 100;
|
46261 | range[0] = range[1] - diffStashRange;
|
46262 | }
|
46263 | }
|
46264 |
|
46265 | this.emit('sliderchange', {
|
46266 | range: range
|
46267 | });
|
46268 |
|
46269 | this.set('page' + dim, currentPage);
|
46270 | this._renderUI();
|
46271 | this.get('canvas').draw();
|
46272 | return;
|
46273 | };
|
46274 |
|
46275 | Slider.prototype._onMouseDown = function _onMouseDown(ev) {
|
46276 | var currentTarget = ev.currentTarget;
|
46277 | var originEvent = ev.event;
|
46278 | var range = this.get('range');
|
46279 | originEvent.stopPropagation();
|
46280 | originEvent.preventDefault();
|
46281 | this.set('pageX', originEvent.pageX);
|
46282 | this.set('pageY', originEvent.pageY);
|
46283 | this.set('currentTarget', currentTarget);
|
46284 | this.set('rangeStash', [range[0], range[1]]);
|
46285 | this._bindCanvasEvents();
|
46286 | };
|
46287 |
|
46288 | Slider.prototype._bindCanvasEvents = function _bindCanvasEvents() {
|
46289 | var containerDOM = this.get('canvas').get('containerDOM');
|
46290 | this.onMouseMoveListener = DomUtil.addEventListener(containerDOM, 'mousemove', Util.wrapBehavior(this, '_onCanvasMouseMove'));
|
46291 | this.onMouseUpListener = DomUtil.addEventListener(containerDOM, 'mouseup', Util.wrapBehavior(this, '_onCanvasMouseUp'));
|
46292 | };
|
46293 |
|
46294 | Slider.prototype._onCanvasMouseMove = function _onCanvasMouseMove(ev) {
|
46295 | var layout = this.get('layout');
|
46296 | if (layout === 'horizontal') {
|
46297 | this._updateStatus('x', ev);
|
46298 | } else {
|
46299 | this._updateStatus('y', ev);
|
46300 | }
|
46301 | };
|
46302 |
|
46303 | Slider.prototype._onCanvasMouseUp = function _onCanvasMouseUp() {
|
46304 | this._removeDocumentEvents();
|
46305 | };
|
46306 |
|
46307 | Slider.prototype._removeDocumentEvents = function _removeDocumentEvents() {
|
46308 | this.onMouseMoveListener.remove();
|
46309 | this.onMouseUpListener.remove();
|
46310 | };
|
46311 |
|
46312 | return Slider;
|
46313 | }(Group);
|
46314 |
|
46315 | module.exports = Slider;
|
46316 |
|
46317 | }),
|
46318 |
|
46319 | (function(module, exports, __webpack_require__) {
|
46320 |
|
46321 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
46322 |
|
46323 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
46324 |
|
46325 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
46326 |
|
46327 |
|
46328 |
|
46329 |
|
46330 |
|
46331 | var Util = __webpack_require__(0);
|
46332 | var Global = __webpack_require__(1);
|
46333 | var Continuous = __webpack_require__(123);
|
46334 | var CIRCLE_GAP = 8;
|
46335 |
|
46336 | var Size = function (_Continuous) {
|
46337 | _inherits(Size, _Continuous);
|
46338 |
|
46339 | function Size() {
|
46340 | _classCallCheck(this, Size);
|
46341 |
|
46342 | return _possibleConstructorReturn(this, _Continuous.apply(this, arguments));
|
46343 | }
|
46344 |
|
46345 | Size.prototype.getDefaultCfg = function getDefaultCfg() {
|
46346 | var cfg = _Continuous.prototype.getDefaultCfg.call(this);
|
46347 | return Util.mix({}, cfg, {
|
46348 | |
46349 |
|
46350 |
|
46351 |
|
46352 | type: 'size-legend',
|
46353 | width: 100,
|
46354 | height: 200,
|
46355 | _circleStyle: {
|
46356 | stroke: '#4E7CCC',
|
46357 | fill: '#fff',
|
46358 | fillOpacity: 0
|
46359 | },
|
46360 | textStyle: {
|
46361 | fill: '#333',
|
46362 | textAlign: 'start',
|
46363 | textBaseline: 'middle',
|
46364 | fontFamily: Global.fontFamily
|
46365 | }
|
46366 | });
|
46367 | };
|
46368 |
|
46369 | Size.prototype._renderSliderShape = function _renderSliderShape() {
|
46370 | var slider = this.get('slider');
|
46371 | var backgroundElement = slider.get('backgroundElement');
|
46372 | var width = this.get('width');
|
46373 | var height = this.get('height');
|
46374 | var inRange = this.get('inRange');
|
46375 | var layout = this.get('layout');
|
46376 | var points = layout === 'vertical' ? [[0, 0], [width, 0], [width, height]] : [[0, height], [width, 0], [width, height]];
|
46377 |
|
46378 | return this._addBackground(backgroundElement, 'Polygon', Util.mix({
|
46379 | points: points
|
46380 | }, inRange));
|
46381 | };
|
46382 |
|
46383 | Size.prototype._addCircle = function _addCircle(x, y, r, text, maxWidth) {
|
46384 | var group = this.addGroup();
|
46385 | var circleStyle = this.get('_circleStyle');
|
46386 | var textStyle = this.get('textStyle');
|
46387 | var titleShape = this.get('titleShape');
|
46388 | var titleGap = this.get('titleGap');
|
46389 | if (titleShape) {
|
46390 | titleGap += titleShape.getBBox().height;
|
46391 | }
|
46392 |
|
46393 | group.addShape('circle', {
|
46394 | attrs: Util.mix({
|
46395 | x: x,
|
46396 | y: y + titleGap,
|
46397 | r: r === 0 ? 1 : r
|
46398 | }, circleStyle)
|
46399 | });
|
46400 | group.addShape('text', {
|
46401 | attrs: Util.mix({
|
46402 | x: maxWidth + 5,
|
46403 | y: y + titleGap,
|
46404 | text: text === 0 ? '0' : text
|
46405 | }, textStyle)
|
46406 | });
|
46407 | };
|
46408 |
|
46409 | Size.prototype._renderBackground = function _renderBackground() {
|
46410 | var self = this;
|
46411 | var minRadius = this.get('firstItem').attrValue * 1;
|
46412 | var maxRadius = this.get('lastItem').attrValue * 1;
|
46413 | var medianRadius = (minRadius + maxRadius) / 2;
|
46414 | self._addCircle(maxRadius, maxRadius, maxRadius, medianRadius, 2 * maxRadius);
|
46415 | self._addCircle(maxRadius, maxRadius * 2 + CIRCLE_GAP + medianRadius, medianRadius, (minRadius + medianRadius) / 2, 2 * maxRadius);
|
46416 | self._addCircle(maxRadius, (maxRadius + CIRCLE_GAP + medianRadius) * 2 + minRadius, minRadius, minRadius, 2 * maxRadius);
|
46417 | };
|
46418 |
|
46419 | return Size;
|
46420 | }(Continuous);
|
46421 |
|
46422 | module.exports = Size;
|
46423 |
|
46424 | }),
|
46425 |
|
46426 | (function(module, exports, __webpack_require__) {
|
46427 |
|
46428 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
46429 |
|
46430 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
46431 |
|
46432 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
46433 |
|
46434 |
|
46435 |
|
46436 |
|
46437 |
|
46438 | var Util = __webpack_require__(0);
|
46439 |
|
46440 | var _require = __webpack_require__(2),
|
46441 | Group = _require.Group;
|
46442 |
|
46443 | var PlotBack = function (_Group) {
|
46444 | _inherits(PlotBack, _Group);
|
46445 |
|
46446 | function PlotBack() {
|
46447 | _classCallCheck(this, PlotBack);
|
46448 |
|
46449 | return _possibleConstructorReturn(this, _Group.apply(this, arguments));
|
46450 | }
|
46451 |
|
46452 | PlotBack.prototype.getDefaultCfg = function getDefaultCfg() {
|
46453 | return {
|
46454 | |
46455 |
|
46456 |
|
46457 |
|
46458 | type: 'plotBack',
|
46459 | |
46460 |
|
46461 |
|
46462 |
|
46463 | padding: null,
|
46464 | |
46465 |
|
46466 |
|
46467 |
|
46468 | background: null,
|
46469 | |
46470 |
|
46471 |
|
46472 |
|
46473 | plotRange: null,
|
46474 | |
46475 |
|
46476 |
|
46477 |
|
46478 | plotBackground: null
|
46479 | };
|
46480 | };
|
46481 |
|
46482 | PlotBack.prototype._beforeRenderUI = function _beforeRenderUI() {
|
46483 | this._calculateRange();
|
46484 | };
|
46485 |
|
46486 | PlotBack.prototype._renderUI = function _renderUI() {
|
46487 | this._renderBackground();
|
46488 | this._renderPlotBackground();
|
46489 | };
|
46490 |
|
46491 | PlotBack.prototype._renderBackground = function _renderBackground() {
|
46492 | var self = this;
|
46493 | var background = self.get('background');
|
46494 | if (background) {
|
46495 | var canvas = this.get('canvas');
|
46496 | var width = self.get('width') || canvas.get('width');
|
46497 | var height = self.get('height') || canvas.get('height');
|
46498 | var cfg = {
|
46499 | x: 0,
|
46500 | y: 0,
|
46501 | width: width,
|
46502 | height: height
|
46503 | };
|
46504 |
|
46505 | var rect = self.get('backgroundShape');
|
46506 | if (!rect) {
|
46507 | rect = this.addShape('rect', {
|
46508 | attrs: Util.mix(cfg, background)
|
46509 | });
|
46510 | this.set('backgroundShape', rect);
|
46511 | } else {
|
46512 | rect.attr(cfg);
|
46513 | }
|
46514 | } else {
|
46515 | return;
|
46516 | }
|
46517 | };
|
46518 |
|
46519 | PlotBack.prototype._renderPlotBackground = function _renderPlotBackground() {
|
46520 | var self = this;
|
46521 | var plotBackground = self.get('plotBackground');
|
46522 | if (plotBackground) {
|
46523 | var plotRange = self.get('plotRange');
|
46524 | var width = plotRange.br.x - plotRange.bl.x;
|
46525 | var height = plotRange.br.y - plotRange.tr.y;
|
46526 | var tl = plotRange.tl;
|
46527 | var cfg = {
|
46528 | x: tl.x,
|
46529 | y: tl.y,
|
46530 | width: width,
|
46531 | height: height
|
46532 | };
|
46533 | var plotBackShape = self.get('plotBackShape');
|
46534 | if (!plotBackShape) {
|
46535 | if (plotBackground.image) {
|
46536 | cfg.img = plotBackground.image;
|
46537 | plotBackShape = self.addShape('image', {
|
46538 | attrs: cfg
|
46539 | });
|
46540 | } else {
|
46541 |
|
46542 | Util.mix(cfg, plotBackground);
|
46543 | plotBackShape = self.addShape('rect', {
|
46544 | attrs: cfg
|
46545 | });
|
46546 | }
|
46547 | self.set('plotBackShape', plotBackShape);
|
46548 | } else {
|
46549 | plotBackShape.attr(cfg);
|
46550 | }
|
46551 | } else {
|
46552 | return;
|
46553 | }
|
46554 | };
|
46555 |
|
46556 | PlotBack.prototype._convert = function _convert(val, isHorizontal) {
|
46557 | if (Util.isString(val) && val.indexOf('%') !== -1) {
|
46558 | var canvas = this.get('canvas');
|
46559 | var width = this.get('width') || canvas.get('width');
|
46560 | var height = this.get('height') || canvas.get('height');
|
46561 | val = parseInt(val, 10) / 100;
|
46562 | val = isHorizontal ? val * width : val * height;
|
46563 | }
|
46564 |
|
46565 | return val;
|
46566 | };
|
46567 |
|
46568 | PlotBack.prototype._calculateRange = function _calculateRange() {
|
46569 | var self = this;
|
46570 | var plotRange = self.get('plotRange');
|
46571 | if (Util.isNil(plotRange)) {
|
46572 | plotRange = {};
|
46573 | }
|
46574 |
|
46575 | var padding = self.get('padding');
|
46576 | var canvas = this.get('canvas');
|
46577 | var width = self.get('width') || canvas.get('width');
|
46578 | var height = self.get('height') || canvas.get('height');
|
46579 |
|
46580 | var allPadding = Util.toAllPadding(padding);
|
46581 |
|
46582 | var top = self._convert(allPadding[0], false);
|
46583 | var right = self._convert(allPadding[1], true);
|
46584 | var bottom = self._convert(allPadding[2], false);
|
46585 | var left = self._convert(allPadding[3], true);
|
46586 |
|
46587 | var minX = Math.min(left, width - right);
|
46588 | var maxX = Math.max(left, width - right);
|
46589 | var minY = Math.min(height - bottom, top);
|
46590 | var maxY = Math.max(height - bottom, top);
|
46591 |
|
46592 | plotRange.tl = {
|
46593 | x: minX,
|
46594 | y: minY
|
46595 | };
|
46596 |
|
46597 | plotRange.tr = {
|
46598 | x: maxX,
|
46599 | y: minY
|
46600 | };
|
46601 |
|
46602 | plotRange.bl = {
|
46603 | x: minX,
|
46604 | y: maxY
|
46605 | };
|
46606 |
|
46607 | plotRange.br = {
|
46608 | x: maxX,
|
46609 | y: maxY
|
46610 | };
|
46611 |
|
46612 | plotRange.cc = {
|
46613 | x: (maxX + minX) / 2,
|
46614 | y: (maxY + minY) / 2
|
46615 | };
|
46616 |
|
46617 | this.set('plotRange', plotRange);
|
46618 | };
|
46619 |
|
46620 | PlotBack.prototype.repaint = function repaint() {
|
46621 | this._calculateRange();
|
46622 | this._renderBackground();
|
46623 | this._renderPlotBackground();
|
46624 | return this;
|
46625 | };
|
46626 |
|
46627 | return PlotBack;
|
46628 | }(Group);
|
46629 |
|
46630 | module.exports = PlotBack;
|
46631 |
|
46632 | }),
|
46633 |
|
46634 | (function(module, exports, __webpack_require__) {
|
46635 |
|
46636 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
46637 |
|
46638 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
46639 |
|
46640 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
46641 |
|
46642 |
|
46643 |
|
46644 |
|
46645 |
|
46646 | var Util = __webpack_require__(0);
|
46647 | var Base = __webpack_require__(63);
|
46648 | var Global = __webpack_require__(1);
|
46649 |
|
46650 | var _require = __webpack_require__(2),
|
46651 | DomUtil = _require.DomUtil;
|
46652 |
|
46653 | var CONTAINER_CLASS = 'g2-tooltip';
|
46654 | var TITLE_CLASS = 'g2-tooltip-title';
|
46655 | var LIST_CLASS = 'g2-tooltip-list';
|
46656 | var MARKER_CLASS = 'g2-tooltip-marker';
|
46657 | var LIST_ITEM_CLASS = 'g2-tooltip-list-item';
|
46658 |
|
46659 | function find(dom, cls) {
|
46660 | return dom.getElementsByClassName(cls)[0];
|
46661 | }
|
46662 |
|
46663 | function refixTooltipPosition(x, y, el, viewWidth, viewHeight) {
|
46664 | var width = el.clientWidth;
|
46665 | var height = el.clientHeight;
|
46666 | var gap = 20;
|
46667 |
|
46668 | if (x + width + gap > viewWidth) {
|
46669 | x -= width + gap;
|
46670 | x = x < 0 ? 0 : x;
|
46671 | } else {
|
46672 | x += gap;
|
46673 | }
|
46674 | if (y + height + gap > viewHeight) {
|
46675 | y -= height + gap;
|
46676 | y = x < 0 ? 0 : y;
|
46677 | } else {
|
46678 | y += gap;
|
46679 | }
|
46680 | return [x, y];
|
46681 | }
|
46682 |
|
46683 | function calcTooltipPosition(x, y, position, dom, target) {
|
46684 | var domWidth = dom.clientWidth;
|
46685 | var domHeight = dom.clientHeight;
|
46686 | var rectWidth = 0;
|
46687 | var rectHeight = 0;
|
46688 | var gap = 20;
|
46689 |
|
46690 | if (target) {
|
46691 | var rect = target.getBBox();
|
46692 | rectWidth = rect.width;
|
46693 | rectHeight = rect.height;
|
46694 | x = rect.x;
|
46695 | y = rect.y;
|
46696 | gap = 5;
|
46697 | }
|
46698 | switch (position) {
|
46699 | case 'inside':
|
46700 | x = x + rectWidth / 2 - domWidth / 2;
|
46701 | y = y + rectHeight / 2 - domHeight / 2;
|
46702 | break;
|
46703 | case 'top':
|
46704 | x = x + rectWidth / 2 - domWidth / 2;
|
46705 | y = y - domHeight - gap;
|
46706 | break;
|
46707 | case 'left':
|
46708 | x = x - domWidth - gap;
|
46709 | y = y + rectHeight / 2 - domHeight / 2;
|
46710 | break;
|
46711 | case 'right':
|
46712 | x = x + rectWidth + gap;
|
46713 | y = y + rectHeight / 2 - domHeight / 2;
|
46714 | break;
|
46715 | case 'bottom':
|
46716 | default:
|
46717 | x = x + rectWidth / 2 - domWidth / 2;
|
46718 | y = y + rectHeight + gap;
|
46719 | break;
|
46720 | }
|
46721 | return [x, y];
|
46722 | }
|
46723 |
|
46724 | function confineTooltipPosition(x, y, el, plotRange) {
|
46725 | var gap = 20;
|
46726 | var width = el.clientWidth;
|
46727 | var height = el.clientHeight;
|
46728 | if (x + width > plotRange.tr.x) {
|
46729 | x -= width + 2 * gap;
|
46730 | }
|
46731 |
|
46732 | if (x < plotRange.tl.x) {
|
46733 | x = plotRange.tl.x;
|
46734 | }
|
46735 |
|
46736 | if (y + height > plotRange.bl.y) {
|
46737 | y -= height + 2 * gap;
|
46738 | }
|
46739 |
|
46740 | if (y < plotRange.tl.y) {
|
46741 | y = plotRange.tl.y;
|
46742 | }
|
46743 |
|
46744 | return [x, y];
|
46745 | }
|
46746 |
|
46747 | var Tooltip = function (_Base) {
|
46748 | _inherits(Tooltip, _Base);
|
46749 |
|
46750 | Tooltip.prototype.getDefaultCfg = function getDefaultCfg() {
|
46751 | return {
|
46752 | |
46753 |
|
46754 |
|
46755 |
|
46756 | x: 0,
|
46757 | |
46758 |
|
46759 |
|
46760 |
|
46761 | y: 0,
|
46762 | |
46763 |
|
46764 |
|
46765 |
|
46766 | items: null,
|
46767 | |
46768 |
|
46769 |
|
46770 |
|
46771 | showTitle: true,
|
46772 | |
46773 |
|
46774 |
|
46775 |
|
46776 | crosshairs: null,
|
46777 | |
46778 |
|
46779 |
|
46780 |
|
46781 | plotRange: null,
|
46782 | |
46783 |
|
46784 |
|
46785 |
|
46786 | offset: 10,
|
46787 | |
46788 |
|
46789 |
|
46790 |
|
46791 | timeStamp: 0,
|
46792 | |
46793 |
|
46794 |
|
46795 |
|
46796 | containerTpl: '<div class="' + CONTAINER_CLASS + '">' + '<div class="' + TITLE_CLASS + '"></div>' + '<ul class="' + LIST_CLASS + '"></ul>' + '</div>',
|
46797 | |
46798 |
|
46799 |
|
46800 |
|
46801 | itemTpl: '<li data-index={index}>' + '<span style="background-color:{color};" class=' + MARKER_CLASS + '></span>' + '{name}: {value}</li>',
|
46802 | |
46803 |
|
46804 |
|
46805 |
|
46806 | inPlot: true,
|
46807 | |
46808 |
|
46809 |
|
46810 |
|
46811 | follow: true,
|
46812 | |
46813 |
|
46814 |
|
46815 |
|
46816 | enterable: false
|
46817 | };
|
46818 | };
|
46819 |
|
46820 | Tooltip.prototype._initTooltipWrapper = function _initTooltipWrapper() {
|
46821 | var self = this;
|
46822 | var containerTpl = self.get('containerTpl');
|
46823 | var outterNode = self.get('canvas').get('el').parentNode;
|
46824 | var container = void 0;
|
46825 | if (/^\#/.test(containerTpl)) {
|
46826 |
|
46827 | var id = containerTpl.replace('#', '');
|
46828 | container = document.getElementById(id);
|
46829 | } else {
|
46830 | container = DomUtil.createDom(containerTpl);
|
46831 | DomUtil.modifyCSS(container, self.get(CONTAINER_CLASS));
|
46832 | outterNode.appendChild(container);
|
46833 | outterNode.style.position = 'relative';
|
46834 | }
|
46835 | self.set('container', container);
|
46836 | };
|
46837 |
|
46838 | Tooltip.prototype._init = function _init() {
|
46839 | var crosshairs = this.get('crosshairs');
|
46840 | var frontPlot = this.get('frontPlot');
|
46841 | var backPlot = this.get('backPlot');
|
46842 | var crosshairsGroup = void 0;
|
46843 |
|
46844 | if (crosshairs) {
|
46845 | if (crosshairs.type === 'rect') {
|
46846 | this.set('crosshairs', Util.deepMix({}, Global.tooltipCrosshairsRect, crosshairs));
|
46847 | crosshairsGroup = backPlot.addGroup({
|
46848 | zIndex: 0
|
46849 | });
|
46850 | } else {
|
46851 | this.set('crosshairs', Util.deepMix({}, Global.tooltipCrosshairsLine, crosshairs));
|
46852 | crosshairsGroup = frontPlot.addGroup();
|
46853 | }
|
46854 | }
|
46855 |
|
46856 | this.set('crosshairsGroup', crosshairsGroup);
|
46857 | this._initTooltipWrapper();
|
46858 | };
|
46859 |
|
46860 | function Tooltip(cfg) {
|
46861 | _classCallCheck(this, Tooltip);
|
46862 |
|
46863 | var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
|
46864 |
|
46865 | _this._init();
|
46866 |
|
46867 | if (_this.get('items')) {
|
46868 | _this._renderTooltip();
|
46869 | }
|
46870 | _this._renderCrosshairs();
|
46871 | return _this;
|
46872 | }
|
46873 |
|
46874 | Tooltip.prototype._clearDom = function _clearDom() {
|
46875 | var container = this.get('container');
|
46876 | var titleDom = find(container, TITLE_CLASS);
|
46877 | var listDom = find(container, LIST_CLASS);
|
46878 | if (titleDom) {
|
46879 | titleDom.innerHTML = '';
|
46880 | }
|
46881 | if (listDom) {
|
46882 | listDom.innerHTML = '';
|
46883 | }
|
46884 | };
|
46885 |
|
46886 | Tooltip.prototype._addItem = function _addItem(item, index) {
|
46887 | var itemTpl = this.get('itemTpl');
|
46888 |
|
46889 | var itemDiv = Util.substitute(itemTpl, Util.mix({
|
46890 | index: index
|
46891 | }, item));
|
46892 |
|
46893 | var itemDOM = DomUtil.createDom(itemDiv);
|
46894 | DomUtil.modifyCSS(itemDOM, this.get(LIST_ITEM_CLASS));
|
46895 | var markerDom = find(itemDOM, MARKER_CLASS);
|
46896 | if (markerDom) {
|
46897 | DomUtil.modifyCSS(markerDom, this.get(MARKER_CLASS));
|
46898 | }
|
46899 |
|
46900 | return itemDOM;
|
46901 | };
|
46902 |
|
46903 | Tooltip.prototype._renderTooltip = function _renderTooltip() {
|
46904 | var self = this;
|
46905 | var showTitle = self.get('showTitle');
|
46906 | var titleContent = self.get('titleContent');
|
46907 | var container = self.get('container');
|
46908 | var titleDom = find(container, TITLE_CLASS);
|
46909 | var listDom = find(container, LIST_CLASS);
|
46910 | var items = self.get('items');
|
46911 | self._clearDom();
|
46912 |
|
46913 | if (titleDom && showTitle) {
|
46914 | DomUtil.modifyCSS(titleDom, self.get(TITLE_CLASS));
|
46915 | titleDom.innerHTML = titleContent;
|
46916 | }
|
46917 |
|
46918 | if (listDom) {
|
46919 | DomUtil.modifyCSS(listDom, self.get(LIST_CLASS));
|
46920 | Util.each(items, function (item, index) {
|
46921 | listDom.appendChild(self._addItem(item, index));
|
46922 | });
|
46923 | }
|
46924 | };
|
46925 |
|
46926 | Tooltip.prototype._clearCrosshairsGroup = function _clearCrosshairsGroup() {
|
46927 | var crosshairsGroup = this.get('crosshairsGroup');
|
46928 | this.set('crossLineShapeX', null);
|
46929 | this.set('crossLineShapeY', null);
|
46930 | this.set('crosshairsRectShape', null);
|
46931 | crosshairsGroup.clear();
|
46932 | };
|
46933 |
|
46934 | Tooltip.prototype._renderCrosshairs = function _renderCrosshairs() {
|
46935 | var crosshairs = this.get('crosshairs');
|
46936 | var canvas = this.get('canvas');
|
46937 | var plotRange = this.get('plotRange');
|
46938 | var isTransposed = this.get('isTransposed');
|
46939 | if (crosshairs) {
|
46940 | this._clearCrosshairsGroup();
|
46941 | switch (crosshairs.type) {
|
46942 | case 'x':
|
46943 | this._renderHorizontalLine(canvas, plotRange);
|
46944 | break;
|
46945 | case 'y':
|
46946 | this._renderVerticalLine(canvas, plotRange);
|
46947 | break;
|
46948 | case 'cross':
|
46949 | this._renderHorizontalLine(canvas, plotRange);
|
46950 | this._renderVerticalLine(canvas, plotRange);
|
46951 | break;
|
46952 | case 'rect':
|
46953 | this._renderBackground(canvas, plotRange);
|
46954 | break;
|
46955 | default:
|
46956 | isTransposed ? this._renderHorizontalLine(canvas, plotRange) : this._renderVerticalLine(canvas, plotRange);
|
46957 | }
|
46958 | }
|
46959 | };
|
46960 |
|
46961 | Tooltip.prototype._addCrossLineShape = function _addCrossLineShape(attrs, type) {
|
46962 | var crosshairsGroup = this.get('crosshairsGroup');
|
46963 | var shape = crosshairsGroup.addShape('line', {
|
46964 | attrs: attrs
|
46965 | });
|
46966 | shape.hide();
|
46967 | this.set('crossLineShape' + type, shape);
|
46968 | return shape;
|
46969 | };
|
46970 |
|
46971 | Tooltip.prototype._renderVerticalLine = function _renderVerticalLine(canvas, plotRange) {
|
46972 | var _get = this.get('crosshairs'),
|
46973 | style = _get.style;
|
46974 |
|
46975 | var attrs = Util.mix({
|
46976 | x1: 0,
|
46977 | y1: plotRange ? plotRange.bl.y : canvas.get('height'),
|
46978 | x2: 0,
|
46979 | y2: plotRange ? plotRange.tl.y : 0
|
46980 | }, style);
|
46981 |
|
46982 | this._addCrossLineShape(attrs, 'Y');
|
46983 | };
|
46984 |
|
46985 | Tooltip.prototype._renderHorizontalLine = function _renderHorizontalLine(canvas, plotRange) {
|
46986 | var _get2 = this.get('crosshairs'),
|
46987 | style = _get2.style;
|
46988 |
|
46989 | var attrs = Util.mix({
|
46990 | x1: plotRange ? plotRange.bl.x : canvas.get('width'),
|
46991 | y1: 0,
|
46992 | x2: plotRange ? plotRange.br.x : 0,
|
46993 | y2: 0
|
46994 | }, style);
|
46995 |
|
46996 | this._addCrossLineShape(attrs, 'X');
|
46997 | };
|
46998 |
|
46999 | Tooltip.prototype._renderBackground = function _renderBackground(canvas, plotRange) {
|
47000 | var _get3 = this.get('crosshairs'),
|
47001 | style = _get3.style;
|
47002 |
|
47003 | var crosshairsGroup = this.get('crosshairsGroup');
|
47004 | var attrs = Util.mix({
|
47005 | x: plotRange ? plotRange.tl.x : 0,
|
47006 | y: plotRange ? plotRange.tl.y : canvas.get('height'),
|
47007 | width: plotRange ? plotRange.br.x - plotRange.bl.x : canvas.get('width'),
|
47008 | height: plotRange ? Math.abs(plotRange.tl.y - plotRange.bl.y) : canvas.get('height')
|
47009 | }, style);
|
47010 |
|
47011 | var shape = crosshairsGroup.addShape('rect', {
|
47012 | attrs: attrs
|
47013 | });
|
47014 | shape.hide();
|
47015 | this.set('crosshairsRectShape', shape);
|
47016 | return shape;
|
47017 | };
|
47018 |
|
47019 | Tooltip.prototype._isContentChange = function _isContentChange(title, items) {
|
47020 | var titleContent = this.get('titleContent');
|
47021 | var lastItems = this.get('items');
|
47022 | var isChanged = !(title === titleContent && lastItems.length === items.length);
|
47023 | if (!isChanged) {
|
47024 | Util.each(items, function (item, index) {
|
47025 | var preItem = lastItems[index];
|
47026 | isChanged = item.value !== preItem.value || item.color !== preItem.color || item.name !== preItem.name || item.title !== preItem.title;
|
47027 | if (isChanged) {
|
47028 | return false;
|
47029 | }
|
47030 | });
|
47031 | }
|
47032 |
|
47033 | return isChanged;
|
47034 | };
|
47035 |
|
47036 | Tooltip.prototype.setContent = function setContent(title, items) {
|
47037 | var isChange = this._isContentChange(title, items);
|
47038 | if (isChange) {
|
47039 | var timeStamp = +new Date();
|
47040 | this.set('items', items);
|
47041 | this.set('titleContent', title);
|
47042 | this.set('timeStamp', timeStamp);
|
47043 | this._renderTooltip();
|
47044 | }
|
47045 | return this;
|
47046 | };
|
47047 |
|
47048 | Tooltip.prototype.setMarkers = function setMarkers(markerItems, markerCfg) {
|
47049 | var self = this;
|
47050 | var markerGroup = self.get('markerGroup');
|
47051 | var frontPlot = self.get('frontPlot');
|
47052 | if (!markerGroup) {
|
47053 | markerGroup = frontPlot.addGroup({
|
47054 | zIndex: 1
|
47055 | });
|
47056 | self.set('markerGroup', markerGroup);
|
47057 | } else {
|
47058 | markerGroup.clear();
|
47059 | }
|
47060 | Util.each(markerItems, function (item) {
|
47061 | markerGroup.addShape('marker', {
|
47062 | color: item.color,
|
47063 | attrs: Util.mix({}, markerCfg, {
|
47064 | x: item.x,
|
47065 | y: item.y
|
47066 | })
|
47067 | });
|
47068 | });
|
47069 | this.set('markerItems', markerItems);
|
47070 | };
|
47071 |
|
47072 | Tooltip.prototype.clearMarkers = function clearMarkers() {
|
47073 | var markerGroup = this.get('markerGroup');
|
47074 | markerGroup && markerGroup.clear();
|
47075 | };
|
47076 |
|
47077 | Tooltip.prototype.setPosition = function setPosition(x, y, target) {
|
47078 | var container = this.get('container');
|
47079 | var crossLineShapeX = this.get('crossLineShapeX');
|
47080 | var crossLineShapeY = this.get('crossLineShapeY');
|
47081 | var crosshairsRectShape = this.get('crosshairsRectShape');
|
47082 | var endx = x;
|
47083 | var endy = y;
|
47084 |
|
47085 | var outterNode = this.get('canvas').get('el');
|
47086 | var viewWidth = DomUtil.getWidth(outterNode);
|
47087 | var viewHeight = DomUtil.getHeight(outterNode);
|
47088 | var offset = this.get('offset');
|
47089 |
|
47090 | var position = void 0;
|
47091 | if (this.get('position')) {
|
47092 | position = calcTooltipPosition(x, y, this.get('position'), container, target);
|
47093 | x = position[0];
|
47094 | y = position[1];
|
47095 | } else if (!this.get('position')) {
|
47096 | position = refixTooltipPosition(x, y, container, viewWidth, viewHeight);
|
47097 | x = position[0];
|
47098 | y = position[1];
|
47099 | }
|
47100 |
|
47101 | if (this.get('inPlot')) {
|
47102 |
|
47103 | var plotRange = this.get('plotRange');
|
47104 | position = confineTooltipPosition(x, y, container, plotRange);
|
47105 | x = position[0];
|
47106 | y = position[1];
|
47107 | }
|
47108 |
|
47109 | if (this.get('x') !== x || this.get('y') !== y) {
|
47110 | var markerItems = this.get('markerItems');
|
47111 | if (!Util.isEmpty(markerItems)) {
|
47112 | endx = markerItems[0].x;
|
47113 | endy = markerItems[0].y;
|
47114 | }
|
47115 | if (crossLineShapeY) {
|
47116 |
|
47117 | crossLineShapeY.move(endx, 0);
|
47118 | }
|
47119 | if (crossLineShapeX) {
|
47120 | crossLineShapeX.move(0, endy);
|
47121 | }
|
47122 |
|
47123 | if (crosshairsRectShape) {
|
47124 | var isTransposed = this.get('isTransposed');
|
47125 | var items = this.get('items');
|
47126 | var firstItem = items[0];
|
47127 | var lastItem = items[items.length - 1];
|
47128 | var dim = isTransposed ? 'y' : 'x';
|
47129 | var attr = isTransposed ? 'height' : 'width';
|
47130 | var startDim = firstItem[dim];
|
47131 | if (items.length > 1 && firstItem[dim] > lastItem[dim]) {
|
47132 | startDim = lastItem[dim];
|
47133 | }
|
47134 |
|
47135 | if (this.get('crosshairs').width) {
|
47136 |
|
47137 | crosshairsRectShape.attr(dim, startDim - this.get('crosshairs').width / 2);
|
47138 | crosshairsRectShape.attr(attr, this.get('crosshairs').width);
|
47139 | } else {
|
47140 | offset = firstItem.size / 2 + firstItem.size / 4 || 10;
|
47141 | crosshairsRectShape.attr(dim, startDim - offset);
|
47142 |
|
47143 | if (items.length === 1) {
|
47144 | crosshairsRectShape.attr(attr, firstItem.size + firstItem.size / 2);
|
47145 | } else {
|
47146 | var _lastItem = items[items.length - 1];
|
47147 | crosshairsRectShape.attr(attr, Math.abs(_lastItem[dim] - firstItem[dim]) + 2 * offset);
|
47148 | }
|
47149 | }
|
47150 | }
|
47151 |
|
47152 | var follow = this.get('follow');
|
47153 | container.style.left = follow ? x + 'px' : 0;
|
47154 | container.style.top = follow ? y + 'px' : 0;
|
47155 | }
|
47156 | };
|
47157 |
|
47158 | Tooltip.prototype.show = function show() {
|
47159 | var crossLineShapeX = this.get('crossLineShapeX');
|
47160 | var crossLineShapeY = this.get('crossLineShapeY');
|
47161 | var crosshairsRectShape = this.get('crosshairsRectShape');
|
47162 | var markerGroup = this.get('markerGroup');
|
47163 | var container = this.get('container');
|
47164 | var canvas = this.get('canvas');
|
47165 | crossLineShapeX && crossLineShapeX.show();
|
47166 | crossLineShapeY && crossLineShapeY.show();
|
47167 | crosshairsRectShape && crosshairsRectShape.show();
|
47168 | markerGroup && markerGroup.show();
|
47169 | _Base.prototype.show.call(this);
|
47170 | container.style.visibility = 'visible';
|
47171 |
|
47172 | canvas.draw();
|
47173 | };
|
47174 |
|
47175 | Tooltip.prototype.hide = function hide() {
|
47176 | var self = this;
|
47177 | var container = self.get('container');
|
47178 | var crossLineShapeX = self.get('crossLineShapeX');
|
47179 | var crossLineShapeY = self.get('crossLineShapeY');
|
47180 | var crosshairsRectShape = this.get('crosshairsRectShape');
|
47181 | var markerGroup = self.get('markerGroup');
|
47182 | var canvas = self.get('canvas');
|
47183 | container.style.visibility = 'hidden';
|
47184 | crossLineShapeX && crossLineShapeX.hide();
|
47185 | crossLineShapeY && crossLineShapeY.hide();
|
47186 | crosshairsRectShape && crosshairsRectShape.hide();
|
47187 | markerGroup && markerGroup.hide();
|
47188 | _Base.prototype.hide.call(this);
|
47189 | canvas.draw();
|
47190 | };
|
47191 |
|
47192 | Tooltip.prototype.destroy = function destroy() {
|
47193 | var self = this;
|
47194 | var crossLineShapeX = self.get('crossLineShapeX');
|
47195 | var crossLineShapeY = self.get('crossLineShapeY');
|
47196 | var markerGroup = self.get('markerGroup');
|
47197 | var crosshairsRectShape = self.get('crosshairsRectShape');
|
47198 | var container = self.get('container');
|
47199 | var containerTpl = self.get('containerTpl');
|
47200 |
|
47201 | if (container && !/^\#/.test(containerTpl)) {
|
47202 | container.parentNode.removeChild(container);
|
47203 | }
|
47204 |
|
47205 | crossLineShapeX && crossLineShapeX.remove();
|
47206 | crossLineShapeY && crossLineShapeY.remove();
|
47207 | markerGroup && markerGroup.remove();
|
47208 | crosshairsRectShape && crosshairsRectShape.remove();
|
47209 |
|
47210 | _Base.prototype.destroy.call(this);
|
47211 | };
|
47212 |
|
47213 | return Tooltip;
|
47214 | }(Base);
|
47215 |
|
47216 | module.exports = Tooltip;
|
47217 |
|
47218 | }),
|
47219 |
|
47220 | (function(module, exports, __webpack_require__) {
|
47221 |
|
47222 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
47223 |
|
47224 |
|
47225 |
|
47226 |
|
47227 |
|
47228 | var Util = __webpack_require__(0);
|
47229 |
|
47230 | var _require = __webpack_require__(25),
|
47231 | Guide = _require.Guide;
|
47232 |
|
47233 | var Global = __webpack_require__(1);
|
47234 |
|
47235 | var GuideController = function () {
|
47236 | function GuideController(cfg) {
|
47237 | _classCallCheck(this, GuideController);
|
47238 |
|
47239 | this.guides = [];
|
47240 | this.options = [];
|
47241 | this.xScales = null;
|
47242 | this.yScales = null;
|
47243 | this.container = null;
|
47244 | Util.mix(this, cfg);
|
47245 | }
|
47246 |
|
47247 | GuideController.prototype._creatGuides = function _creatGuides() {
|
47248 | var self = this;
|
47249 | var options = this.options;
|
47250 | var xScales = this.xScales;
|
47251 | var yScales = this.yScales;
|
47252 | options.forEach(function (option) {
|
47253 | var type = option.type;
|
47254 | var config = Util.deepMix({
|
47255 | xScales: xScales,
|
47256 | yScales: yScales
|
47257 | }, Global.guide[type], option);
|
47258 | type = Util.upperFirst(type);
|
47259 | var guide = new Guide[type](config);
|
47260 | self.guides.push(guide);
|
47261 | });
|
47262 |
|
47263 | return self.guides;
|
47264 | };
|
47265 |
|
47266 | GuideController.prototype.line = function line() {
|
47267 | var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
47268 |
|
47269 | this.options.push(Util.mix({
|
47270 | type: 'line'
|
47271 | }, cfg));
|
47272 | return this;
|
47273 | };
|
47274 |
|
47275 | GuideController.prototype.arc = function arc() {
|
47276 | var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
47277 |
|
47278 | this.options.push(Util.mix({
|
47279 | type: 'arc'
|
47280 | }, cfg));
|
47281 | return this;
|
47282 | };
|
47283 |
|
47284 | GuideController.prototype.text = function text() {
|
47285 | var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
47286 |
|
47287 | this.options.push(Util.mix({
|
47288 | type: 'text'
|
47289 | }, cfg));
|
47290 | return this;
|
47291 | };
|
47292 |
|
47293 | GuideController.prototype.image = function image() {
|
47294 | var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
47295 |
|
47296 | this.options.push(Util.mix({
|
47297 | type: 'image'
|
47298 | }, cfg));
|
47299 | return this;
|
47300 | };
|
47301 |
|
47302 | GuideController.prototype.region = function region() {
|
47303 | var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
47304 |
|
47305 | this.options.push(Util.mix({
|
47306 | type: 'region'
|
47307 | }, cfg));
|
47308 | return this;
|
47309 | };
|
47310 |
|
47311 | GuideController.prototype.html = function html() {
|
47312 | var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
47313 |
|
47314 | this.options.push(Util.mix({
|
47315 | type: 'html'
|
47316 | }, cfg));
|
47317 | return this;
|
47318 | };
|
47319 |
|
47320 | GuideController.prototype.render = function render(coord) {
|
47321 | var self = this;
|
47322 | var guides = self._creatGuides();
|
47323 | var container = self.backContainer;
|
47324 |
|
47325 | Util.each(guides, function (guide) {
|
47326 | if (guide.top) {
|
47327 |
|
47328 | container = self.frontContainer;
|
47329 | }
|
47330 | guide.render(coord, container);
|
47331 | });
|
47332 | };
|
47333 |
|
47334 | GuideController.prototype.clear = function clear() {
|
47335 | this.options = [];
|
47336 | this.reset();
|
47337 | };
|
47338 |
|
47339 | GuideController.prototype.changeVisible = function changeVisible(visible) {
|
47340 | var guides = this.guides;
|
47341 | Util.each(guides, function (guide) {
|
47342 | guide.setVisible(visible);
|
47343 | });
|
47344 | };
|
47345 |
|
47346 | GuideController.prototype.reset = function reset() {
|
47347 | var guides = this.guides;
|
47348 | Util.each(guides, function (guide) {
|
47349 | guide.remove();
|
47350 | });
|
47351 | this.guides = [];
|
47352 | };
|
47353 |
|
47354 | return GuideController;
|
47355 | }();
|
47356 |
|
47357 | module.exports = GuideController;
|
47358 |
|
47359 | }),
|
47360 |
|
47361 | (function(module, exports, __webpack_require__) {
|
47362 |
|
47363 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
47364 |
|
47365 | var Util = __webpack_require__(0);
|
47366 | var Global = __webpack_require__(1);
|
47367 |
|
47368 | var _require = __webpack_require__(25),
|
47369 | Legend = _require.Legend;
|
47370 |
|
47371 | var Shape = __webpack_require__(66);
|
47372 |
|
47373 | var FIELD_ORIGIN = '_origin';
|
47374 | var MARGIN = 24;
|
47375 | var MARGIN_LEGEND = 24;
|
47376 | var requireAnimationFrameFn = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
|
47377 |
|
47378 | function _snapEqual(v1, v2, scale) {
|
47379 | var isEqual = void 0;
|
47380 | if (Util.isNil(scale)) {
|
47381 | return false;
|
47382 | }
|
47383 | v1 = scale.translate(v1);
|
47384 | v2 = scale.translate(v2);
|
47385 | if (scale.isCategory) {
|
47386 | isEqual = v1 === v2;
|
47387 | } else {
|
47388 | isEqual = Math.abs(v1 - v2) <= 1;
|
47389 | }
|
47390 | return isEqual;
|
47391 | }
|
47392 |
|
47393 | function findGeom(geoms, value) {
|
47394 | var rst = void 0;
|
47395 | Util.each(geoms, function (geom) {
|
47396 | if (geom.get('visible')) {
|
47397 | var yScale = geom.getYScale();
|
47398 | if (yScale.field === value) {
|
47399 | rst = geom;
|
47400 | return;
|
47401 | }
|
47402 | }
|
47403 | });
|
47404 |
|
47405 | return rst;
|
47406 | }
|
47407 |
|
47408 | var LegendController = function () {
|
47409 | function LegendController(cfg) {
|
47410 | _classCallCheck(this, LegendController);
|
47411 |
|
47412 | this.options = {};
|
47413 | Util.mix(this, cfg);
|
47414 | this.clear();
|
47415 | var chart = this.chart;
|
47416 | this.container = chart.get('frontPlot');
|
47417 | this.plotRange = chart.get('plotRange');
|
47418 | }
|
47419 |
|
47420 | LegendController.prototype.clear = function clear() {
|
47421 | var legends = this.legends;
|
47422 | Util.each(legends, function (legendItems) {
|
47423 | Util.each(legendItems, function (legend) {
|
47424 | legend.remove();
|
47425 | });
|
47426 | });
|
47427 | this.legends = {};
|
47428 | };
|
47429 |
|
47430 | LegendController.prototype._isFieldInView = function _isFieldInView(field, value, view) {
|
47431 | var flag = false;
|
47432 | var scales = view.get('scales');
|
47433 | var fieldScale = scales[field];
|
47434 | if (fieldScale && fieldScale.values) {
|
47435 | flag = Util.inArray(fieldScale.values, value);
|
47436 | }
|
47437 |
|
47438 | return flag;
|
47439 | };
|
47440 |
|
47441 | LegendController.prototype._bindClickEvent = function _bindClickEvent(legend, scale, filterVals) {
|
47442 | var self = this;
|
47443 | var chart = self.chart;
|
47444 | var views = chart.get('views');
|
47445 | var field = scale.field;
|
47446 | var options = self.options;
|
47447 |
|
47448 | legend.on('itemclick', function (ev) {
|
47449 | if (options.onClick) {
|
47450 |
|
47451 | options.onClick(ev);
|
47452 | } else {
|
47453 | var item = ev.item;
|
47454 | var checked = ev.checked;
|
47455 | var isSingeSelected = legend.get('selectedMode') === 'single';
|
47456 | var clickedValue = item.dataValue;
|
47457 |
|
47458 | if (checked) {
|
47459 | filterVals.push(clickedValue);
|
47460 | if (self._isFieldInView(field, clickedValue, chart)) {
|
47461 | chart.filter(field, function (field) {
|
47462 | return isSingeSelected ? field === clickedValue : Util.inArray(filterVals, field);
|
47463 | });
|
47464 | }
|
47465 | Util.each(views, function (view) {
|
47466 | if (self._isFieldInView(field, clickedValue, view)) {
|
47467 | view.filter(field, function (field) {
|
47468 | return isSingeSelected ? field === clickedValue : Util.inArray(filterVals, field);
|
47469 | });
|
47470 | }
|
47471 | });
|
47472 | } else if (!isSingeSelected) {
|
47473 | Util.Array.remove(filterVals, clickedValue);
|
47474 |
|
47475 | if (self._isFieldInView(field, clickedValue, chart)) {
|
47476 | chart.filter(field, function (field) {
|
47477 | return Util.inArray(filterVals, field);
|
47478 | });
|
47479 | }
|
47480 | Util.each(views, function (view) {
|
47481 | if (self._isFieldInView(field, clickedValue, view)) {
|
47482 | view.filter(field, function (field) {
|
47483 | return Util.inArray(filterVals, field);
|
47484 | });
|
47485 | }
|
47486 | });
|
47487 | }
|
47488 | chart.set('keepLegend', true);
|
47489 | chart.repaint();
|
47490 | }
|
47491 | });
|
47492 | };
|
47493 |
|
47494 | LegendController.prototype._filterLabels = function _filterLabels(shape, geom, visible) {
|
47495 | if (shape.get('gLabel')) {
|
47496 | shape.get('gLabel').set('visible', visible);
|
47497 | } else {
|
47498 | var labelCfg = geom.get('labelCfg');
|
47499 | if (labelCfg && labelCfg.fields && labelCfg.fields.length > 0) {
|
47500 | var xScale = geom.getXScale();
|
47501 | var yScale = geom.getYScale();
|
47502 | var xField = xScale.field;
|
47503 | var yField = yScale.field;
|
47504 | var shapeData = shape.get('origin')._origin;
|
47505 | var labelContainer = geom.get('labelContainer');
|
47506 | var labels = labelContainer.get('labelsGroup').get('children');
|
47507 | Util.each(labels, function (label) {
|
47508 | var labelData = label.get('origin') || [];
|
47509 | if (labelData[xField] === shapeData[xField] && labelData[yField] === shapeData[yField]) {
|
47510 | label.set('visible', visible);
|
47511 | shape.set('gLabel', label);
|
47512 | }
|
47513 | });
|
47514 | }
|
47515 | }
|
47516 | };
|
47517 |
|
47518 | LegendController.prototype._bindFilterEvent = function _bindFilterEvent(legend, scale) {
|
47519 | var self = this;
|
47520 | var chart = this.chart;
|
47521 | var field = scale.field;
|
47522 | legend.on('itemfilter', function (ev) {
|
47523 | var range = ev.range;
|
47524 | chart.filterShape(function (obj, shape, geom) {
|
47525 | if (obj[field]) {
|
47526 | var filtered = obj[field] >= range[0] && obj[field] <= range[1];
|
47527 |
|
47528 | self._filterLabels(shape, geom, filtered);
|
47529 | return filtered;
|
47530 | }
|
47531 | return true;
|
47532 | });
|
47533 | var geoms = chart.getAllGeoms() || [];
|
47534 |
|
47535 | var _loop = function _loop(i) {
|
47536 | var geom = geoms[i];
|
47537 | if (geom.get('type') === 'heatmap') {
|
47538 | requireAnimationFrameFn(function () {
|
47539 | geom.drawWithRange(range);
|
47540 | });
|
47541 | }
|
47542 | };
|
47543 |
|
47544 | for (var i = 0; i < geoms.length; i++) {
|
47545 | _loop(i);
|
47546 | }
|
47547 | });
|
47548 | };
|
47549 |
|
47550 | LegendController.prototype._getShapeData = function _getShapeData(shape) {
|
47551 | var originData = shape.get('origin');
|
47552 |
|
47553 | if (Util.isArray(originData)) {
|
47554 | originData = originData[0];
|
47555 | }
|
47556 | return originData[FIELD_ORIGIN];
|
47557 | };
|
47558 |
|
47559 | LegendController.prototype._bindHoverEvent = function _bindHoverEvent(legend, field) {
|
47560 | var self = this;
|
47561 | var chart = self.chart;
|
47562 | var geoms = chart.getAllGeoms();
|
47563 | var options = self.options;
|
47564 | var canvas = chart.get('canvas');
|
47565 | legend.on('itemhover', function (ev) {
|
47566 | var value = ev.item.value;
|
47567 | var pre = self.pre;
|
47568 | if (!pre) {
|
47569 | Util.each(geoms, function (geom) {
|
47570 | var shapeContainer = geom.get('shapeContainer');
|
47571 | var shapes = geom.getShapes();
|
47572 | var activeShapes = [];
|
47573 | if (field) {
|
47574 | var scale = geom.get('scales')[field];
|
47575 | Util.each(shapes, function (shape) {
|
47576 | var origin = self._getShapeData(shape);
|
47577 | if (origin && _snapEqual(origin[field], value, scale)) {
|
47578 | activeShapes.push(shape);
|
47579 | }
|
47580 | });
|
47581 | } else if (geom.getYScale().field === value) {
|
47582 | activeShapes = shapes;
|
47583 | }
|
47584 |
|
47585 | if (!Util.isEmpty(activeShapes)) {
|
47586 | ev.shapes = activeShapes;
|
47587 | ev.geom = geom;
|
47588 | if (options.onHover) {
|
47589 | options.onHover(ev);
|
47590 | shapeContainer.sort();
|
47591 | canvas.draw();
|
47592 | } else {
|
47593 | geom.setShapesActived(activeShapes);
|
47594 | }
|
47595 | }
|
47596 | });
|
47597 | self.pre = value;
|
47598 | } else if (pre === value) {
|
47599 | return;
|
47600 | }
|
47601 | });
|
47602 |
|
47603 | legend.on('itemunhover', function () {
|
47604 | self.pre = null;
|
47605 | Util.each(geoms, function (geom) {
|
47606 | if (geom.get('activeShapes')) {
|
47607 | geom.clearActivedShapes();
|
47608 | canvas.draw();
|
47609 | }
|
47610 | });
|
47611 | });
|
47612 | };
|
47613 |
|
47614 | LegendController.prototype._isFiltered = function _isFiltered(scale, values, value) {
|
47615 | if (!scale.isCategory) {
|
47616 | return true;
|
47617 | }
|
47618 | var rst = false;
|
47619 | value = scale.invert(value);
|
47620 | Util.each(values, function (val) {
|
47621 | rst = rst || scale.getText(val) === scale.getText(value);
|
47622 | if (rst) {
|
47623 | return false;
|
47624 | }
|
47625 | });
|
47626 | return rst;
|
47627 | };
|
47628 |
|
47629 | LegendController.prototype._alignLegend = function _alignLegend(legend, pre, region, position) {
|
47630 | var self = this;
|
47631 | var container = self.container;
|
47632 | var canvas = container.get('canvas');
|
47633 | var width = canvas.get('width');
|
47634 | var height = canvas.get('height');
|
47635 | var plotRange = self.plotRange;
|
47636 | var offsetX = legend.get('offsetX') || 0;
|
47637 | var offsetY = legend.get('offsetY') || 0;
|
47638 | var offset = Util.isNil(legend.get('offset')) ? MARGIN : legend.get('offset');
|
47639 | var legendHeight = legend.getHeight();
|
47640 |
|
47641 | var x = 0;
|
47642 | var y = 0;
|
47643 |
|
47644 | if (position === 'left' || position === 'right') {
|
47645 |
|
47646 | height = plotRange.br.y;
|
47647 | x = position === 'left' ? offset : plotRange.br.x + offset;
|
47648 | y = height - legendHeight;
|
47649 |
|
47650 | if (pre) {
|
47651 | y = pre.get('y') - legendHeight - MARGIN_LEGEND;
|
47652 | }
|
47653 | } else {
|
47654 | x = (width - region.totalWidth) / 2;
|
47655 | y = position === 'top' ? offset : plotRange.bl.y + offset;
|
47656 |
|
47657 | if (pre) {
|
47658 | var preWidth = pre.getWidth();
|
47659 | x = pre.get('x') + preWidth + MARGIN_LEGEND;
|
47660 | }
|
47661 | }
|
47662 |
|
47663 | legend.move(x + offsetX, y + offsetY);
|
47664 | };
|
47665 |
|
47666 | LegendController.prototype._getRegion = function _getRegion(legends) {
|
47667 | var maxWidth = 0;
|
47668 | var totalWidth = 0;
|
47669 | Util.each(legends, function (legend) {
|
47670 | var width = legend.getWidth();
|
47671 | if (maxWidth < width) {
|
47672 | maxWidth = width;
|
47673 | }
|
47674 | totalWidth += width;
|
47675 | });
|
47676 | return {
|
47677 | maxWidth: maxWidth,
|
47678 | totalWidth: totalWidth
|
47679 | };
|
47680 | };
|
47681 |
|
47682 | LegendController.prototype._addCategroyLegend = function _addCategroyLegend(scale, attr, geom, filterVals, position) {
|
47683 | var self = this;
|
47684 | var field = scale.field;
|
47685 | var legendOptions = self.options;
|
47686 | var legends = self.legends;
|
47687 | legends[position] = legends[position] || [];
|
47688 | var container = self.container;
|
47689 | var items = [];
|
47690 | var ticks = scale.getTicks();
|
47691 |
|
47692 | var isByAttr = true;
|
47693 | var shapeType = geom.get('shapeType') || 'point';
|
47694 | var shape = geom.getDefaultValue('shape') || 'circle';
|
47695 | if (legendOptions[field] && legendOptions[field].marker) {
|
47696 |
|
47697 | shape = legendOptions[field].marker;
|
47698 | shapeType = 'point';
|
47699 | isByAttr = false;
|
47700 | } else if (legendOptions.marker) {
|
47701 | shape = legendOptions.marker;
|
47702 | shapeType = 'point';
|
47703 | isByAttr = false;
|
47704 | }
|
47705 |
|
47706 | var chart = self.chart;
|
47707 | var canvas = chart.get('canvas');
|
47708 | var plotRange = self.plotRange;
|
47709 | var maxLength = position === 'right' || position === 'left' ? plotRange.bl.y - plotRange.tr.y : canvas.get('width');
|
47710 |
|
47711 | Util.each(ticks, function (tick) {
|
47712 | var text = tick.text;
|
47713 | var name = text;
|
47714 | var scaleValue = tick.value;
|
47715 | var value = scale.invert(scaleValue);
|
47716 | var cfg = {
|
47717 | isInCircle: geom.isInCircle()
|
47718 | };
|
47719 | var checked = filterVals ? self._isFiltered(scale, filterVals, scaleValue) : true;
|
47720 |
|
47721 | var colorAttr = geom.getAttr('color');
|
47722 | var shapeAttr = geom.getAttr('shape');
|
47723 | if (colorAttr) {
|
47724 |
|
47725 | if (colorAttr.callback && colorAttr.callback.length > 1) {
|
47726 |
|
47727 | var restArgs = Array(colorAttr.callback.length - 1).fill('');
|
47728 | cfg.color = colorAttr.mapping.apply(colorAttr, [value].concat(restArgs)).join('') || Global.defaultColor;
|
47729 | } else {
|
47730 | cfg.color = colorAttr.mapping(value).join('') || Global.defaultColor;
|
47731 | }
|
47732 | }
|
47733 | if (isByAttr && shapeAttr) {
|
47734 |
|
47735 | if (shapeAttr.callback && shapeAttr.callback.length > 1) {
|
47736 |
|
47737 | var _restArgs = Array(shapeAttr.callback.length - 1).fill('');
|
47738 | shape = shapeAttr.mapping.apply(shapeAttr, [value].concat(_restArgs)).join('');
|
47739 | } else {
|
47740 | shape = shapeAttr.mapping(value).join('');
|
47741 | }
|
47742 | }
|
47743 |
|
47744 | var shapeObject = Shape.getShapeFactory(shapeType);
|
47745 | var marker = shapeObject.getMarkerCfg(shape, cfg);
|
47746 |
|
47747 | if (Util.isFunction(shape)) {
|
47748 | marker.symbol = shape;
|
47749 | }
|
47750 |
|
47751 | items.push({
|
47752 | value: name,
|
47753 | dataValue: value,
|
47754 | checked: checked,
|
47755 | marker: marker
|
47756 | });
|
47757 | });
|
47758 |
|
47759 | var legendCfg = Util.deepMix({
|
47760 | title: {
|
47761 | text: scale.alias || scale.field
|
47762 | }
|
47763 | }, Global.legend[position], legendOptions[field] || legendOptions, {
|
47764 | maxLength: maxLength,
|
47765 | items: items
|
47766 | });
|
47767 |
|
47768 | var legend = container.addGroup(Legend.Category, legendCfg);
|
47769 | self._bindClickEvent(legend, scale, filterVals);
|
47770 | legends[position].push(legend);
|
47771 | return legend;
|
47772 | };
|
47773 |
|
47774 | LegendController.prototype._addContinuousLegend = function _addContinuousLegend(scale, attr, position) {
|
47775 | var self = this;
|
47776 | var legends = self.legends;
|
47777 | legends[position] = legends[position] || [];
|
47778 | var container = self.container;
|
47779 | var field = scale.field;
|
47780 | var ticks = scale.getTicks();
|
47781 | var items = [];
|
47782 | var legend = void 0;
|
47783 | var minValue = void 0;
|
47784 | var maxValue = void 0;
|
47785 |
|
47786 | Util.each(ticks, function (tick) {
|
47787 | var scaleValue = tick.value;
|
47788 | var invertValue = scale.invert(scaleValue);
|
47789 | var attrValue = attr.mapping(invertValue).join('');
|
47790 |
|
47791 | items.push({
|
47792 | value: tick.text,
|
47793 | attrValue: attrValue,
|
47794 | scaleValue: scaleValue
|
47795 | });
|
47796 | if (scaleValue === 0) {
|
47797 | minValue = true;
|
47798 | }
|
47799 | if (scaleValue === 1) {
|
47800 | maxValue = true;
|
47801 | }
|
47802 | });
|
47803 |
|
47804 | if (!minValue) {
|
47805 | items.push({
|
47806 | value: scale.getText(scale.invert(0)),
|
47807 | attrValue: attr.mapping(0).join(''),
|
47808 | scaleValue: 0
|
47809 | });
|
47810 | }
|
47811 | if (!maxValue) {
|
47812 | items.push({
|
47813 | value: scale.getText(scale.invert(1)),
|
47814 | attrValue: attr.mapping(1).join(''),
|
47815 | scaleValue: 1
|
47816 | });
|
47817 | }
|
47818 |
|
47819 | var options = self.options;
|
47820 |
|
47821 | var defaultCfg = Global.legend[position];
|
47822 | if (options && options.slidable === false || options[field] && options[field].slidable === false) {
|
47823 | defaultCfg = Util.mix({}, defaultCfg, Global.legend.gradient);
|
47824 | }
|
47825 |
|
47826 | var legendCfg = Util.deepMix({
|
47827 | title: {
|
47828 | text: scale.alias || scale.field
|
47829 | }
|
47830 | }, defaultCfg, options[field] || options, {
|
47831 | items: items,
|
47832 | attr: attr
|
47833 | });
|
47834 |
|
47835 | if (attr.type === 'color') {
|
47836 | legend = container.addGroup(Legend.Color, legendCfg);
|
47837 | } else if (attr.type === 'size') {
|
47838 | legend = container.addGroup(Legend.Size, legendCfg);
|
47839 | }
|
47840 | self._bindFilterEvent(legend, scale);
|
47841 | legends[position].push(legend);
|
47842 | return legend;
|
47843 | };
|
47844 |
|
47845 | LegendController.prototype.addLegend = function addLegend(scale, attr, geom, filterVals) {
|
47846 | var self = this;
|
47847 | var legendOptions = self.options;
|
47848 | var field = scale.field;
|
47849 | var fieldOption = legendOptions[field];
|
47850 |
|
47851 | if (fieldOption === false) {
|
47852 |
|
47853 | return null;
|
47854 | }
|
47855 |
|
47856 | if (fieldOption && fieldOption.custom) {
|
47857 | self.addCustomLegend(field);
|
47858 | } else {
|
47859 | var position = legendOptions.position || Global.defaultLegendPosition;
|
47860 | if (fieldOption && fieldOption.position) {
|
47861 |
|
47862 | position = fieldOption.position;
|
47863 | }
|
47864 |
|
47865 | var legend = void 0;
|
47866 | if (scale.isLinear) {
|
47867 | legend = self._addContinuousLegend(scale, attr, position);
|
47868 | } else {
|
47869 | legend = self._addCategroyLegend(scale, attr, geom, filterVals, position);
|
47870 | }
|
47871 | self._bindHoverEvent(legend, field);
|
47872 | }
|
47873 | };
|
47874 |
|
47875 | |
47876 |
|
47877 |
|
47878 |
|
47879 |
|
47880 |
|
47881 | LegendController.prototype.addCustomLegend = function addCustomLegend(field) {
|
47882 | var self = this;
|
47883 | var chart = self.chart;
|
47884 | var container = self.container;
|
47885 | var legendOptions = self.options;
|
47886 |
|
47887 | if (field) {
|
47888 | legendOptions = legendOptions[field];
|
47889 | }
|
47890 |
|
47891 | var position = legendOptions.position || Global.defaultLegendPosition;
|
47892 | var legends = self.legends;
|
47893 | legends[position] = legends[position] || [];
|
47894 | var items = legendOptions.items;
|
47895 | if (!items) {
|
47896 | return;
|
47897 | }
|
47898 |
|
47899 | var geoms = chart.getAllGeoms();
|
47900 | Util.each(items, function (item) {
|
47901 | var geom = findGeom(geoms, item.value);
|
47902 | if (!Util.isObject(item.marker)) {
|
47903 | item.marker = {
|
47904 | symbol: item.marker ? item.marker : 'circle',
|
47905 | fill: item.fill,
|
47906 | radius: 4.5
|
47907 | };
|
47908 | }
|
47909 | item.checked = Util.isNil(item.checked) ? true : item.checked;
|
47910 | item.geom = geom;
|
47911 | });
|
47912 |
|
47913 | var canvas = chart.get('canvas');
|
47914 | var plotRange = self.plotRange;
|
47915 | var maxLength = position === 'right' || position === 'left' ? plotRange.bl.y - plotRange.tr.y : canvas.get('width');
|
47916 |
|
47917 | var legendCfg = Util.deepMix({}, Global.legend[position], legendOptions, {
|
47918 | maxLength: maxLength,
|
47919 | items: items
|
47920 | });
|
47921 |
|
47922 | var legend = container.addGroup(Legend.Category, legendCfg);
|
47923 | legends[position].push(legend);
|
47924 |
|
47925 | legend.on('itemclick', function (ev) {
|
47926 | if (legendOptions.onClick) {
|
47927 |
|
47928 | legendOptions.onClick(ev);
|
47929 | }
|
47930 | });
|
47931 |
|
47932 | self._bindHoverEvent(legend);
|
47933 | };
|
47934 |
|
47935 | LegendController.prototype.alignLegends = function alignLegends() {
|
47936 | var self = this;
|
47937 | var legends = self.legends;
|
47938 | Util.each(legends, function (legendItems, position) {
|
47939 | var region = self._getRegion(legendItems);
|
47940 | Util.each(legendItems, function (legend, index) {
|
47941 | var pre = legendItems[index - 1];
|
47942 | if (!(legend.get('useHtml') && !legend.get('autoPosition'))) {
|
47943 | self._alignLegend(legend, pre, region, position);
|
47944 | }
|
47945 | });
|
47946 | });
|
47947 |
|
47948 | return this;
|
47949 | };
|
47950 |
|
47951 | return LegendController;
|
47952 | }();
|
47953 |
|
47954 | module.exports = LegendController;
|
47955 |
|
47956 | }),
|
47957 |
|
47958 | (function(module, exports, __webpack_require__) {
|
47959 |
|
47960 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
47961 |
|
47962 |
|
47963 |
|
47964 |
|
47965 |
|
47966 | var Util = __webpack_require__(0);
|
47967 | var Global = __webpack_require__(1);
|
47968 |
|
47969 | var _require = __webpack_require__(25),
|
47970 | Tooltip = _require.Tooltip;
|
47971 |
|
47972 | var MatrixUtil = __webpack_require__(2).MatrixUtil;
|
47973 | var Vector2 = MatrixUtil.vec2;
|
47974 |
|
47975 | var TYPE_SHOW_MARKERS = ['line', 'area', 'path', 'areaStack'];
|
47976 | var TYPE_SHOW_CROSSHAIRS = ['line', 'area'];
|
47977 |
|
47978 | function _indexOfArray(items, item) {
|
47979 | var rst = -1;
|
47980 | Util.each(items, function (sub, index) {
|
47981 | if (sub.title === item.title && sub.name === item.name && sub.value === item.value && sub.color === item.color) {
|
47982 | rst = index;
|
47983 | return false;
|
47984 | }
|
47985 | });
|
47986 | return rst;
|
47987 | }
|
47988 |
|
47989 |
|
47990 | function _hasClass(dom, className) {
|
47991 | if (!dom) {
|
47992 | return false;
|
47993 | }
|
47994 | var cls = '';
|
47995 | if (!dom.className) return false;
|
47996 | if (!Util.isNil(dom.className.baseVal)) {
|
47997 | cls = dom.className.baseVal;
|
47998 | } else {
|
47999 | cls = dom.className;
|
48000 | }
|
48001 | return cls.indexOf(className) !== -1;
|
48002 | }
|
48003 |
|
48004 | function _isParent(dom, cls) {
|
48005 | var parent = dom.parentNode;
|
48006 | var rst = false;
|
48007 | while (parent && parent !== document.body) {
|
48008 | if (_hasClass(parent, cls)) {
|
48009 | rst = true;
|
48010 | break;
|
48011 | }
|
48012 | parent = parent.parentNode;
|
48013 | }
|
48014 | return rst;
|
48015 | }
|
48016 |
|
48017 |
|
48018 | function _uniqItems(items) {
|
48019 | var tmp = [];
|
48020 | Util.each(items, function (item) {
|
48021 | var index = _indexOfArray(tmp, item);
|
48022 | if (index === -1) {
|
48023 | tmp.push(item);
|
48024 | } else {
|
48025 | tmp[index] = item;
|
48026 | }
|
48027 | });
|
48028 | return tmp;
|
48029 | }
|
48030 |
|
48031 | var TooltipController = function () {
|
48032 | function TooltipController(cfg) {
|
48033 | _classCallCheck(this, TooltipController);
|
48034 |
|
48035 | Util.assign(this, cfg);
|
48036 | this.timeStamp = 0;
|
48037 | }
|
48038 |
|
48039 | TooltipController.prototype._normalizeEvent = function _normalizeEvent(event) {
|
48040 | var chart = this.chart;
|
48041 | var canvas = this._getCanvas();
|
48042 | var point = canvas.getPointByClient(event.clientX, event.clientY);
|
48043 | var pixelRatio = canvas.get('pixelRatio');
|
48044 | point.x = point.x / pixelRatio;
|
48045 | point.y = point.y / pixelRatio;
|
48046 | var views = chart.getViewsByPoint(point);
|
48047 | point.views = views;
|
48048 | return point;
|
48049 | };
|
48050 |
|
48051 | TooltipController.prototype._getCanvas = function _getCanvas() {
|
48052 | return this.chart.get('canvas');
|
48053 | };
|
48054 |
|
48055 | TooltipController.prototype._getTriggerEvent = function _getTriggerEvent() {
|
48056 | var options = this.options;
|
48057 | var triggerOn = options.triggerOn;
|
48058 | var eventName = void 0;
|
48059 |
|
48060 | if (!triggerOn || triggerOn === 'mousemove') {
|
48061 | eventName = 'plotmove';
|
48062 | } else if (triggerOn === 'click') {
|
48063 | eventName = 'plotclick';
|
48064 | } else if (triggerOn === 'none') {
|
48065 | eventName = null;
|
48066 | }
|
48067 |
|
48068 | return eventName;
|
48069 | };
|
48070 |
|
48071 | TooltipController.prototype._getDefaultTooltipCfg = function _getDefaultTooltipCfg() {
|
48072 | var self = this;
|
48073 | var options = self.options;
|
48074 | var defaultCfg = Util.mix({}, Global.tooltip);
|
48075 | var chart = self.chart;
|
48076 | var geoms = chart.getAllGeoms().filter(function (geom) {
|
48077 | return geom.get('visible');
|
48078 | });
|
48079 | var shapes = [];
|
48080 | Util.each(geoms, function (geom) {
|
48081 | var type = geom.get('type');
|
48082 | var adjusts = geom.get('adjusts');
|
48083 | var isSymmetric = false;
|
48084 | if (adjusts) {
|
48085 | Util.each(adjusts, function (adjust) {
|
48086 | if (adjust.type === 'symmetric' || adjust.type === 'Symmetric') {
|
48087 | isSymmetric = true;
|
48088 | return false;
|
48089 | }
|
48090 | });
|
48091 | }
|
48092 | if (Util.indexOf(shapes, type) === -1 && !isSymmetric) {
|
48093 | shapes.push(type);
|
48094 | }
|
48095 | });
|
48096 |
|
48097 | var crosshairsCfg = void 0;
|
48098 | if (geoms.length && geoms[0].get('coord') && geoms[0].get('coord').type === 'cartesian' && shapes.length === 1) {
|
48099 | if (shapes[0] === 'interval' && options.shared !== false) {
|
48100 |
|
48101 | crosshairsCfg = {
|
48102 | zIndex: 0,
|
48103 | crosshairs: Global.tooltipCrosshairsRect
|
48104 | };
|
48105 | } else if (Util.indexOf(TYPE_SHOW_CROSSHAIRS, shapes[0]) > -1) {
|
48106 | crosshairsCfg = {
|
48107 | crosshairs: Global.tooltipCrosshairsLine
|
48108 | };
|
48109 | }
|
48110 | }
|
48111 |
|
48112 | return Util.mix(defaultCfg, crosshairsCfg, {
|
48113 | isTransposed: geoms[0].get('coord').isTransposed
|
48114 | });
|
48115 | };
|
48116 |
|
48117 | TooltipController.prototype._bindEvent = function _bindEvent() {
|
48118 | var chart = this.chart;
|
48119 | var triggerEvent = this._getTriggerEvent();
|
48120 | if (triggerEvent) {
|
48121 | chart.on(triggerEvent, Util.wrapBehavior(this, 'onMouseMove'));
|
48122 | chart.on('plotleave', Util.wrapBehavior(this, 'onMouseOut'));
|
48123 | }
|
48124 | };
|
48125 |
|
48126 | TooltipController.prototype._offEvent = function _offEvent() {
|
48127 | var chart = this.chart;
|
48128 | var triggerEvent = this._getTriggerEvent();
|
48129 | if (triggerEvent) {
|
48130 | chart.off(triggerEvent, Util.getWrapBehavior(this, 'onMouseMove'));
|
48131 | chart.off('plotleave', Util.getWrapBehavior(this, 'onMouseOut'));
|
48132 | }
|
48133 | };
|
48134 |
|
48135 | TooltipController.prototype._setTooltip = function _setTooltip(title, point, items, markersItems, target) {
|
48136 | var self = this;
|
48137 | var tooltip = self.tooltip;
|
48138 | var prePoint = self.prePoint;
|
48139 | if (!prePoint || prePoint.x !== point.x || prePoint.y !== point.y) {
|
48140 | items = _uniqItems(items);
|
48141 | self.prePoint = point;
|
48142 |
|
48143 | var chart = self.chart;
|
48144 | var x = Util.isArray(point.x) ? point.x[point.x.length - 1] : point.x;
|
48145 | var y = Util.isArray(point.y) ? point.y[point.y.length - 1] : point.y;
|
48146 | if (!tooltip.get('visible')) {
|
48147 | chart.emit('tooltip:show', {
|
48148 | x: x,
|
48149 | y: y,
|
48150 | tooltip: tooltip
|
48151 | });
|
48152 | }
|
48153 | chart.emit('tooltip:change', {
|
48154 | tooltip: tooltip,
|
48155 | x: x,
|
48156 | y: y,
|
48157 | items: items
|
48158 | });
|
48159 | tooltip.setContent(title, items);
|
48160 | if (!Util.isEmpty(markersItems)) {
|
48161 | if (self.options.hideMarkers === true) {
|
48162 |
|
48163 | tooltip.set('markerItems', markersItems);
|
48164 | } else {
|
48165 | tooltip.setMarkers(markersItems, Global.tooltipMarker);
|
48166 | }
|
48167 | } else {
|
48168 | tooltip.clearMarkers();
|
48169 | }
|
48170 |
|
48171 | tooltip.setPosition(x, y, target);
|
48172 | tooltip.show();
|
48173 | }
|
48174 | };
|
48175 |
|
48176 | TooltipController.prototype.hideTooltip = function hideTooltip() {
|
48177 | var tooltip = this.tooltip;
|
48178 | var chart = this.chart;
|
48179 | var canvas = this._getCanvas();
|
48180 | this.prePoint = null;
|
48181 | tooltip.hide();
|
48182 | chart.emit('tooltip:hide', {
|
48183 | tooltip: tooltip
|
48184 | });
|
48185 | canvas.draw();
|
48186 | };
|
48187 |
|
48188 | TooltipController.prototype.onMouseMove = function onMouseMove(ev) {
|
48189 | if (Util.isEmpty(ev.views)) {
|
48190 | return;
|
48191 | }
|
48192 |
|
48193 | var lastTimeStamp = this.timeStamp;
|
48194 | var timeStamp = +new Date();
|
48195 | var point = {
|
48196 | x: ev.x,
|
48197 | y: ev.y
|
48198 | };
|
48199 | if (timeStamp - lastTimeStamp > 16) {
|
48200 | var target = void 0;
|
48201 | if (ev.shape && Util.inArray(['point', 'interval', 'polygon', 'schema'], ev.shape.name)) {
|
48202 | target = ev.shape;
|
48203 | }
|
48204 | this.showTooltip(point, ev.views, target);
|
48205 | this.timeStamp = timeStamp;
|
48206 | }
|
48207 | };
|
48208 |
|
48209 | TooltipController.prototype.onMouseOut = function onMouseOut(ev) {
|
48210 | var tooltip = this.tooltip;
|
48211 | var canvas = this._getCanvas();
|
48212 | if (!tooltip.get('visible')) {
|
48213 | return;
|
48214 | }
|
48215 | if (ev && ev.target !== canvas) {
|
48216 | return;
|
48217 | }
|
48218 | if (ev && ev.toElement && (_hasClass(ev.toElement, 'g2-tooltip') || _isParent(ev.toElement, 'g2-tooltip'))) {
|
48219 | return;
|
48220 | }
|
48221 | this.hideTooltip();
|
48222 | };
|
48223 |
|
48224 | TooltipController.prototype.renderTooltip = function renderTooltip() {
|
48225 | var self = this;
|
48226 | if (self.tooltip) {
|
48227 |
|
48228 | return;
|
48229 | }
|
48230 | var chart = self.chart;
|
48231 | var canvas = self._getCanvas();
|
48232 | var defaultCfg = self._getDefaultTooltipCfg();
|
48233 | var options = self.options;
|
48234 | options = Util.deepMix({
|
48235 | plotRange: chart.get('plotRange'),
|
48236 | capture: false,
|
48237 | canvas: canvas,
|
48238 | frontPlot: chart.get('frontPlot'),
|
48239 | backPlot: chart.get('backPlot')
|
48240 | }, defaultCfg, options);
|
48241 | if (options.crosshairs && options.crosshairs.type === 'rect') {
|
48242 | options.zIndex = 0;
|
48243 | }
|
48244 |
|
48245 | options.visible = false;
|
48246 | if (options.shared === false && Util.isNil(options.position)) {
|
48247 | options.position = 'top';
|
48248 | }
|
48249 |
|
48250 | var tooltip = new Tooltip(options);
|
48251 | self.tooltip = tooltip;
|
48252 |
|
48253 | var triggerEvent = self._getTriggerEvent();
|
48254 | if (!tooltip.get('enterable') && triggerEvent === 'plotmove') {
|
48255 |
|
48256 | var tooltipContainer = tooltip.get('container');
|
48257 | if (tooltipContainer) {
|
48258 | tooltipContainer.onmousemove = function (e) {
|
48259 |
|
48260 | var eventObj = self._normalizeEvent(e);
|
48261 | chart.emit(triggerEvent, eventObj);
|
48262 | };
|
48263 | }
|
48264 | }
|
48265 | self._bindEvent();
|
48266 | };
|
48267 |
|
48268 | TooltipController.prototype.showTooltip = function showTooltip(point, views, target) {
|
48269 | var self = this;
|
48270 | if (Util.isEmpty(views) || !point) {
|
48271 | return;
|
48272 | }
|
48273 | if (!this.tooltip) {
|
48274 | this.renderTooltip();
|
48275 | }
|
48276 | var options = self.options;
|
48277 | var markersItems = [];
|
48278 | var items = [];
|
48279 |
|
48280 | Util.each(views, function (view) {
|
48281 | if (!view.get('tooltipEnable')) {
|
48282 |
|
48283 | return true;
|
48284 | }
|
48285 | var geoms = view.get('geoms');
|
48286 | var coord = view.get('coord');
|
48287 | Util.each(geoms, function (geom) {
|
48288 | var type = geom.get('type');
|
48289 | if (geom.get('visible') && geom.get('tooltipCfg') !== false) {
|
48290 | var dataArray = geom.get('dataArray');
|
48291 | if (geom.isShareTooltip() || options.shared === false && Util.inArray(['area', 'line', 'path'], type)) {
|
48292 | Util.each(dataArray, function (obj) {
|
48293 | var tmpPoint = geom.findPoint(point, obj);
|
48294 | if (tmpPoint) {
|
48295 | var subItems = geom.getTipItems(tmpPoint, options.title);
|
48296 | if (Util.indexOf(TYPE_SHOW_MARKERS, type) !== -1) {
|
48297 | Util.each(subItems, function (v) {
|
48298 | var point = v.point;
|
48299 | if (point && point.x && point.y) {
|
48300 |
|
48301 | var x = Util.isArray(point.x) ? point.x[point.x.length - 1] : point.x;
|
48302 | var y = Util.isArray(point.y) ? point.y[point.y.length - 1] : point.y;
|
48303 | point = coord.applyMatrix(x, y, 1);
|
48304 | v.x = point[0];
|
48305 | v.y = point[1];
|
48306 | v.showMarker = true;
|
48307 | markersItems.push(v);
|
48308 | }
|
48309 | });
|
48310 | }
|
48311 | items = items.concat(subItems);
|
48312 | }
|
48313 | });
|
48314 | } else {
|
48315 | var geomContainer = geom.get('shapeContainer');
|
48316 | var canvas = geomContainer.get('canvas');
|
48317 | var pixelRatio = canvas.get('pixelRatio');
|
48318 | var shape = geomContainer.getShape(point.x * pixelRatio, point.y * pixelRatio);
|
48319 | if (shape && shape.get('visible') && shape.get('origin')) {
|
48320 | items = geom.getTipItems(shape.get('origin'), options.title);
|
48321 | }
|
48322 | }
|
48323 | }
|
48324 | });
|
48325 |
|
48326 | Util.each(items, function (item) {
|
48327 | var point = item.point;
|
48328 | var x = Util.isArray(point.x) ? point.x[point.x.length - 1] : point.x;
|
48329 | var y = Util.isArray(point.y) ? point.y[point.y.length - 1] : point.y;
|
48330 | point = coord.applyMatrix(x, y, 1);
|
48331 | item.x = point[0];
|
48332 | item.y = point[1];
|
48333 | });
|
48334 | });
|
48335 |
|
48336 | if (items.length) {
|
48337 | var first = items[0];
|
48338 |
|
48339 |
|
48340 | if (!items.every(function (item) {
|
48341 | return item.title === first.title;
|
48342 | })) {
|
48343 | var nearestItem = first;
|
48344 | var nearestDistance = Infinity;
|
48345 | items.forEach(function (item) {
|
48346 | var distance = Vector2.distance([point.x, point.y], [item.x, item.y]);
|
48347 | if (distance < nearestDistance) {
|
48348 | nearestDistance = distance;
|
48349 | nearestItem = item;
|
48350 | }
|
48351 | });
|
48352 | items = items.filter(function (item) {
|
48353 | return item.title === nearestItem.title;
|
48354 | });
|
48355 | markersItems = markersItems.filter(function (item) {
|
48356 | return item.title === nearestItem.title;
|
48357 | });
|
48358 | }
|
48359 |
|
48360 | if (options.shared === false && items.length > 1) {
|
48361 | var snapItem = items[0];
|
48362 | var min = Math.abs(point.y - snapItem.y);
|
48363 | Util.each(items, function (aItem) {
|
48364 | if (Math.abs(point.y - aItem.y) <= min) {
|
48365 | snapItem = aItem;
|
48366 | min = Math.abs(point.y - aItem.y);
|
48367 | }
|
48368 | });
|
48369 | if (snapItem && snapItem.x && snapItem.y) {
|
48370 | markersItems = [snapItem];
|
48371 | }
|
48372 | items = [snapItem];
|
48373 | }
|
48374 |
|
48375 |
|
48376 |
|
48377 |
|
48378 | var title = first.title || first.name;
|
48379 |
|
48380 | self._setTooltip(title, point, items, markersItems, target);
|
48381 | } else {
|
48382 | self.hideTooltip();
|
48383 | }
|
48384 | };
|
48385 |
|
48386 | TooltipController.prototype.clear = function clear() {
|
48387 | var tooltip = this.tooltip;
|
48388 | tooltip && tooltip.destroy();
|
48389 | this.tooltip = null;
|
48390 | this.prePoint = null;
|
48391 | this._offEvent();
|
48392 | };
|
48393 |
|
48394 | return TooltipController;
|
48395 | }();
|
48396 |
|
48397 | module.exports = TooltipController;
|
48398 |
|
48399 | }),
|
48400 |
|
48401 | (function(module, exports, __webpack_require__) {
|
48402 |
|
48403 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
48404 |
|
48405 |
|
48406 |
|
48407 |
|
48408 |
|
48409 | var Util = __webpack_require__(0);
|
48410 |
|
48411 | function isSameShape(shape1, shape2) {
|
48412 | if (Util.isNil(shape1) || Util.isNil(shape2)) {
|
48413 | return false;
|
48414 | }
|
48415 | var shape1Origin = shape1.get('origin');
|
48416 | var shape2Origin = shape2.get('origin');
|
48417 |
|
48418 |
|
48419 | if (Util.isNil(shape1Origin) && Util.isNil(shape2Origin)) {
|
48420 | return Util.isEqual(shape1, shape2);
|
48421 | }
|
48422 |
|
48423 | return Util.isEqual(shape1Origin, shape2Origin);
|
48424 | }
|
48425 |
|
48426 | function registerData(eventObj) {
|
48427 | if (eventObj.shape && eventObj.shape.get('origin')) {
|
48428 | eventObj.data = eventObj.shape.get('origin');
|
48429 | }
|
48430 | }
|
48431 |
|
48432 | var EventController = function () {
|
48433 | function EventController(cfg) {
|
48434 | _classCallCheck(this, EventController);
|
48435 |
|
48436 | this.view = null;
|
48437 | this.canvas = null;
|
48438 | Util.assign(this, cfg);
|
48439 |
|
48440 | this._init();
|
48441 | }
|
48442 |
|
48443 | EventController.prototype._init = function _init() {
|
48444 | this.pixelRatio = this.canvas.get('pixelRatio');
|
48445 | };
|
48446 |
|
48447 | EventController.prototype._getShapeEventObj = function _getShapeEventObj(ev) {
|
48448 | return {
|
48449 | x: ev.x / this.pixelRatio,
|
48450 | y: ev.y / this.pixelRatio,
|
48451 | target: ev.target,
|
48452 | toElement: ev.event.toElement || ev.event.relatedTarget
|
48453 | };
|
48454 | };
|
48455 |
|
48456 | EventController.prototype._getShape = function _getShape(x, y) {
|
48457 | var view = this.view;
|
48458 | var container = view.get('canvas');
|
48459 | return container.getShape(x, y);
|
48460 | };
|
48461 |
|
48462 | EventController.prototype._getPointInfo = function _getPointInfo(ev) {
|
48463 | var view = this.view;
|
48464 | var point = {
|
48465 | x: ev.x / this.pixelRatio,
|
48466 | y: ev.y / this.pixelRatio
|
48467 | };
|
48468 | var views = view.getViewsByPoint(point);
|
48469 | point.views = views;
|
48470 | return point;
|
48471 | };
|
48472 |
|
48473 | EventController.prototype._getEventObj = function _getEventObj(ev, point, views) {
|
48474 | return {
|
48475 | x: point.x,
|
48476 | y: point.y,
|
48477 | target: ev.target,
|
48478 | toElement: ev.event.toElement || ev.event.relatedTarget,
|
48479 | views: views
|
48480 | };
|
48481 | };
|
48482 |
|
48483 | EventController.prototype.bindEvents = function bindEvents() {
|
48484 | var canvas = this.canvas;
|
48485 | canvas.on('mousedown', Util.wrapBehavior(this, 'onDown'));
|
48486 | canvas.on('mousemove', Util.wrapBehavior(this, 'onMove'));
|
48487 | canvas.on('mouseleave', Util.wrapBehavior(this, 'onOut'));
|
48488 | canvas.on('mouseup', Util.wrapBehavior(this, 'onUp'));
|
48489 | canvas.on('click', Util.wrapBehavior(this, 'onClick'));
|
48490 | canvas.on('dblclick', Util.wrapBehavior(this, 'onClick'));
|
48491 | canvas.on('touchstart', Util.wrapBehavior(this, 'onTouchstart'));
|
48492 | canvas.on('touchmove', Util.wrapBehavior(this, 'onTouchmove'));
|
48493 | canvas.on('touchend', Util.wrapBehavior(this, 'onTouchend'));
|
48494 | };
|
48495 |
|
48496 | EventController.prototype._triggerShapeEvent = function _triggerShapeEvent(shape, eventName, eventObj) {
|
48497 | if (shape && shape.name) {
|
48498 | var view = this.view;
|
48499 | if (view.isShapeInView(shape)) {
|
48500 | var name = shape.name + ':' + eventName;
|
48501 | eventObj.view = view;
|
48502 | eventObj.appendInfo = shape.get('appendInfo');
|
48503 | view.emit(name, eventObj);
|
48504 | }
|
48505 |
|
48506 |
|
48507 |
|
48508 |
|
48509 | }
|
48510 | };
|
48511 |
|
48512 | EventController.prototype.onDown = function onDown(ev) {
|
48513 | var view = this.view;
|
48514 | var eventObj = this._getShapeEventObj(ev);
|
48515 | eventObj.shape = this.currentShape;
|
48516 | registerData(eventObj);
|
48517 | view.emit('mousedown', eventObj);
|
48518 | this._triggerShapeEvent(this.currentShape, 'mousedown', eventObj);
|
48519 | };
|
48520 |
|
48521 | EventController.prototype.onMove = function onMove(ev) {
|
48522 | var self = this;
|
48523 | var view = self.view;
|
48524 | var currentShape = self.currentShape;
|
48525 | var shape = self._getShape(ev.x, ev.y);
|
48526 | var eventObj = self._getShapeEventObj(ev);
|
48527 | eventObj.shape = shape;
|
48528 | registerData(eventObj);
|
48529 | view.emit('mousemove', eventObj);
|
48530 | self._triggerShapeEvent(shape, 'mousemove', eventObj);
|
48531 |
|
48532 | if (currentShape && !isSameShape(currentShape, shape)) {
|
48533 | var leaveObj = self._getShapeEventObj(ev);
|
48534 | leaveObj.shape = currentShape;
|
48535 | leaveObj.toShape = shape;
|
48536 | registerData(leaveObj);
|
48537 | self._triggerShapeEvent(currentShape, 'mouseleave', leaveObj);
|
48538 | }
|
48539 |
|
48540 | if (shape && !isSameShape(currentShape, shape)) {
|
48541 | var enterObj = self._getShapeEventObj(ev);
|
48542 | enterObj.shape = shape;
|
48543 | enterObj.fromShape = currentShape;
|
48544 | registerData(enterObj);
|
48545 | self._triggerShapeEvent(shape, 'mouseenter', enterObj);
|
48546 | }
|
48547 | self.currentShape = shape;
|
48548 |
|
48549 | var point = self._getPointInfo(ev);
|
48550 | var preViews = self.curViews || [];
|
48551 |
|
48552 | if (preViews.length === 0 && point.views.length) {
|
48553 | view.emit('plotenter', self._getEventObj(ev, point, point.views));
|
48554 | }
|
48555 | if (preViews.length && point.views.length === 0) {
|
48556 | view.emit('plotleave', self._getEventObj(ev, point, preViews));
|
48557 | }
|
48558 |
|
48559 | if (point.views.length) {
|
48560 | eventObj = self._getEventObj(ev, point, point.views);
|
48561 | eventObj.shape = shape;
|
48562 | registerData(eventObj);
|
48563 | view.emit('plotmove', eventObj);
|
48564 | }
|
48565 |
|
48566 | self.curViews = point.views;
|
48567 | };
|
48568 |
|
48569 | EventController.prototype.onOut = function onOut(ev) {
|
48570 | var self = this;
|
48571 | var view = self.view;
|
48572 | var point = self._getPointInfo(ev);
|
48573 | view.emit('plotleave', self._getEventObj(ev, point, self.curViews));
|
48574 | };
|
48575 |
|
48576 | EventController.prototype.onUp = function onUp(ev) {
|
48577 | var view = this.view;
|
48578 | var eventObj = this._getShapeEventObj(ev);
|
48579 | eventObj.shape = this.currentShape;
|
48580 | view.emit('mouseup', eventObj);
|
48581 | this._triggerShapeEvent(this.currentShape, 'mouseup', eventObj);
|
48582 | };
|
48583 |
|
48584 | EventController.prototype.onClick = function onClick(ev) {
|
48585 | var self = this;
|
48586 | var view = self.view;
|
48587 | var shape = self._getShape(ev.x, ev.y);
|
48588 | var shapeEventObj = self._getShapeEventObj(ev);
|
48589 | shapeEventObj.shape = shape;
|
48590 | registerData(shapeEventObj);
|
48591 | view.emit('click', shapeEventObj);
|
48592 | self._triggerShapeEvent(shape, ev.type, shapeEventObj);
|
48593 | self.currentShape = shape;
|
48594 |
|
48595 | var point = self._getPointInfo(ev);
|
48596 | var views = point.views;
|
48597 | if (!Util.isEmpty(views)) {
|
48598 | var eventObj = self._getEventObj(ev, point, views);
|
48599 | if (self.currentShape) {
|
48600 | var _shape = self.currentShape;
|
48601 | eventObj.shape = _shape;
|
48602 | registerData(eventObj);
|
48603 |
|
48604 | }
|
48605 | view.emit('plotclick', eventObj);
|
48606 | if (ev.type === 'dblclick') {
|
48607 | view.emit('plotdblclick', eventObj);
|
48608 | view.emit('dblclick', shapeEventObj);
|
48609 | }
|
48610 | }
|
48611 | };
|
48612 |
|
48613 | EventController.prototype.onTouchstart = function onTouchstart(ev) {
|
48614 | var view = this.view;
|
48615 | var shape = this._getShape(ev.x, ev.y);
|
48616 | var eventObj = this._getShapeEventObj(ev);
|
48617 | eventObj.shape = shape;
|
48618 | registerData(eventObj);
|
48619 | view.emit('touchstart', eventObj);
|
48620 | this._triggerShapeEvent(shape, 'touchstart', eventObj);
|
48621 | this.currentShape = shape;
|
48622 | };
|
48623 |
|
48624 | EventController.prototype.onTouchmove = function onTouchmove(ev) {
|
48625 | var view = this.view;
|
48626 | var shape = this._getShape(ev.x, ev.y);
|
48627 | var eventObj = this._getShapeEventObj(ev);
|
48628 | eventObj.shape = shape;
|
48629 | registerData(eventObj);
|
48630 | view.emit('touchmove', eventObj);
|
48631 | this._triggerShapeEvent(shape, 'touchmove', eventObj);
|
48632 | this.currentShape = shape;
|
48633 | };
|
48634 |
|
48635 | EventController.prototype.onTouchend = function onTouchend(ev) {
|
48636 | var view = this.view;
|
48637 | var eventObj = this._getShapeEventObj(ev);
|
48638 | eventObj.shape = this.currentShape;
|
48639 | registerData(eventObj);
|
48640 | view.emit('touchend', eventObj);
|
48641 | this._triggerShapeEvent(this.currentShape, 'touchend', eventObj);
|
48642 | };
|
48643 |
|
48644 | EventController.prototype.clearEvents = function clearEvents() {
|
48645 | var canvas = this.canvas;
|
48646 | canvas.off('mousemove', Util.getWrapBehavior(this, 'onMove'));
|
48647 | canvas.off('mouseleave', Util.getWrapBehavior(this, 'onOut'));
|
48648 | canvas.off('mousedown', Util.getWrapBehavior(this, 'onDown'));
|
48649 | canvas.off('mouseup', Util.getWrapBehavior(this, 'onUp'));
|
48650 | canvas.off('click', Util.getWrapBehavior(this, 'onClick'));
|
48651 | canvas.off('dblclick', Util.getWrapBehavior(this, 'onClick'));
|
48652 | canvas.off('touchstart', Util.getWrapBehavior(this, 'onTouchstart'));
|
48653 | canvas.off('touchmove', Util.getWrapBehavior(this, 'onTouchmove'));
|
48654 | canvas.off('touchend', Util.getWrapBehavior(this, 'onTouchend'));
|
48655 | };
|
48656 |
|
48657 | return EventController;
|
48658 | }();
|
48659 |
|
48660 | module.exports = EventController;
|
48661 |
|
48662 | }),
|
48663 |
|
48664 | (function(module, exports, __webpack_require__) {
|
48665 |
|
48666 |
|
48667 |
|
48668 |
|
48669 |
|
48670 | var Util = __webpack_require__(0);
|
48671 | var Animate = __webpack_require__(68);
|
48672 |
|
48673 | var _require = __webpack_require__(2),
|
48674 | MatrixUtil = _require.MatrixUtil;
|
48675 |
|
48676 | var mat3 = MatrixUtil.mat3;
|
48677 |
|
48678 |
|
48679 |
|
48680 | function getShapes(container, viewId) {
|
48681 | var shapes = [];
|
48682 | if (container.get('animate') === false) {
|
48683 | return [];
|
48684 | }
|
48685 | var children = container.get('children');
|
48686 | Util.each(children, function (child) {
|
48687 | if (child.isGroup) {
|
48688 | shapes = shapes.concat(getShapes(child, viewId));
|
48689 | } else if (child.isShape && child._id) {
|
48690 | var id = child._id;
|
48691 | id = id.split('-')[0];
|
48692 | if (id === viewId) {
|
48693 | shapes.push(child);
|
48694 | }
|
48695 | }
|
48696 | });
|
48697 |
|
48698 | return shapes;
|
48699 | }
|
48700 |
|
48701 | function cache(shapes) {
|
48702 | var rst = {};
|
48703 | Util.each(shapes, function (shape) {
|
48704 | if (!shape._id || shape.isClip) return;
|
48705 | var id = shape._id;
|
48706 | rst[id] = {
|
48707 | _id: id,
|
48708 | type: shape.get('type'),
|
48709 | attrs: Util.cloneDeep(shape.__attrs),
|
48710 | name: shape.name,
|
48711 | index: shape.get('index'),
|
48712 | animateCfg: shape.get('animateCfg'),
|
48713 | coord: shape.get('coord')
|
48714 | };
|
48715 | });
|
48716 | return rst;
|
48717 | }
|
48718 |
|
48719 | function getAnimate(geomType, coord, animationType, animationName) {
|
48720 | var result = void 0;
|
48721 | if (animationName) {
|
48722 | result = Animate.Action[animationType][animationName];
|
48723 | } else {
|
48724 | result = Animate.getAnimation(geomType, coord, animationType);
|
48725 | }
|
48726 | return result;
|
48727 | }
|
48728 |
|
48729 | function getAnimateCfg(geomType, animationType, animateCfg) {
|
48730 | var defaultCfg = Animate.getAnimateCfg(geomType, animationType);
|
48731 | if (animateCfg && animateCfg[animationType]) {
|
48732 | return Util.deepMix({}, defaultCfg, animateCfg[animationType]);
|
48733 | }
|
48734 | return defaultCfg;
|
48735 | }
|
48736 |
|
48737 | function addAnimate(cache, shapes, canvas, isUpdate) {
|
48738 | var animate = void 0;
|
48739 | var animateCfg = void 0;
|
48740 | var canvasDrawn = false;
|
48741 |
|
48742 | if (isUpdate) {
|
48743 |
|
48744 | var updateShapes = [];
|
48745 | var newShapes = [];
|
48746 | Util.each(shapes, function (shape) {
|
48747 | var result = cache[shape._id];
|
48748 | if (!result) {
|
48749 | newShapes.push(shape);
|
48750 | } else {
|
48751 | shape.setSilent('cacheShape', result);
|
48752 | updateShapes.push(shape);
|
48753 | delete cache[shape._id];
|
48754 | }
|
48755 | });
|
48756 |
|
48757 | Util.each(cache, function (deletedShape) {
|
48758 | var name = deletedShape.name,
|
48759 | coord = deletedShape.coord,
|
48760 | _id = deletedShape._id,
|
48761 | attrs = deletedShape.attrs,
|
48762 | index = deletedShape.index,
|
48763 | type = deletedShape.type;
|
48764 |
|
48765 | animateCfg = getAnimateCfg(name, 'leave', deletedShape.animateCfg);
|
48766 | animate = getAnimate(name, coord, 'leave', animateCfg.animation);
|
48767 | if (Util.isFunction(animate)) {
|
48768 | var tempShape = canvas.addShape(type, {
|
48769 | attrs: attrs,
|
48770 | index: index
|
48771 | });
|
48772 | tempShape._id = _id;
|
48773 | tempShape.name = name;
|
48774 | if (coord) {
|
48775 | var tempShapeMatrix = tempShape.getMatrix();
|
48776 | var finalMatrix = mat3.multiply([], tempShapeMatrix, coord.matrix);
|
48777 | tempShape.setMatrix(finalMatrix);
|
48778 | }
|
48779 | canvasDrawn = true;
|
48780 | animate(tempShape, animateCfg, coord);
|
48781 | }
|
48782 | });
|
48783 |
|
48784 | Util.each(updateShapes, function (updateShape) {
|
48785 | var name = updateShape.name;
|
48786 | var coord = updateShape.get('coord');
|
48787 | var cacheAttrs = updateShape.get('cacheShape').attrs;
|
48788 |
|
48789 | if (!Util.isEqual(cacheAttrs, updateShape.__attrs)) {
|
48790 | animateCfg = getAnimateCfg(name, 'update', updateShape.get('animateCfg'));
|
48791 | animate = getAnimate(name, coord, 'update', animateCfg.animation);
|
48792 | if (Util.isFunction(animate)) {
|
48793 | animate(updateShape, animateCfg, coord);
|
48794 | } else {
|
48795 | var endState = Util.cloneDeep(updateShape.__attrs);
|
48796 |
|
48797 | updateShape.attr(cacheAttrs);
|
48798 | updateShape.animate(endState, animateCfg.duration, animateCfg.easing, function () {
|
48799 | updateShape.setSilent('cacheShape', null);
|
48800 | });
|
48801 | }
|
48802 | canvasDrawn = true;
|
48803 | }
|
48804 | });
|
48805 |
|
48806 | Util.each(newShapes, function (newShape) {
|
48807 | var name = newShape.name;
|
48808 | var coord = newShape.get('coord');
|
48809 |
|
48810 | animateCfg = getAnimateCfg(name, 'enter', newShape.get('animateCfg'));
|
48811 | animate = getAnimate(name, coord, 'enter', animateCfg.animation);
|
48812 | if (Util.isFunction(animate)) {
|
48813 | animate(newShape, animateCfg, coord);
|
48814 | canvasDrawn = true;
|
48815 | }
|
48816 | });
|
48817 | } else {
|
48818 | Util.each(shapes, function (shape) {
|
48819 | var name = shape.name;
|
48820 | var coord = shape.get('coord');
|
48821 | animateCfg = getAnimateCfg(name, 'appear', shape.get('animateCfg'));
|
48822 | animate = getAnimate(name, coord, 'appear', animateCfg.animation);
|
48823 | if (Util.isFunction(animate)) {
|
48824 | animate(shape, animateCfg, coord);
|
48825 | canvasDrawn = true;
|
48826 | }
|
48827 | });
|
48828 | }
|
48829 | return canvasDrawn;
|
48830 | }
|
48831 |
|
48832 | module.exports = {
|
48833 | execAnimation: function execAnimation(view, isUpdate) {
|
48834 | var viewContainer = view.get('middlePlot');
|
48835 | var axisContainer = view.get('backPlot');
|
48836 | var viewId = view.get('_id');
|
48837 | var canvas = view.get('canvas');
|
48838 | var caches = canvas.get(viewId + 'caches') || [];
|
48839 | var shapes = getShapes(viewContainer, viewId);
|
48840 | var axisShapes = getShapes(axisContainer, viewId);
|
48841 | var cacheShapes = shapes.concat(axisShapes);
|
48842 | canvas.setSilent(viewId + 'caches', cache(cacheShapes));
|
48843 | var drawn = void 0;
|
48844 | if (isUpdate) {
|
48845 | drawn = addAnimate(caches, cacheShapes, canvas, isUpdate);
|
48846 | } else {
|
48847 | drawn = addAnimate(caches, shapes, canvas, isUpdate);
|
48848 | }
|
48849 | if (!drawn) {
|
48850 | canvas.draw();
|
48851 | }
|
48852 | }
|
48853 | };
|
48854 |
|
48855 | }),
|
48856 |
|
48857 | (function(module, exports, __webpack_require__) {
|
48858 |
|
48859 |
|
48860 |
|
48861 |
|
48862 |
|
48863 |
|
48864 | var Facets = {};
|
48865 |
|
48866 | Facets.Rect = __webpack_require__(124);
|
48867 | Facets.List = __webpack_require__(125);
|
48868 | Facets.Circle = __webpack_require__(361);
|
48869 | Facets.Tree = __webpack_require__(362);
|
48870 | Facets.Mirror = __webpack_require__(363);
|
48871 | Facets.Matrix = __webpack_require__(364);
|
48872 |
|
48873 | module.exports = Facets;
|
48874 |
|
48875 | }),
|
48876 |
|
48877 | (function(module, exports, __webpack_require__) {
|
48878 |
|
48879 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
48880 |
|
48881 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
48882 |
|
48883 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
48884 |
|
48885 |
|
48886 |
|
48887 |
|
48888 |
|
48889 |
|
48890 | var Base = __webpack_require__(45);
|
48891 |
|
48892 | function getPoint(center, r, angle) {
|
48893 | return {
|
48894 | x: center.x + r * Math.cos(angle),
|
48895 | y: center.y + r * Math.sin(angle)
|
48896 | };
|
48897 | }
|
48898 |
|
48899 | var Circle = function (_Base) {
|
48900 | _inherits(Circle, _Base);
|
48901 |
|
48902 | function Circle() {
|
48903 | _classCallCheck(this, Circle);
|
48904 |
|
48905 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
48906 | }
|
48907 |
|
48908 | Circle.prototype.getDefaultCfg = function getDefaultCfg() {
|
48909 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
48910 | cfg.type = 'circle';
|
48911 | return cfg;
|
48912 | };
|
48913 |
|
48914 | Circle.prototype.getRegion = function getRegion(count, index) {
|
48915 | var r = 1 / 2;
|
48916 | var avgAngle = Math.PI * 2 / count;
|
48917 | var angle = -1 * Math.PI / 2 + avgAngle * index;
|
48918 | var facetR = r / (1 + 1 / Math.sin(avgAngle / 2));
|
48919 | var center = { x: 0.5, y: 0.5 };
|
48920 | var middle = getPoint(center, r - facetR, angle);
|
48921 | var startAngle = Math.PI * 5 / 4;
|
48922 | var endAngle = Math.PI * 1 / 4;
|
48923 |
|
48924 | return {
|
48925 | start: getPoint(middle, facetR, startAngle),
|
48926 | end: getPoint(middle, facetR, endAngle)
|
48927 | };
|
48928 | };
|
48929 |
|
48930 | Circle.prototype.generateFacets = function generateFacets(data) {
|
48931 | var self = this;
|
48932 | var fields = self.fields;
|
48933 | var field = fields[0];
|
48934 | if (!field) {
|
48935 | throw 'Please specify for the field for facet!';
|
48936 | }
|
48937 | var values = self.getFieldValues(field, data);
|
48938 | var count = values.length;
|
48939 | var rst = [];
|
48940 | values.forEach(function (value, index) {
|
48941 | var conditions = [{ field: field, value: value, values: values }];
|
48942 | var filter = self.getFilter(conditions);
|
48943 | var subData = data.filter(filter);
|
48944 | var facet = {
|
48945 | type: self.type,
|
48946 | colValue: value,
|
48947 | colField: field,
|
48948 | colIndex: index,
|
48949 | cols: count,
|
48950 | rows: 1,
|
48951 | rowIndex: 0,
|
48952 | data: subData,
|
48953 | region: self.getRegion(count, index)
|
48954 | };
|
48955 | rst.push(facet);
|
48956 | });
|
48957 | return rst;
|
48958 | };
|
48959 |
|
48960 | return Circle;
|
48961 | }(Base);
|
48962 |
|
48963 | module.exports = Circle;
|
48964 |
|
48965 | }),
|
48966 |
|
48967 | (function(module, exports, __webpack_require__) {
|
48968 |
|
48969 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
48970 |
|
48971 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
48972 |
|
48973 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
48974 |
|
48975 |
|
48976 |
|
48977 |
|
48978 |
|
48979 |
|
48980 | var assign = __webpack_require__(60);
|
48981 | var Base = __webpack_require__(45);
|
48982 |
|
48983 | var Tree = function (_Base) {
|
48984 | _inherits(Tree, _Base);
|
48985 |
|
48986 | function Tree() {
|
48987 | _classCallCheck(this, Tree);
|
48988 |
|
48989 | return _possibleConstructorReturn(this, _Base.apply(this, arguments));
|
48990 | }
|
48991 |
|
48992 | Tree.prototype.getDefaultCfg = function getDefaultCfg() {
|
48993 | var cfg = _Base.prototype.getDefaultCfg.call(this);
|
48994 | cfg.type = 'tree';
|
48995 | cfg.line = {
|
48996 | lineWidth: 1,
|
48997 | stroke: '#ddd'
|
48998 | };
|
48999 | cfg.lineSmooth = false;
|
49000 | return cfg;
|
49001 | };
|
49002 |
|
49003 | Tree.prototype.generateFacets = function generateFacets(data) {
|
49004 | var self = this;
|
49005 | var fields = self.fields;
|
49006 | if (!fields.length) {
|
49007 | throw 'Please specify for the fields for facet!';
|
49008 | }
|
49009 | var rst = [];
|
49010 | var root = self.getRootFacet(data);
|
49011 |
|
49012 | rst.push(root);
|
49013 |
|
49014 | root.children = self.getChildFacets(data, 1, rst);
|
49015 | self.setRegion(rst);
|
49016 | return rst;
|
49017 | };
|
49018 |
|
49019 | Tree.prototype.getRootFacet = function getRootFacet(data) {
|
49020 | var self = this;
|
49021 | var facet = {
|
49022 | type: self.type,
|
49023 | rows: self.getRows(),
|
49024 | rowIndex: 0,
|
49025 | colIndex: 0,
|
49026 | colValue: self.rootTitle,
|
49027 | data: data
|
49028 | };
|
49029 | return facet;
|
49030 | };
|
49031 |
|
49032 | Tree.prototype.getRows = function getRows() {
|
49033 | return this.fields.length + 1;
|
49034 | };
|
49035 |
|
49036 |
|
49037 |
|
49038 |
|
49039 | Tree.prototype.getChildFacets = function getChildFacets(data, level, arr) {
|
49040 | var self = this;
|
49041 | var fields = self.fields;
|
49042 | var length = fields.length;
|
49043 | if (length < level) {
|
49044 | return;
|
49045 | }
|
49046 | var rst = [];
|
49047 | var field = fields[level - 1];
|
49048 | var values = self.getFieldValues(field, data);
|
49049 | values.forEach(function (value, index) {
|
49050 | var conditions = [{ field: field, value: value, values: values }];
|
49051 | var filter = self.getFilter(conditions);
|
49052 | var subData = data.filter(filter);
|
49053 | if (subData.length) {
|
49054 | var facet = {
|
49055 | type: self.type,
|
49056 | colValue: value,
|
49057 | colField: field,
|
49058 | colIndex: index,
|
49059 | rows: self.getRows(),
|
49060 | rowIndex: level,
|
49061 | data: subData,
|
49062 | children: self.getChildFacets(subData, level + 1, arr)
|
49063 | };
|
49064 | rst.push(facet);
|
49065 | arr.push(facet);
|
49066 | }
|
49067 | });
|
49068 | return rst;
|
49069 | };
|
49070 |
|
49071 |
|
49072 |
|
49073 |
|
49074 | Tree.prototype.setRegion = function setRegion(facets) {
|
49075 | var self = this;
|
49076 | self.forceColIndex(facets);
|
49077 | facets.forEach(function (facet) {
|
49078 | facet.region = self.getRegion(facet.rows, facet.cols, facet.colIndex, facet.rowIndex);
|
49079 | });
|
49080 | };
|
49081 |
|
49082 |
|
49083 |
|
49084 |
|
49085 | Tree.prototype.forceColIndex = function forceColIndex(facets) {
|
49086 | var self = this;
|
49087 | var leafs = [];
|
49088 | var index = 0;
|
49089 | facets.forEach(function (facet) {
|
49090 | if (self.isLeaf(facet)) {
|
49091 | leafs.push(facet);
|
49092 | facet.colIndex = index;
|
49093 | index++;
|
49094 | }
|
49095 | });
|
49096 |
|
49097 | leafs.forEach(function (facet) {
|
49098 | facet.cols = leafs.length;
|
49099 | });
|
49100 | var maxLevel = self.fields.length;
|
49101 | for (var i = maxLevel - 1; i >= 0; i--) {
|
49102 | var levelFacets = self.getFacetsByLevel(facets, i);
|
49103 |
|
49104 | for (var j = 0; j < levelFacets.length; j++) {
|
49105 | var facet = levelFacets[j];
|
49106 | if (!self.isLeaf(facet)) {
|
49107 | facet.originColIndex = facet.colIndex;
|
49108 | facet.colIndex = self.getRegionIndex(facet.children);
|
49109 | facet.cols = leafs.length;
|
49110 | }
|
49111 | }
|
49112 | }
|
49113 | };
|
49114 |
|
49115 |
|
49116 |
|
49117 |
|
49118 | Tree.prototype.getFacetsByLevel = function getFacetsByLevel(facets, level) {
|
49119 | var rst = [];
|
49120 | facets.forEach(function (facet) {
|
49121 | if (facet.rowIndex === level) {
|
49122 | rst.push(facet);
|
49123 | }
|
49124 | });
|
49125 | return rst;
|
49126 | };
|
49127 |
|
49128 |
|
49129 |
|
49130 |
|
49131 | Tree.prototype.getRegion = function getRegion(rows, cols, xIndex, yIndex) {
|
49132 | var xWidth = 1 / cols;
|
49133 | var yWidth = 1 / rows;
|
49134 |
|
49135 | var start = {
|
49136 | x: xWidth * xIndex,
|
49137 | y: yWidth * yIndex
|
49138 | };
|
49139 |
|
49140 | var end = {
|
49141 | x: start.x + xWidth,
|
49142 | y: start.y + yWidth * 2 / 3
|
49143 | };
|
49144 | return {
|
49145 | start: start,
|
49146 | end: end
|
49147 | };
|
49148 | };
|
49149 |
|
49150 |
|
49151 |
|
49152 |
|
49153 | Tree.prototype.getRegionIndex = function getRegionIndex(children) {
|
49154 | var first = children[0];
|
49155 | var last = children[children.length - 1];
|
49156 | return (last.colIndex - first.colIndex) / 2 + first.colIndex;
|
49157 | };
|
49158 |
|
49159 |
|
49160 |
|
49161 |
|
49162 | Tree.prototype.isLeaf = function isLeaf(facet) {
|
49163 | return !facet.children || !facet.children.length;
|
49164 | };
|
49165 |
|
49166 | Tree.prototype.setXAxis = function setXAxis(xField, axes, facet) {
|
49167 |
|
49168 | if (facet.rowIndex !== facet.rows - 1) {
|
49169 | axes[xField].label = null;
|
49170 | axes[xField].title = null;
|
49171 | }
|
49172 | };
|
49173 |
|
49174 |
|
49175 |
|
49176 |
|
49177 | Tree.prototype.setYAxis = function setYAxis(yField, axes, facet) {
|
49178 | if (facet.originColIndex !== 0 && facet.colIndex !== 0) {
|
49179 | axes[yField].title = null;
|
49180 | axes[yField].label = null;
|
49181 | }
|
49182 | };
|
49183 |
|
49184 |
|
49185 |
|
49186 |
|
49187 | Tree.prototype.onPaint = function onPaint() {
|
49188 | _Base.prototype.onPaint.call(this);
|
49189 | this.group.clear();
|
49190 | if (this.facets && this.line) {
|
49191 | this.drawLines(this.facets, this.group);
|
49192 | }
|
49193 | };
|
49194 |
|
49195 | Tree.prototype.drawLines = function drawLines(facets, group) {
|
49196 | var self = this;
|
49197 | var lineGroup = group.addGroup();
|
49198 | facets.forEach(function (facet) {
|
49199 | if (!self.isLeaf(facet)) {
|
49200 | var children = facet.children;
|
49201 | self._addFacetLines(facet, children, lineGroup);
|
49202 | }
|
49203 | });
|
49204 | };
|
49205 |
|
49206 |
|
49207 |
|
49208 |
|
49209 | Tree.prototype._addFacetLines = function _addFacetLines(facet, children, group) {
|
49210 | var self = this;
|
49211 | var view = facet.view;
|
49212 | var region = view.getViewRegion();
|
49213 | var start = {
|
49214 | x: region.start.x + (region.end.x - region.start.x) / 2,
|
49215 | y: region.start.y
|
49216 | };
|
49217 |
|
49218 | children.forEach(function (subFacet) {
|
49219 | var subRegion = subFacet.view.getViewRegion();
|
49220 | var end = {
|
49221 | x: subRegion.start.x + (subRegion.end.x - subRegion.start.x) / 2,
|
49222 | y: subRegion.end.y
|
49223 | };
|
49224 | var middle1 = {
|
49225 | x: start.x,
|
49226 | y: start.y + (end.y - start.y) / 2
|
49227 | };
|
49228 | var middle2 = {
|
49229 | x: end.x,
|
49230 | y: middle1.y
|
49231 | };
|
49232 | self._drawLine([start, middle1, middle2, end], group);
|
49233 | });
|
49234 | };
|
49235 |
|
49236 | Tree.prototype._getPath = function _getPath(points) {
|
49237 | var self = this;
|
49238 | var path = [];
|
49239 | var smooth = self.lineSmooth;
|
49240 | if (smooth) {
|
49241 | path.push(['M', points[0].x, points[0].y]);
|
49242 | path.push(['C', points[1].x, points[1].y, points[2].x, points[2].y, points[3].x, points[3].y]);
|
49243 | } else {
|
49244 | points.forEach(function (point, index) {
|
49245 | if (index === 0) {
|
49246 | path.push(['M', point.x, point.y]);
|
49247 | } else {
|
49248 | path.push(['L', point.x, point.y]);
|
49249 | }
|
49250 | });
|
49251 | }
|
49252 |
|
49253 | return path;
|
49254 | };
|
49255 |
|
49256 |
|
49257 |
|
49258 |
|
49259 | Tree.prototype._drawLine = function _drawLine(points, group) {
|
49260 | var self = this;
|
49261 | var path = self._getPath(points);
|
49262 | var line = self.line;
|
49263 | group.addShape('path', {
|
49264 | attrs: assign({
|
49265 | path: path
|
49266 | }, line)
|
49267 | });
|
49268 | };
|
49269 |
|
49270 | return Tree;
|
49271 | }(Base);
|
49272 |
|
49273 | module.exports = Tree;
|
49274 |
|
49275 | }),
|
49276 |
|
49277 | (function(module, exports, __webpack_require__) {
|
49278 |
|
49279 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
49280 |
|
49281 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
49282 |
|
49283 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
49284 |
|
49285 |
|
49286 |
|
49287 |
|
49288 |
|
49289 |
|
49290 | var List = __webpack_require__(125);
|
49291 |
|
49292 | var Mirror = function (_List) {
|
49293 | _inherits(Mirror, _List);
|
49294 |
|
49295 | function Mirror() {
|
49296 | _classCallCheck(this, Mirror);
|
49297 |
|
49298 | return _possibleConstructorReturn(this, _List.apply(this, arguments));
|
49299 | }
|
49300 |
|
49301 | Mirror.prototype.getDefaultCfg = function getDefaultCfg() {
|
49302 | var cfg = _List.prototype.getDefaultCfg.call(this);
|
49303 | cfg.type = 'mirror';
|
49304 | this.transpose = false;
|
49305 | return cfg;
|
49306 | };
|
49307 |
|
49308 | Mirror.prototype.init = function init() {
|
49309 | var self = this;
|
49310 | if (self.transpose) {
|
49311 | self.cols = 2;
|
49312 | self.rows = 1;
|
49313 | } else {
|
49314 | self.cols = 1;
|
49315 | self.rows = 2;
|
49316 | }
|
49317 | _List.prototype.init.call(this);
|
49318 | };
|
49319 |
|
49320 | Mirror.prototype.beforeProcessView = function beforeProcessView(view, facet) {
|
49321 | if (this.transpose) {
|
49322 | if (facet.colIndex % 2 === 0) {
|
49323 | view.coord().transpose().scale(-1, 1);
|
49324 | } else {
|
49325 | view.coord().transpose();
|
49326 | }
|
49327 | } else {
|
49328 | if (facet.rowIndex % 2 !== 0) {
|
49329 | view.coord().scale(1, -1);
|
49330 | }
|
49331 | }
|
49332 | };
|
49333 |
|
49334 | Mirror.prototype.renderTitle = function renderTitle(view, facet) {
|
49335 | if (this.transpose) {
|
49336 | this.drawColTitle(view, facet);
|
49337 | } else {
|
49338 | this.drawRowTitle(view, facet);
|
49339 | }
|
49340 | };
|
49341 |
|
49342 | Mirror.prototype.setXAxis = function setXAxis(xField, axes, facet) {
|
49343 |
|
49344 | if (facet.colIndex === 1 || facet.rowIndex === 1) {
|
49345 | axes[xField].label = null;
|
49346 | axes[xField].title = null;
|
49347 | }
|
49348 | };
|
49349 |
|
49350 | Mirror.prototype.setYAxis = function setYAxis() /* yField, axes, facet */{};
|
49351 |
|
49352 | return Mirror;
|
49353 | }(List);
|
49354 |
|
49355 | module.exports = Mirror;
|
49356 |
|
49357 | }),
|
49358 |
|
49359 | (function(module, exports, __webpack_require__) {
|
49360 |
|
49361 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
49362 |
|
49363 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
49364 |
|
49365 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
49366 |
|
49367 |
|
49368 |
|
49369 |
|
49370 |
|
49371 |
|
49372 | var Rect = __webpack_require__(124);
|
49373 |
|
49374 | var Matrix = function (_Rect) {
|
49375 | _inherits(Matrix, _Rect);
|
49376 |
|
49377 | function Matrix() {
|
49378 | _classCallCheck(this, Matrix);
|
49379 |
|
49380 | return _possibleConstructorReturn(this, _Rect.apply(this, arguments));
|
49381 | }
|
49382 |
|
49383 | Matrix.prototype.getDefaultCfg = function getDefaultCfg() {
|
49384 | var cfg = _Rect.prototype.getDefaultCfg.call(this);
|
49385 | cfg.type = 'matrix';
|
49386 | cfg.showTitle = false;
|
49387 | return cfg;
|
49388 | };
|
49389 |
|
49390 | Matrix.prototype.generateFacets = function generateFacets(data) {
|
49391 | var self = this;
|
49392 | var fields = self.fields;
|
49393 | var rows = fields.length;
|
49394 | var cols = rows;
|
49395 | var rst = [];
|
49396 | for (var i = 0; i < cols; i++) {
|
49397 | var colField = fields[i];
|
49398 | for (var j = 0; j < rows; j++) {
|
49399 | var rowField = fields[j];
|
49400 | var facet = {
|
49401 | type: self.type,
|
49402 | colValue: colField,
|
49403 | rowValue: rowField,
|
49404 | colField: colField,
|
49405 | rowField: rowField,
|
49406 | colIndex: i,
|
49407 | rowIndex: j,
|
49408 | cols: cols,
|
49409 | rows: rows,
|
49410 | data: data,
|
49411 | region: self.getRegion(rows, cols, i, j)
|
49412 | };
|
49413 | rst.push(facet);
|
49414 | }
|
49415 | }
|
49416 | return rst;
|
49417 | };
|
49418 |
|
49419 |
|
49420 |
|
49421 |
|
49422 | Matrix.prototype.setXAxis = function setXAxis(xField, axes, facet) {
|
49423 | if (facet.rowIndex !== facet.rows - 1) {
|
49424 | axes[xField].title = null;
|
49425 | axes[xField].label = null;
|
49426 | }
|
49427 | };
|
49428 |
|
49429 |
|
49430 |
|
49431 |
|
49432 | Matrix.prototype.setYAxis = function setYAxis(yField, axes, facet) {
|
49433 | if (facet.colIndex !== 0) {
|
49434 | axes[yField].title = null;
|
49435 | axes[yField].label = null;
|
49436 | }
|
49437 | };
|
49438 |
|
49439 | return Matrix;
|
49440 | }(Rect);
|
49441 |
|
49442 | module.exports = Matrix;
|
49443 |
|
49444 | }),
|
49445 |
|
49446 | (function(module, exports, __webpack_require__) {
|
49447 |
|
49448 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
49449 |
|
49450 |
|
49451 |
|
49452 |
|
49453 |
|
49454 | var Global = __webpack_require__(1);
|
49455 | var SERVER_URL = 'https://kcart.alipay.com/web/bi.do';
|
49456 | var Util = __webpack_require__(0);
|
49457 |
|
49458 | var Monitor = function () {
|
49459 | function Monitor(opt) {
|
49460 | _classCallCheck(this, Monitor);
|
49461 |
|
49462 | var _self = this;
|
49463 | var config = opt || {};
|
49464 | var image = new Image();
|
49465 | Util.mix(_self, {
|
49466 | image: image,
|
49467 | server: SERVER_URL
|
49468 | }, config);
|
49469 | }
|
49470 | |
49471 |
|
49472 |
|
49473 |
|
49474 |
|
49475 |
|
49476 |
|
49477 | Monitor.prototype.log = function log(opt) {
|
49478 | var _self = this;
|
49479 | var config = opt || {};
|
49480 | var newObj = Util.mix({
|
49481 | pg: document.URL,
|
49482 | r: new Date().getTime()
|
49483 | }, config);
|
49484 | var d = encodeURIComponent(JSON.stringify([newObj]));
|
49485 | _self.image.src = _self.server + '?BIProfile=merge&d=' + d;
|
49486 | };
|
49487 |
|
49488 | return Monitor;
|
49489 | }();
|
49490 |
|
49491 |
|
49492 |
|
49493 |
|
49494 | setTimeout(function () {
|
49495 | if (Global.trackable) {
|
49496 | var m = new Monitor();
|
49497 | m.log({
|
49498 | g2: true,
|
49499 | version: Global.version,
|
49500 | page_type: 'syslog'
|
49501 | });
|
49502 | }
|
49503 | }, 3000);
|
49504 |
|
49505 | })
|
49506 | ]);
|
49507 | });
|
49508 |
|
\ | No newline at end of file |