1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.getActionClass = exports.registerAction = exports.Action = exports.Interaction = exports.createInteraction = exports.registerInteraction = exports.getInteraction = void 0;
|
4 | var tslib_1 = require("tslib");
|
5 | var util_1 = require("@antv/util");
|
6 | var grammar_interaction_1 = tslib_1.__importDefault(require("./grammar-interaction"));
|
7 | var Interactions = {};
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | function getInteraction(name) {
|
14 | return Interactions[(0, util_1.lowerCase)(name)];
|
15 | }
|
16 | exports.getInteraction = getInteraction;
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | function registerInteraction(name, interaction) {
|
23 | Interactions[(0, util_1.lowerCase)(name)] = interaction;
|
24 | }
|
25 | exports.registerInteraction = registerInteraction;
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | function createInteraction(name, view, cfg) {
|
33 | var interaciton = getInteraction(name);
|
34 | if (!interaciton) {
|
35 | return null;
|
36 | }
|
37 | if ((0, util_1.isPlainObject)(interaciton)) {
|
38 |
|
39 | var steps = (0, util_1.mix)((0, util_1.clone)(interaciton), cfg);
|
40 | return new grammar_interaction_1.default(view, steps);
|
41 | }
|
42 | else {
|
43 | var cls = interaciton;
|
44 | return new cls(view, cfg);
|
45 | }
|
46 | }
|
47 | exports.createInteraction = createInteraction;
|
48 | var interaction_1 = require("./interaction");
|
49 | Object.defineProperty(exports, "Interaction", { enumerable: true, get: function () { return tslib_1.__importDefault(interaction_1).default; } });
|
50 | var action_1 = require("./action");
|
51 | Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return action_1.Action; } });
|
52 | Object.defineProperty(exports, "registerAction", { enumerable: true, get: function () { return action_1.registerAction; } });
|
53 | Object.defineProperty(exports, "getActionClass", { enumerable: true, get: function () { return action_1.getActionClass; } });
|
54 |
|
\ | No newline at end of file |