@antv/g6-core
Advanced tools
Comparing version 0.3.5 to 0.3.6
import { clone, each, wrapBehavior } from '@antv/util'; | ||
import behaviorOption from './behaviorOption'; | ||
var Behavior = | ||
/** @class */ | ||
function () { | ||
var Behavior = function () { | ||
function Behavior() {} | ||
@@ -8,0 +6,0 @@ /** |
@@ -56,2 +56,3 @@ import { each } from '@antv/util'; // 自定义 Behavior 时候共有的方法 | ||
var events = this.events; | ||
var draggable = graph.get('canvas').get('draggable'); | ||
@@ -65,2 +66,3 @@ if (this.type === 'drag-canvas' || this.type === 'brush-select' || this.type === 'lasso-select') { | ||
}); | ||
graph.get('canvas').set('draggable', draggable); | ||
}, | ||
@@ -67,0 +69,0 @@ get: function get(val) { |
@@ -328,4 +328,6 @@ import { __assign } from "tslib"; | ||
var iconConfig = mix({}, iconShape.attr(), icon); | ||
var w = iconConfig.width, | ||
h = iconConfig.height; | ||
var _a = iconConfig.width, | ||
w = _a === void 0 ? 20 : _a, | ||
_b = iconConfig.height, | ||
h = _b === void 0 ? 20 : _b; | ||
iconShape.attr(__assign(__assign({}, iconConfig), { | ||
@@ -332,0 +334,0 @@ x: -w / 2, |
@@ -137,5 +137,3 @@ import { __assign } from "tslib"; | ||
*/ | ||
drawShape: function drawShape() | ||
/* cfg, group */ | ||
{}, | ||
drawShape: function drawShape() {}, | ||
@@ -145,9 +143,5 @@ /** | ||
*/ | ||
afterDraw: function afterDraw() | ||
/* cfg, group */ | ||
{}, | ||
afterDraw: function afterDraw() {}, | ||
// update(cfg, item) // 默认不定义 | ||
afterUpdate: function afterUpdate() | ||
/* cfg, item */ | ||
{}, | ||
afterUpdate: function afterUpdate() {}, | ||
@@ -157,5 +151,3 @@ /** | ||
*/ | ||
setState: function setState() | ||
/* name, value, item */ | ||
{}, | ||
setState: function setState() {}, | ||
@@ -188,5 +180,3 @@ /** | ||
var Shape = | ||
/** @class */ | ||
function () { | ||
var Shape = function () { | ||
function Shape() {} | ||
@@ -193,0 +183,0 @@ |
@@ -50,3 +50,3 @@ var subjectColor = 'rgb(95, 149, 255)'; | ||
export default { | ||
version: '0.3.5', | ||
version: '0.3.6', | ||
rootContainerClassName: 'root-container', | ||
@@ -53,0 +53,0 @@ nodeContainerClassName: 'node-container', |
@@ -1,4 +0,2 @@ | ||
var EventController = | ||
/** @class */ | ||
function () { | ||
var EventController = function () { | ||
function EventController(graph) { | ||
@@ -5,0 +3,0 @@ this.graph = graph; |
@@ -15,5 +15,3 @@ import { __assign } from "tslib"; | ||
var ItemController = | ||
/** @class */ | ||
function () { | ||
var ItemController = function () { | ||
function ItemController(graph) { | ||
@@ -582,4 +580,3 @@ var _this = this; | ||
if (item.hasState(stateName) === value && value || // 当该状态已经存在且现在需要设置为 true 时,不需要继续。当该状态不存在,且设置为 false 时,需要继续 | ||
isString(value) && item.hasState(stateName)) { | ||
if (item.hasState(stateName) === value && value || isString(value) && item.hasState(stateName)) { | ||
// 当该状态 value 是字符串,且已经存在该状态,不需要继续 | ||
@@ -586,0 +583,0 @@ return; |
@@ -5,5 +5,3 @@ import { __assign, __rest } from "tslib"; | ||
var LayoutController = | ||
/** @class */ | ||
function () { | ||
var LayoutController = function () { | ||
function LayoutController(graph) { | ||
@@ -10,0 +8,0 @@ this.graph = graph; |
import { each, isArray, isString } from '@antv/util'; | ||
import Behavior from '../../behavior/behavior'; | ||
var ModeController = | ||
/** @class */ | ||
function () { | ||
var ModeController = function () { | ||
function ModeController(graph) { | ||
@@ -8,0 +6,0 @@ this.graph = graph; |
import { each, isString } from '@antv/util'; | ||
var timer = null; | ||
var StateController = | ||
/** @class */ | ||
function () { | ||
var StateController = function () { | ||
function StateController(graph) { | ||
@@ -8,0 +6,0 @@ this.graph = graph; |
@@ -6,5 +6,3 @@ import { __assign } from "tslib"; | ||
var ViewController = | ||
/** @class */ | ||
function () { | ||
var ViewController = function () { | ||
function ViewController(graph) { | ||
@@ -66,3 +64,5 @@ this.destroyed = false; | ||
graph.zoom(ratio, viewCenter); | ||
if (!graph.zoom(ratio, viewCenter)) { | ||
console.warn('zoom failed, ratio out of range, ratio: %f', ratio); | ||
} | ||
}; | ||
@@ -69,0 +69,0 @@ |
@@ -204,4 +204,5 @@ import EventEmitter from '@antv/event-emitter'; | ||
* @param center 以center的x, y坐标为中心缩放 | ||
* @return {boolean} 缩放是否成功 | ||
*/ | ||
zoom(ratio: number, center?: Point): void; | ||
zoom(ratio: number, center?: Point): boolean; | ||
/** | ||
@@ -211,4 +212,5 @@ * 伸缩视口到一固定比例 | ||
* @param {Point} center 以center的x, y坐标为中心缩放 | ||
* @return {boolean} 缩放是否成功 | ||
*/ | ||
zoomTo(toRatio: number, center?: Point): void; | ||
zoomTo(toRatio: number, center?: Point): boolean; | ||
/** | ||
@@ -215,0 +217,0 @@ * 将元素移动到视口中心 |
import { __extends } from "tslib"; | ||
import { Event as GraphEvent } from '@antv/g-base'; | ||
var G6GraphEvent = | ||
/** @class */ | ||
function (_super) { | ||
var G6GraphEvent = function (_super) { | ||
__extends(G6GraphEvent, _super); | ||
@@ -8,0 +6,0 @@ |
@@ -14,3 +14,3 @@ import EventEmitter from '@antv/event-emitter'; | ||
translate: (dx: number, dy: number) => void; | ||
zoom: (ratio: number, center?: Point) => void; | ||
zoom: (ratio: number, center?: Point) => boolean; | ||
/** | ||
@@ -144,4 +144,5 @@ * 获取 graph 的根图形分组 | ||
* @param {Point} center 以center的x, y坐标为中心缩放 | ||
* @return {boolean} 缩放是否成功 | ||
*/ | ||
zoomTo: (toRatio: number, center?: Point) => void; | ||
zoomTo: (toRatio: number, center?: Point) => boolean; | ||
/** | ||
@@ -148,0 +149,0 @@ * 删除元素 |
@@ -11,5 +11,3 @@ import { __assign, __extends } from "tslib"; | ||
var Combo = | ||
/** @class */ | ||
function (_super) { | ||
var Combo = function (_super) { | ||
__extends(Combo, _super); | ||
@@ -16,0 +14,0 @@ |
@@ -14,5 +14,3 @@ import { __extends } from "tslib"; | ||
var Edge = | ||
/** @class */ | ||
function (_super) { | ||
var Edge = function (_super) { | ||
__extends(Edge, _super); | ||
@@ -19,0 +17,0 @@ |
@@ -15,5 +15,3 @@ import { __assign } from "tslib"; | ||
var Hull = | ||
/** @class */ | ||
function () { | ||
var Hull = function () { | ||
function Hull(graph, cfg) { | ||
@@ -20,0 +18,0 @@ this.cfg = deepMix(this.getDefaultCfg(), cfg); |
import { __assign } from "tslib"; | ||
import { each, isNil, isPlainObject, isString, isBoolean, mix, deepMix, clone } from '@antv/util'; | ||
import { each, isPlainObject, isString, isBoolean, mix, deepMix, clone } from '@antv/util'; | ||
import Shape from '../element/shape'; | ||
@@ -11,5 +11,3 @@ import { getBBox } from '../util/graphic'; | ||
var ItemBase = | ||
/** @class */ | ||
function () { | ||
var ItemBase = function () { | ||
function ItemBase(cfg) { | ||
@@ -216,4 +214,4 @@ this._cfg = {}; | ||
if (keyShapeStyle.path) delete keyShapeStyle.path; | ||
if (keyShapeStyle.matrix) delete keyShapeStyle.matrix; | ||
delete keyShapeStyle.path; | ||
delete keyShapeStyle.matrix; | ||
@@ -228,3 +226,5 @@ if (!keyShapeName) { | ||
originStyles_1[shapeName] = shapeType !== 'image' ? clone(child.attr()) : self.getShapeStyleByName(name); | ||
} else originStyles_1[keyShapeName] = keyShapeStyle; | ||
} else { | ||
originStyles_1[keyShapeName] = keyShapeStyle; | ||
} | ||
} | ||
@@ -284,4 +284,10 @@ } | ||
if (styles_1.y) delete styles_1.y; | ||
if (styles_1[keyShapeName] && styles_1[keyShapeName].x) delete styles_1[keyShapeName].x; | ||
if (styles_1[keyShapeName] && styles_1[keyShapeName].y) delete styles_1[keyShapeName].y; | ||
if (styles_1[keyShapeName]) { | ||
delete styles_1[keyShapeName].x; | ||
delete styles_1[keyShapeName].y; | ||
delete styles_1[keyShapeName].matrix; | ||
delete styles_1[keyShapeName].path; | ||
} | ||
self.set('originStyle', styles_1); | ||
@@ -712,7 +718,7 @@ } | ||
var model = this.get('model'); | ||
var x = isNil(+cfg.x) ? +model.x : +cfg.x; | ||
var y = isNil(+cfg.y) ? +model.y : +cfg.y; | ||
var x = isNaN(+cfg.x) ? +model.x : +cfg.x; | ||
var y = isNaN(+cfg.y) ? +model.y : +cfg.y; | ||
var group = this.get('group'); | ||
if (isNil(x) || isNil(y)) { | ||
if (isNaN(x) || isNaN(y)) { | ||
return false; | ||
@@ -719,0 +725,0 @@ } |
@@ -8,5 +8,3 @@ import { __extends } from "tslib"; | ||
var Node = | ||
/** @class */ | ||
function (_super) { | ||
var Node = function (_super) { | ||
__extends(Node, _super); | ||
@@ -13,0 +11,0 @@ |
@@ -649,5 +649,3 @@ import { mat3, vec3, ext, vec2 } from '@antv/matrix-util'; | ||
var Line = | ||
/** @class */ | ||
function () { | ||
var Line = function () { | ||
function Line(x1, y1, x2, y2) { | ||
@@ -654,0 +652,0 @@ this.x1 = x1; |
@@ -14,5 +14,3 @@ "use strict"; | ||
var Behavior = | ||
/** @class */ | ||
function () { | ||
var Behavior = function () { | ||
function Behavior() {} | ||
@@ -19,0 +17,0 @@ /** |
@@ -64,2 +64,3 @@ "use strict"; | ||
var events = this.events; | ||
var draggable = graph.get('canvas').get('draggable'); | ||
@@ -73,2 +74,3 @@ if (this.type === 'drag-canvas' || this.type === 'brush-select' || this.type === 'lasso-select') { | ||
}); | ||
graph.get('canvas').set('draggable', draggable); | ||
}, | ||
@@ -75,0 +77,0 @@ get: function get(val) { |
@@ -339,4 +339,6 @@ "use strict"; | ||
var iconConfig = (0, _util.mix)({}, iconShape.attr(), icon); | ||
var w = iconConfig.width, | ||
h = iconConfig.height; | ||
var _a = iconConfig.width, | ||
w = _a === void 0 ? 20 : _a, | ||
_b = iconConfig.height, | ||
h = _b === void 0 ? 20 : _b; | ||
iconShape.attr((0, _tslib.__assign)((0, _tslib.__assign)({}, iconConfig), { | ||
@@ -343,0 +345,0 @@ x: -w / 2, |
@@ -148,5 +148,3 @@ "use strict"; | ||
*/ | ||
drawShape: function drawShape() | ||
/* cfg, group */ | ||
{}, | ||
drawShape: function drawShape() {}, | ||
@@ -156,9 +154,5 @@ /** | ||
*/ | ||
afterDraw: function afterDraw() | ||
/* cfg, group */ | ||
{}, | ||
afterDraw: function afterDraw() {}, | ||
// update(cfg, item) // 默认不定义 | ||
afterUpdate: function afterUpdate() | ||
/* cfg, item */ | ||
{}, | ||
afterUpdate: function afterUpdate() {}, | ||
@@ -168,5 +162,3 @@ /** | ||
*/ | ||
setState: function setState() | ||
/* name, value, item */ | ||
{}, | ||
setState: function setState() {}, | ||
@@ -199,5 +191,3 @@ /** | ||
var Shape = | ||
/** @class */ | ||
function () { | ||
var Shape = function () { | ||
function Shape() {} | ||
@@ -204,0 +194,0 @@ |
@@ -56,3 +56,3 @@ "use strict"; | ||
var _default = { | ||
version: '0.3.5', | ||
version: '0.3.6', | ||
rootContainerClassName: 'root-container', | ||
@@ -59,0 +59,0 @@ nodeContainerClassName: 'node-container', |
@@ -8,5 +8,3 @@ "use strict"; | ||
var EventController = | ||
/** @class */ | ||
function () { | ||
var EventController = function () { | ||
function EventController(graph) { | ||
@@ -13,0 +11,0 @@ this.graph = graph; |
@@ -30,5 +30,3 @@ "use strict"; | ||
var ItemController = | ||
/** @class */ | ||
function () { | ||
var ItemController = function () { | ||
function ItemController(graph) { | ||
@@ -597,4 +595,3 @@ var _this = this; | ||
if (item.hasState(stateName) === value && value || // 当该状态已经存在且现在需要设置为 true 时,不需要继续。当该状态不存在,且设置为 false 时,需要继续 | ||
(0, _util.isString)(value) && item.hasState(stateName)) { | ||
if (item.hasState(stateName) === value && value || (0, _util.isString)(value) && item.hasState(stateName)) { | ||
// 当该状态 value 是字符串,且已经存在该状态,不需要继续 | ||
@@ -601,0 +598,0 @@ return; |
@@ -14,5 +14,3 @@ "use strict"; | ||
var LayoutController = | ||
/** @class */ | ||
function () { | ||
var LayoutController = function () { | ||
function LayoutController(graph) { | ||
@@ -19,0 +17,0 @@ this.graph = graph; |
@@ -14,5 +14,3 @@ "use strict"; | ||
var ModeController = | ||
/** @class */ | ||
function () { | ||
var ModeController = function () { | ||
function ModeController(graph) { | ||
@@ -19,0 +17,0 @@ this.graph = graph; |
@@ -12,5 +12,3 @@ "use strict"; | ||
var StateController = | ||
/** @class */ | ||
function () { | ||
var StateController = function () { | ||
function StateController(graph) { | ||
@@ -17,0 +15,0 @@ this.graph = graph; |
@@ -16,5 +16,3 @@ "use strict"; | ||
var ViewController = | ||
/** @class */ | ||
function () { | ||
var ViewController = function () { | ||
function ViewController(graph) { | ||
@@ -76,3 +74,5 @@ this.destroyed = false; | ||
graph.zoom(ratio, viewCenter); | ||
if (!graph.zoom(ratio, viewCenter)) { | ||
console.warn('zoom failed, ratio out of range, ratio: %f', ratio); | ||
} | ||
}; | ||
@@ -79,0 +79,0 @@ |
@@ -204,4 +204,5 @@ import EventEmitter from '@antv/event-emitter'; | ||
* @param center 以center的x, y坐标为中心缩放 | ||
* @return {boolean} 缩放是否成功 | ||
*/ | ||
zoom(ratio: number, center?: Point): void; | ||
zoom(ratio: number, center?: Point): boolean; | ||
/** | ||
@@ -211,4 +212,5 @@ * 伸缩视口到一固定比例 | ||
* @param {Point} center 以center的x, y坐标为中心缩放 | ||
* @return {boolean} 缩放是否成功 | ||
*/ | ||
zoomTo(toRatio: number, center?: Point): void; | ||
zoomTo(toRatio: number, center?: Point): boolean; | ||
/** | ||
@@ -215,0 +217,0 @@ * 将元素移动到视口中心 |
@@ -12,5 +12,3 @@ "use strict"; | ||
var G6GraphEvent = | ||
/** @class */ | ||
function (_super) { | ||
var G6GraphEvent = function (_super) { | ||
(0, _tslib.__extends)(G6GraphEvent, _super); | ||
@@ -17,0 +15,0 @@ |
@@ -14,3 +14,3 @@ import EventEmitter from '@antv/event-emitter'; | ||
translate: (dx: number, dy: number) => void; | ||
zoom: (ratio: number, center?: Point) => void; | ||
zoom: (ratio: number, center?: Point) => boolean; | ||
/** | ||
@@ -144,4 +144,5 @@ * 获取 graph 的根图形分组 | ||
* @param {Point} center 以center的x, y坐标为中心缩放 | ||
* @return {boolean} 缩放是否成功 | ||
*/ | ||
zoomTo: (toRatio: number, center?: Point) => void; | ||
zoomTo: (toRatio: number, center?: Point) => boolean; | ||
/** | ||
@@ -148,0 +149,0 @@ * 删除元素 |
@@ -25,5 +25,3 @@ "use strict"; | ||
var Combo = | ||
/** @class */ | ||
function (_super) { | ||
var Combo = function (_super) { | ||
(0, _tslib.__extends)(Combo, _super); | ||
@@ -30,0 +28,0 @@ |
@@ -26,5 +26,3 @@ "use strict"; | ||
var Edge = | ||
/** @class */ | ||
function (_super) { | ||
var Edge = function (_super) { | ||
(0, _tslib.__extends)(Edge, _super); | ||
@@ -31,0 +29,0 @@ |
@@ -28,5 +28,3 @@ "use strict"; | ||
*/ | ||
var Hull = | ||
/** @class */ | ||
function () { | ||
var Hull = function () { | ||
function Hull(graph, cfg) { | ||
@@ -33,0 +31,0 @@ this.cfg = (0, _util.deepMix)(this.getDefaultCfg(), cfg); |
@@ -26,5 +26,3 @@ "use strict"; | ||
var ItemBase = | ||
/** @class */ | ||
function () { | ||
var ItemBase = function () { | ||
function ItemBase(cfg) { | ||
@@ -231,4 +229,4 @@ this._cfg = {}; | ||
if (keyShapeStyle.path) delete keyShapeStyle.path; | ||
if (keyShapeStyle.matrix) delete keyShapeStyle.matrix; | ||
delete keyShapeStyle.path; | ||
delete keyShapeStyle.matrix; | ||
@@ -243,3 +241,5 @@ if (!keyShapeName) { | ||
originStyles_1[shapeName] = shapeType !== 'image' ? (0, _util.clone)(child.attr()) : self.getShapeStyleByName(name); | ||
} else originStyles_1[keyShapeName] = keyShapeStyle; | ||
} else { | ||
originStyles_1[keyShapeName] = keyShapeStyle; | ||
} | ||
} | ||
@@ -299,4 +299,10 @@ } | ||
if (styles_1.y) delete styles_1.y; | ||
if (styles_1[keyShapeName] && styles_1[keyShapeName].x) delete styles_1[keyShapeName].x; | ||
if (styles_1[keyShapeName] && styles_1[keyShapeName].y) delete styles_1[keyShapeName].y; | ||
if (styles_1[keyShapeName]) { | ||
delete styles_1[keyShapeName].x; | ||
delete styles_1[keyShapeName].y; | ||
delete styles_1[keyShapeName].matrix; | ||
delete styles_1[keyShapeName].path; | ||
} | ||
self.set('originStyle', styles_1); | ||
@@ -728,7 +734,7 @@ } | ||
var model = this.get('model'); | ||
var x = (0, _util.isNil)(+cfg.x) ? +model.x : +cfg.x; | ||
var y = (0, _util.isNil)(+cfg.y) ? +model.y : +cfg.y; | ||
var x = isNaN(+cfg.x) ? +model.x : +cfg.x; | ||
var y = isNaN(+cfg.y) ? +model.y : +cfg.y; | ||
var group = this.get('group'); | ||
if ((0, _util.isNil)(x) || (0, _util.isNil)(y)) { | ||
if (isNaN(x) || isNaN(y)) { | ||
return false; | ||
@@ -735,0 +741,0 @@ } |
@@ -21,5 +21,3 @@ "use strict"; | ||
var Node = | ||
/** @class */ | ||
function (_super) { | ||
var Node = function (_super) { | ||
(0, _tslib.__extends)(Node, _super); | ||
@@ -26,0 +24,0 @@ |
@@ -719,5 +719,3 @@ "use strict"; | ||
var Line = | ||
/** @class */ | ||
function () { | ||
var Line = function () { | ||
function Line(x1, y1, x2, y2) { | ||
@@ -724,0 +722,0 @@ this.x1 = x1; |
{ | ||
"name": "@antv/g6-core", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "A Graph Visualization Framework in JavaScript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1111029
33231