@antv/g6 5.0.0-beta.10 → 5.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +2 -2
- package/esm/api-doc/graph.d.ts +3 -3
- package/esm/api-doc/graph.js +3 -3
- package/esm/api-doc/graph.js.map +1 -1
- package/esm/constant/shape.d.ts +1 -1
- package/esm/index.d.ts +12 -62
- package/esm/index.js +4 -5
- package/esm/index.js.map +1 -1
- package/esm/item/node.js +0 -1
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/item.js +15 -6
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.js +1 -3
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/graph.d.ts +1 -1
- package/esm/runtime/graph.js +11 -5
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/drag-canvas.d.ts +1 -1
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/shortcuts-call.d.ts +2 -2
- package/esm/stdlib/behavior/shortcuts-call.js +12 -5
- package/esm/stdlib/behavior/shortcuts-call.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/esm/stdlib/index.d.ts +6 -1
- package/esm/stdlib/index.js +8 -3
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.js +5 -1
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/esm/stdlib/item/edge/cubic.js +1 -1
- package/esm/stdlib/item/edge/cubic.js.map +1 -1
- package/esm/stdlib/item/edge/loop.js +1 -1
- package/esm/stdlib/item/edge/loop.js.map +1 -1
- package/esm/stdlib/item/node/cube.d.ts +35 -0
- package/esm/stdlib/item/node/cube.js +54 -0
- package/esm/stdlib/item/node/cube.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +3 -0
- package/esm/stdlib/item/node/index.js +3 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js +309 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/esm/stdlib/plugin/grid/index.d.ts +1 -1
- package/esm/stdlib/plugin/grid/index.js +3 -4
- package/esm/stdlib/plugin/grid/index.js.map +1 -1
- package/esm/stdlib/plugin/hull/convexHull.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.js +2 -3
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/esm/stdlib/plugin/hull/util.d.ts +2 -2
- package/esm/stdlib/plugin/hull/util.js +6 -2
- package/esm/stdlib/plugin/hull/util.js.map +1 -1
- package/esm/stdlib/plugin/index.d.ts +1 -0
- package/esm/stdlib/plugin/index.js +1 -0
- package/esm/stdlib/plugin/index.js.map +1 -1
- package/esm/stdlib/plugin/legend/index.d.ts +2 -2
- package/esm/stdlib/plugin/legend/index.js +3 -3
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/map/index.d.ts +1 -1
- package/esm/stdlib/plugin/map/index.js +4 -4
- package/esm/stdlib/plugin/map/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +4 -4
- package/esm/stdlib/plugin/menu/index.js +3 -3
- package/esm/stdlib/plugin/menu/index.js.map +1 -1
- package/esm/stdlib/plugin/minimap/index.d.ts +1 -1
- package/esm/stdlib/plugin/minimap/index.js +3 -3
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/timebar/index.js +2 -2
- package/esm/stdlib/plugin/timebar/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/esm/stdlib/plugin/toolbar/index.js +4 -4
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/tooltip/index.d.ts +4 -4
- package/esm/stdlib/plugin/tooltip/index.js +3 -4
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +1 -0
- package/esm/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/esm/stdlib/plugin/watermaker/index.js +243 -0
- package/esm/stdlib/plugin/watermaker/index.js.map +1 -0
- package/esm/types/plugin.d.ts +1 -1
- package/esm/util/bbox.js +4 -5
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/behavior.d.ts +2 -2
- package/esm/util/behavior.js +2 -2
- package/esm/util/behavior.js.map +1 -1
- package/esm/util/data.d.ts +2 -2
- package/esm/util/data.js.map +1 -1
- package/esm/util/dom.d.ts +15 -0
- package/esm/util/dom.js +29 -0
- package/esm/util/dom.js.map +1 -0
- package/esm/util/extend.d.ts +1 -1
- package/esm/util/extend.js +0 -1
- package/esm/util/extend.js.map +1 -1
- package/esm/util/index.d.ts +7 -52
- package/esm/util/index.js +7 -23
- package/esm/util/index.js.map +1 -1
- package/esm/util/layout.d.ts +1 -1
- package/esm/util/layout.js.map +1 -1
- package/esm/util/loop.d.ts +1 -1
- package/esm/util/math.d.ts +1 -1
- package/esm/util/matrix.d.ts +6 -0
- package/esm/util/matrix.js +48 -0
- package/esm/util/matrix.js.map +1 -0
- package/esm/util/path.js +1 -1
- package/esm/util/path.js.map +1 -1
- package/esm/util/point.d.ts +1 -1
- package/esm/util/polyline.d.ts +2 -1
- package/esm/util/polyline.js +2 -1
- package/esm/util/polyline.js.map +1 -1
- package/esm/util/router.d.ts +1 -1
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.js +1 -1
- package/esm/util/shape3d.js.map +1 -1
- package/lib/api-doc/graph.d.ts +3 -3
- package/lib/api-doc/graph.js +27 -7
- package/lib/api-doc/graph.js.map +1 -1
- package/lib/constant/shape.d.ts +1 -1
- package/lib/index.d.ts +12 -62
- package/lib/index.js +18 -10
- package/lib/index.js.map +1 -1
- package/lib/item/node.js +0 -1
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/item.js +15 -6
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.js +1 -3
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/graph.d.ts +1 -1
- package/lib/runtime/graph.js +12 -5
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/drag-canvas.d.ts +1 -1
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/shortcuts-call.d.ts +2 -2
- package/lib/stdlib/behavior/shortcuts-call.js +12 -5
- package/lib/stdlib/behavior/shortcuts-call.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/lib/stdlib/index.d.ts +6 -1
- package/lib/stdlib/index.js +8 -3
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.js +5 -1
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/lib/stdlib/item/edge/cubic.js +2 -2
- package/lib/stdlib/item/edge/cubic.js.map +1 -1
- package/lib/stdlib/item/edge/loop.js +3 -3
- package/lib/stdlib/item/edge/loop.js.map +1 -1
- package/lib/stdlib/item/node/cube.d.ts +35 -0
- package/lib/stdlib/item/node/cube.js +58 -0
- package/lib/stdlib/item/node/cube.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +3 -0
- package/lib/stdlib/item/node/index.js +3 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js +313 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/lib/stdlib/plugin/grid/index.d.ts +1 -1
- package/lib/stdlib/plugin/grid/index.js +6 -7
- package/lib/stdlib/plugin/grid/index.js.map +1 -1
- package/lib/stdlib/plugin/hull/convexHull.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.js +2 -3
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/lib/stdlib/plugin/hull/util.d.ts +2 -2
- package/lib/stdlib/plugin/hull/util.js +26 -22
- package/lib/stdlib/plugin/hull/util.js.map +1 -1
- package/lib/stdlib/plugin/index.d.ts +1 -0
- package/lib/stdlib/plugin/index.js +1 -0
- package/lib/stdlib/plugin/index.js.map +1 -1
- package/lib/stdlib/plugin/legend/index.d.ts +2 -2
- package/lib/stdlib/plugin/legend/index.js +3 -3
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/map/index.d.ts +1 -1
- package/lib/stdlib/plugin/map/index.js +6 -6
- package/lib/stdlib/plugin/map/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +4 -4
- package/lib/stdlib/plugin/menu/index.js +6 -6
- package/lib/stdlib/plugin/menu/index.js.map +1 -1
- package/lib/stdlib/plugin/minimap/index.d.ts +1 -1
- package/lib/stdlib/plugin/minimap/index.js +6 -6
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/timebar/index.js +2 -2
- package/lib/stdlib/plugin/timebar/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/lib/stdlib/plugin/toolbar/index.js +5 -5
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/tooltip/index.d.ts +4 -4
- package/lib/stdlib/plugin/tooltip/index.js +10 -11
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +1 -0
- package/lib/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/lib/stdlib/plugin/watermaker/index.js +247 -0
- package/lib/stdlib/plugin/watermaker/index.js.map +1 -0
- package/lib/types/plugin.d.ts +1 -1
- package/lib/util/bbox.js +4 -5
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/behavior.d.ts +2 -2
- package/lib/util/behavior.js +2 -2
- package/lib/util/behavior.js.map +1 -1
- package/lib/util/data.d.ts +2 -2
- package/lib/util/data.js.map +1 -1
- package/lib/util/dom.d.ts +15 -0
- package/lib/util/dom.js +34 -0
- package/lib/util/dom.js.map +1 -0
- package/lib/util/extend.d.ts +1 -1
- package/lib/util/extend.js +0 -1
- package/lib/util/extend.js.map +1 -1
- package/lib/util/index.d.ts +7 -52
- package/lib/util/index.js +23 -23
- package/lib/util/index.js.map +1 -1
- package/lib/util/layout.d.ts +1 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/loop.d.ts +1 -1
- package/lib/util/math.d.ts +1 -1
- package/lib/util/matrix.d.ts +6 -0
- package/lib/util/matrix.js +52 -0
- package/lib/util/matrix.js.map +1 -0
- package/lib/util/path.js +2 -2
- package/lib/util/path.js.map +1 -1
- package/lib/util/point.d.ts +1 -1
- package/lib/util/polyline.d.ts +2 -1
- package/lib/util/polyline.js +2 -1
- package/lib/util/polyline.js.map +1 -1
- package/lib/util/router.d.ts +1 -1
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.js +1 -1
- package/lib/util/shape3d.js.map +1 -1
- package/package.json +32 -40
- package/src/api-doc/graph.ts +4 -3
- package/src/constant/shape.ts +1 -1
- package/src/index.ts +5 -6
- package/src/item/node.ts +0 -1
- package/src/runtime/controller/item.ts +15 -6
- package/src/runtime/controller/layout.ts +1 -5
- package/src/runtime/graph.ts +12 -6
- package/src/stdlib/behavior/drag-canvas.ts +1 -1
- package/src/stdlib/behavior/shortcuts-call.ts +13 -4
- package/src/stdlib/behavior/zoom-canvas-3d.ts +4 -1
- package/src/stdlib/index.ts +10 -1
- package/src/stdlib/item/edge/base.ts +5 -2
- package/src/stdlib/item/edge/cubic-horizontal.ts +0 -1
- package/src/stdlib/item/edge/cubic-vertical.ts +0 -1
- package/src/stdlib/item/edge/cubic.ts +1 -1
- package/src/stdlib/item/edge/loop.ts +1 -1
- package/src/stdlib/item/node/cube.ts +102 -0
- package/src/stdlib/item/node/index.ts +3 -0
- package/src/stdlib/plugin/edgeFilterLens/index.ts +387 -0
- package/src/stdlib/plugin/grid/index.ts +6 -6
- package/src/stdlib/plugin/hull/convexHull.ts +1 -1
- package/src/stdlib/plugin/hull/hullComponent.ts +2 -3
- package/src/stdlib/plugin/hull/util.ts +6 -2
- package/src/stdlib/plugin/index.ts +1 -0
- package/src/stdlib/plugin/legend/index.ts +6 -6
- package/src/stdlib/plugin/map/index.ts +7 -7
- package/src/stdlib/plugin/menu/index.ts +13 -13
- package/src/stdlib/plugin/minimap/index.ts +6 -6
- package/src/stdlib/plugin/timebar/index.ts +4 -4
- package/src/stdlib/plugin/toolbar/index.ts +8 -8
- package/src/stdlib/plugin/tooltip/index.ts +10 -10
- package/src/stdlib/plugin/types.ts +1 -0
- package/src/stdlib/plugin/watermaker/index.ts +302 -0
- package/src/types/plugin.ts +1 -1
- package/src/util/bbox.ts +4 -5
- package/src/util/behavior.ts +4 -4
- package/src/util/data.ts +2 -3
- package/src/util/dom.ts +33 -0
- package/src/util/extend.ts +2 -3
- package/src/util/index.ts +7 -24
- package/src/util/layout.ts +3 -2
- package/src/util/loop.ts +1 -1
- package/src/util/math.ts +1 -1
- package/src/util/matrix.ts +66 -0
- package/src/util/path.ts +1 -1
- package/src/util/point.ts +1 -1
- package/src/util/polyline.ts +2 -1
- package/src/util/router.ts +1 -1
- package/src/util/shape.ts +0 -1
- package/src/util/shape3d.ts +1 -1
package/src/util/data.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { NodeUserModel } from 'types';
|
|
2
1
|
import { ID, TreeData } from '@antv/graphlib';
|
|
3
|
-
import { NodeUserModelData } from 'types/node';
|
|
4
2
|
import { isArray } from '@antv/util';
|
|
5
3
|
import { depthFirstSearch, connectedComponent } from '@antv/algorithm';
|
|
6
4
|
import { GraphCore, GraphData } from '../types/data';
|
|
7
5
|
import { IGraph } from '../types/graph';
|
|
8
|
-
import { NodeModel } from '../types';
|
|
6
|
+
import { NodeModel, NodeUserModel } from '../types';
|
|
7
|
+
import { NodeUserModelData } from '../types/node';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Deconstruct data and distinguish nodes and combos from graphcore data.
|
package/src/util/dom.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create DOM from a html string.
|
|
3
|
+
* @param str
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export function createDOM(str: string): HTMLElement {
|
|
7
|
+
const container = document.createElement('div');
|
|
8
|
+
container.innerHTML = str;
|
|
9
|
+
|
|
10
|
+
const dom = container.childNodes[0];
|
|
11
|
+
if (dom && container.contains(dom)) {
|
|
12
|
+
container.removeChild(dom);
|
|
13
|
+
}
|
|
14
|
+
return dom as HTMLElement;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Modify the CSS of a DOM.
|
|
19
|
+
* @param dom
|
|
20
|
+
* @param css
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export function modifyCSS(
|
|
24
|
+
dom: HTMLElement,
|
|
25
|
+
css: { [key: string]: any },
|
|
26
|
+
): HTMLElement {
|
|
27
|
+
if (!dom) return;
|
|
28
|
+
|
|
29
|
+
Object.keys(css).forEach((key) => {
|
|
30
|
+
dom.style[key] = css[key];
|
|
31
|
+
});
|
|
32
|
+
return dom;
|
|
33
|
+
}
|
package/src/util/extend.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { NodeRegistry } from '../types/node';
|
|
|
4
4
|
import { EdgeRegistry } from '../types/edge';
|
|
5
5
|
import { LayoutRegistry } from '../types/layout';
|
|
6
6
|
import { PluginRegistry } from '../types/plugin';
|
|
7
|
-
import Graph from '../runtime/graph';
|
|
7
|
+
import { Graph } from '../runtime/graph';
|
|
8
8
|
import registry from '../stdlib';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -43,6 +43,5 @@ export const extend = <
|
|
|
43
43
|
extension.type = type;
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
-
|
|
47
|
-
return GraphClass;
|
|
46
|
+
return GraphClass as any;
|
|
48
47
|
};
|
package/src/util/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export { extend } from './extend';
|
|
2
|
+
export { mock } from './mock';
|
|
3
|
+
export { isEncode } from './type';
|
|
4
|
+
export { getArrowPath } from './arrow';
|
|
5
|
+
export {
|
|
6
6
|
graphCoreTreeDfs,
|
|
7
7
|
graphComboTreeDfs,
|
|
8
8
|
traverseAncestorsAndSucceeds,
|
|
@@ -13,22 +13,5 @@ import {
|
|
|
13
13
|
graphData2TreeData,
|
|
14
14
|
traverse,
|
|
15
15
|
} from './data';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const Util = {
|
|
19
|
-
extend,
|
|
20
|
-
isEncode,
|
|
21
|
-
mock,
|
|
22
|
-
getArrowPath,
|
|
23
|
-
graphCoreTreeDfs,
|
|
24
|
-
graphComboTreeDfs,
|
|
25
|
-
traverseAncestorsAndSucceeds,
|
|
26
|
-
traverseGraphAncestors,
|
|
27
|
-
traverseAncestors,
|
|
28
|
-
isSucceed,
|
|
29
|
-
treeData2GraphData,
|
|
30
|
-
graphData2TreeData,
|
|
31
|
-
traverse,
|
|
32
|
-
getEdgesBetween,
|
|
33
|
-
};
|
|
34
|
-
export default Util;
|
|
16
|
+
export { getEdgesBetween } from './item';
|
|
17
|
+
export { transform } from './matrix';
|
package/src/util/layout.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import Hierarchy from '@antv/hierarchy';
|
|
2
|
-
|
|
3
2
|
import { isArray, isNumber } from '@antv/util';
|
|
4
|
-
import { GraphData, ID, NodeModel } from 'types';
|
|
3
|
+
import { GraphData, ID, NodeModel } from '../types';
|
|
5
4
|
import { Point } from '../types/common';
|
|
6
5
|
import { traverse } from './data';
|
|
6
|
+
|
|
7
7
|
type TreeGraphData = any;
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* Judge the direction according to options of a tree layout.
|
|
10
11
|
* @param type Tree layout type.
|
package/src/util/loop.ts
CHANGED
package/src/util/math.ts
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { mat3 } from 'gl-matrix';
|
|
2
|
+
|
|
3
|
+
type mat3Type = [
|
|
4
|
+
number,
|
|
5
|
+
number,
|
|
6
|
+
number,
|
|
7
|
+
number,
|
|
8
|
+
number,
|
|
9
|
+
number,
|
|
10
|
+
number,
|
|
11
|
+
number,
|
|
12
|
+
number,
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
function leftTranslate(out, a, v) {
|
|
16
|
+
const transMat: mat3Type = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
17
|
+
mat3.fromTranslation(transMat, v);
|
|
18
|
+
return mat3.multiply(out, transMat, a);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function leftRotate(out, a, rad) {
|
|
22
|
+
const rotateMat: mat3Type = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
23
|
+
mat3.fromRotation(rotateMat, rad);
|
|
24
|
+
return mat3.multiply(out, rotateMat, a);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function leftScale(out, a, v) {
|
|
28
|
+
const scaleMat: mat3Type = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
29
|
+
mat3.fromScaling(scaleMat, v);
|
|
30
|
+
return mat3.multiply(out, scaleMat, a);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function leftMultiply(out, a, a1) {
|
|
34
|
+
return mat3.multiply(out, a1, a);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 根据 actions 来做 transform
|
|
39
|
+
* @param m
|
|
40
|
+
* @param actions
|
|
41
|
+
*/
|
|
42
|
+
export function transform(m: number[], actions: any[][]) {
|
|
43
|
+
const matrix = m ? [].concat(m) : [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
44
|
+
|
|
45
|
+
for (let i = 0, len = actions.length; i < len; i++) {
|
|
46
|
+
const action = actions[i];
|
|
47
|
+
switch (action[0]) {
|
|
48
|
+
case 't':
|
|
49
|
+
leftTranslate(matrix, matrix, [action[1], action[2]]);
|
|
50
|
+
break;
|
|
51
|
+
case 's':
|
|
52
|
+
leftScale(matrix, matrix, [action[1], action[2]]);
|
|
53
|
+
break;
|
|
54
|
+
case 'r':
|
|
55
|
+
leftRotate(matrix, matrix, action[1]);
|
|
56
|
+
break;
|
|
57
|
+
case 'm':
|
|
58
|
+
leftMultiply(matrix, matrix, action[1]);
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return matrix;
|
|
66
|
+
}
|
package/src/util/path.ts
CHANGED
package/src/util/point.ts
CHANGED
package/src/util/polyline.ts
CHANGED
|
@@ -55,7 +55,8 @@ export const simplifyPolylinePoints = (points: PolyPoint[]): PolyPoint[] => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Use the A* path-finding algorithm to obtain the shortest path.
|
|
58
|
+
* Use the A* path-finding algorithm to obtain the shortest path.
|
|
59
|
+
* Considering that there is no need to implement automatic obstacle avoidance, use waypoints to plan the path.
|
|
59
60
|
*/
|
|
60
61
|
export const simplePathFinder = (
|
|
61
62
|
start: PolyPoint,
|
package/src/util/router.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface RouterCfg {
|
|
|
24
24
|
/** Allowed edge directions */
|
|
25
25
|
directions?: any[];
|
|
26
26
|
/** Penalties */
|
|
27
|
-
penalties?:
|
|
27
|
+
penalties?: Record<string, any>;
|
|
28
28
|
/** Determine if use simple router for polyline when no obstacles */
|
|
29
29
|
simple?: boolean;
|
|
30
30
|
/** Function to calculate the distance between two points */
|
package/src/util/shape.ts
CHANGED