@antv/g-base
Advanced tools
Comparing version 0.4.1 to 0.4.2-beta.1
import EE from '@antv/event-emitter'; | ||
import { IBase } from '../interfaces'; | ||
import { LooseObject } from '../types'; | ||
declare abstract class Base extends EE implements IBase { | ||
/** | ||
* @private | ||
* 内部属性,用于 get,set | ||
* 内部属性,用于 get,set,但是可以用于优化性能使用 | ||
* @type {object} | ||
*/ | ||
cfg: object; | ||
cfg: LooseObject; | ||
/** | ||
@@ -11,0 +11,0 @@ * 是否被销毁 |
@@ -1,6 +0,6 @@ | ||
import { __extends } from "tslib"; | ||
import * as tslib_1 from "tslib"; | ||
import EE from '@antv/event-emitter'; | ||
import { mix } from '../util/util'; | ||
var Base = /** @class */ (function (_super) { | ||
__extends(Base, _super); | ||
tslib_1.__extends(Base, _super); | ||
function Base(cfg) { | ||
@@ -7,0 +7,0 @@ var _this = _super.call(this) || this; |
@@ -1,2 +0,2 @@ | ||
import { __extends } from "tslib"; | ||
import * as tslib_1 from "tslib"; | ||
import Container from './container'; | ||
@@ -7,3 +7,3 @@ import { isBrowser, isString } from '../util/util'; | ||
var Canvas = /** @class */ (function (_super) { | ||
__extends(Canvas, _super); | ||
tslib_1.__extends(Canvas, _super); | ||
function Canvas(cfg) { | ||
@@ -10,0 +10,0 @@ var _this = _super.call(this, cfg) || this; |
@@ -1,4 +0,4 @@ | ||
import { __extends } from "tslib"; | ||
import * as tslib_1 from "tslib"; | ||
import Element from './element'; | ||
import { isFunction, isObject, each, removeFromArray, upperFirst } from '../util/util'; | ||
import { isFunction, isObject, each, removeFromArray, upperFirst, isAllowCapture } from '../util/util'; | ||
var SHAPE_MAP = {}; | ||
@@ -70,7 +70,4 @@ var INDEX = '_INDEX'; | ||
} | ||
function isAllowCapture(element) { | ||
return element.get('visible') && element.get('capture'); | ||
} | ||
var Container = /** @class */ (function (_super) { | ||
__extends(Container, _super); | ||
tslib_1.__extends(Container, _super); | ||
function Container() { | ||
@@ -77,0 +74,0 @@ return _super !== null && _super.apply(this, arguments) || this; |
@@ -1,2 +0,2 @@ | ||
import { __extends } from "tslib"; | ||
import * as tslib_1 from "tslib"; | ||
import { each, isEqual, isFunction, isNumber, isObject, isArray, noop, mix, upperFirst, uniqueId } from '@antv/util'; | ||
@@ -8,8 +8,2 @@ import { transform } from '@antv/matrix-util'; | ||
var MATRIX = 'matrix'; | ||
var ARRAY_ATTRS = { | ||
matrix: 'matrix', | ||
path: 'path', | ||
points: 'points', | ||
lineDash: 'lineDash', | ||
}; | ||
var CLONE_CFGS = ['zIndex', 'capture', 'visible', 'type']; | ||
@@ -72,3 +66,3 @@ // 可以在 toAttrs 中设置,但不属于绘图属性的字段 | ||
var Element = /** @class */ (function (_super) { | ||
__extends(Element, _super); | ||
tslib_1.__extends(Element, _super); | ||
function Element(cfg) { | ||
@@ -137,3 +131,2 @@ var _this = _super.call(this, cfg) || this; | ||
Element.prototype.attr = function () { | ||
var _a; | ||
var args = []; | ||
@@ -143,2 +136,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
} | ||
var _a; | ||
var name = args[0], value = args[1]; | ||
@@ -358,3 +352,4 @@ if (!name) | ||
Element.prototype.getClip = function () { | ||
var clipShape = this.get('clipShape'); | ||
// 高频率调用的地方直接使用 this.cfg.xxx | ||
var clipShape = this.cfg.clipShape; | ||
// 未设置时返回 Null,保证一致性 | ||
@@ -361,0 +356,0 @@ if (!clipShape) { |
@@ -1,5 +0,5 @@ | ||
import { __extends } from "tslib"; | ||
import * as tslib_1 from "tslib"; | ||
import Container from './container'; | ||
var AbstractGroup = /** @class */ (function (_super) { | ||
__extends(AbstractGroup, _super); | ||
tslib_1.__extends(AbstractGroup, _super); | ||
function AbstractGroup() { | ||
@@ -6,0 +6,0 @@ return _super !== null && _super.apply(this, arguments) || this; |
@@ -1,6 +0,6 @@ | ||
import { __extends } from "tslib"; | ||
import * as tslib_1 from "tslib"; | ||
import Element from './element'; | ||
import { multiplyVec2 } from '../util/matrix'; | ||
var AbstractShape = /** @class */ (function (_super) { | ||
__extends(AbstractShape, _super); | ||
tslib_1.__extends(AbstractShape, _super); | ||
function AbstractShape(cfg) { | ||
@@ -7,0 +7,0 @@ return _super.call(this, cfg) || this; |
@@ -7,7 +7,5 @@ /** | ||
import { each, isParent } from '../util/util'; | ||
var TIME_INTERVAL = 120; // 判断拖拽和点击 | ||
var CLICK_OFFSET = 40; | ||
var LEFT_BTN_CODE = 0; | ||
var DELEGATION_SPLIT = ':'; | ||
var WILDCARD = '*'; | ||
var EVENTS = [ | ||
@@ -14,0 +12,0 @@ 'mousedown', |
@@ -1,2 +0,2 @@ | ||
import { ShapeCfg, GroupCfg, ClipCfg, Renderer, Point, ChangeType, AnimateCfg, ElementAttrs, OnFrame, ShapeBase, BBox, ElementFilterFn, Cursor } from './types'; | ||
import { ShapeCfg, GroupCfg, ClipCfg, Renderer, Point, ChangeType, AnimateCfg, ElementAttrs, OnFrame, ShapeBase, BBox, ElementFilterFn, Cursor, LooseObject } from './types'; | ||
import GraphEvent from './event/graph-event'; | ||
@@ -45,2 +45,3 @@ export interface ICtor<T> { | ||
export interface IBase extends IObservable { | ||
cfg: LooseObject; | ||
/** | ||
@@ -47,0 +48,0 @@ * 获取属性值 |
@@ -0,1 +1,2 @@ | ||
import { IBase } from '../interfaces'; | ||
export declare function removeFromArray(arr: any[], obj: any): void; | ||
@@ -12,1 +13,2 @@ export declare const isBrowser: boolean; | ||
export declare function isParent(container: any, shape: any): boolean; | ||
export declare function isAllowCapture(element: IBase): boolean; |
@@ -33,2 +33,6 @@ export function removeFromArray(arr, obj) { | ||
} | ||
export function isAllowCapture(element) { | ||
// @ts-ignore | ||
return element.cfg.visible && element.cfg.capture; | ||
} | ||
//# sourceMappingURL=util.js.map |
import EE from '@antv/event-emitter'; | ||
import { IBase } from '../interfaces'; | ||
import { LooseObject } from '../types'; | ||
declare abstract class Base extends EE implements IBase { | ||
/** | ||
* @private | ||
* 内部属性,用于 get,set | ||
* 内部属性,用于 get,set,但是可以用于优化性能使用 | ||
* @type {object} | ||
*/ | ||
cfg: object; | ||
cfg: LooseObject; | ||
/** | ||
@@ -11,0 +11,0 @@ * 是否被销毁 |
@@ -72,5 +72,2 @@ "use strict"; | ||
} | ||
function isAllowCapture(element) { | ||
return element.get('visible') && element.get('capture'); | ||
} | ||
var Container = /** @class */ (function (_super) { | ||
@@ -260,3 +257,3 @@ tslib_1.__extends(Container, _super); | ||
// 如果不支持拾取,则直接返回 | ||
if (!isAllowCapture(this)) { | ||
if (!util_1.isAllowCapture(this)) { | ||
return null; | ||
@@ -284,3 +281,3 @@ } | ||
var child = children[i]; | ||
if (isAllowCapture(child)) { | ||
if (util_1.isAllowCapture(child)) { | ||
if (child.isGroup()) { | ||
@@ -287,0 +284,0 @@ shape = child.getShape(x, y, ev); |
@@ -10,8 +10,2 @@ "use strict"; | ||
var MATRIX = 'matrix'; | ||
var ARRAY_ATTRS = { | ||
matrix: 'matrix', | ||
path: 'path', | ||
points: 'points', | ||
lineDash: 'lineDash', | ||
}; | ||
var CLONE_CFGS = ['zIndex', 'capture', 'visible', 'type']; | ||
@@ -138,3 +132,2 @@ // 可以在 toAttrs 中设置,但不属于绘图属性的字段 | ||
Element.prototype.attr = function () { | ||
var _a; | ||
var args = []; | ||
@@ -144,2 +137,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
} | ||
var _a; | ||
var name = args[0], value = args[1]; | ||
@@ -359,3 +353,4 @@ if (!name) | ||
Element.prototype.getClip = function () { | ||
var clipShape = this.get('clipShape'); | ||
// 高频率调用的地方直接使用 this.cfg.xxx | ||
var clipShape = this.cfg.clipShape; | ||
// 未设置时返回 Null,保证一致性 | ||
@@ -362,0 +357,0 @@ if (!clipShape) { |
@@ -9,7 +9,5 @@ "use strict"; | ||
var util_1 = require("../util/util"); | ||
var TIME_INTERVAL = 120; // 判断拖拽和点击 | ||
var CLICK_OFFSET = 40; | ||
var LEFT_BTN_CODE = 0; | ||
var DELEGATION_SPLIT = ':'; | ||
var WILDCARD = '*'; | ||
var EVENTS = [ | ||
@@ -16,0 +14,0 @@ 'mousedown', |
@@ -1,2 +0,2 @@ | ||
import { ShapeCfg, GroupCfg, ClipCfg, Renderer, Point, ChangeType, AnimateCfg, ElementAttrs, OnFrame, ShapeBase, BBox, ElementFilterFn, Cursor } from './types'; | ||
import { ShapeCfg, GroupCfg, ClipCfg, Renderer, Point, ChangeType, AnimateCfg, ElementAttrs, OnFrame, ShapeBase, BBox, ElementFilterFn, Cursor, LooseObject } from './types'; | ||
import GraphEvent from './event/graph-event'; | ||
@@ -45,2 +45,3 @@ export interface ICtor<T> { | ||
export interface IBase extends IObservable { | ||
cfg: LooseObject; | ||
/** | ||
@@ -47,0 +48,0 @@ * 获取属性值 |
@@ -0,1 +1,2 @@ | ||
import { IBase } from '../interfaces'; | ||
export declare function removeFromArray(arr: any[], obj: any): void; | ||
@@ -12,1 +13,2 @@ export declare const isBrowser: boolean; | ||
export declare function isParent(container: any, shape: any): boolean; | ||
export declare function isAllowCapture(element: IBase): boolean; |
@@ -45,2 +45,7 @@ "use strict"; | ||
exports.isParent = isParent; | ||
function isAllowCapture(element) { | ||
// @ts-ignore | ||
return element.cfg.visible && element.cfg.capture; | ||
} | ||
exports.isAllowCapture = isAllowCapture; | ||
//# sourceMappingURL=util.js.map |
{ | ||
"name": "@antv/g-base", | ||
"version": "0.4.1", | ||
"version": "0.4.2-beta.1", | ||
"description": "A common util collection for antv projects", | ||
@@ -65,4 +65,3 @@ "main": "lib/index.js", | ||
}, | ||
"__npminstall_done": false, | ||
"gitHead": "6948b647ec006e956429f72b9b8b1264dd2c5846" | ||
"__npminstall_done": false | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
671846
182
11673