@visactor/vrender-core 1.1.4-alpha.0 → 1.1.4
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/cjs/graphic/graphic.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export declare const NOWORK_ANIMATE_ATTR: {
|
|
|
57
57
|
cursor: number;
|
|
58
58
|
html: number;
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>> extends Node implements IGraphic<T>, IAnimateTarget {
|
|
61
61
|
static mixin(source: Dict<any>): void;
|
|
62
62
|
_events?: any;
|
|
63
63
|
context?: Record<string, any>;
|
|
@@ -320,4 +320,11 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
320
320
|
abstract clone(): IGraphic<any>;
|
|
321
321
|
toCustomPath(): ICustomPath2D;
|
|
322
322
|
}
|
|
323
|
+
export type Graphic<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>> = GraphicImpl<T>;
|
|
324
|
+
export declare const GRAPHIC_CLASS_SYMBOL: unique symbol;
|
|
325
|
+
export interface IGraphicClassState {
|
|
326
|
+
Graphic: typeof GraphicImpl;
|
|
327
|
+
}
|
|
328
|
+
export declare function getGraphicClassState(): IGraphicClassState;
|
|
329
|
+
export declare const Graphic: typeof GraphicImpl;
|
|
323
330
|
export {};
|
package/cjs/graphic/graphic.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.Graphic = exports.NOWORK_ANIMATE_ATTR = exports.GRAPHIC_UPDATE_TAG_KEY = exports.PURE_STYLE_KEY = void 0;
|
|
5
|
+
}), exports.Graphic = exports.getGraphicClassState = exports.GRAPHIC_CLASS_SYMBOL = exports.NOWORK_ANIMATE_ATTR = exports.GRAPHIC_UPDATE_TAG_KEY = exports.PURE_STYLE_KEY = void 0;
|
|
6
6
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils"), node_tree_1 = require("./node-tree"), event_1 = require("../event"), config_1 = require("./config"), application_1 = require("../application"), custom_path2d_1 = require("../common/custom-path2d"), loader_1 = require("../resource-loader/loader"), enums_1 = require("../common/enums"), bounds_context_1 = require("../common/bounds-context"), render_command_list_1 = require("../common/render-command-list"), utils_1 = require("../common/utils"), builtin_symbol_1 = require("./builtin-symbol"), xml_1 = require("../common/xml"), constants_1 = require("./constants"), config_2 = require("../animate/config"), canvas_1 = require("../canvas"), state_definition_compiler_1 = require("./state/state-definition-compiler"), state_engine_1 = require("./state/state-engine"), attribute_update_classifier_1 = require("./state/attribute-update-classifier"), state_transition_orchestrator_1 = require("./state/state-transition-orchestrator"), shared_state_scope_1 = require("./state/shared-state-scope"), shared_state_refresh_1 = require("./state/shared-state-refresh"), _tempBounds = new vutils_1.AABBBounds, loadShadowRootFactory = () => require("./shadow-root"), tempMatrix = new vutils_1.Matrix;
|
|
8
8
|
|
|
@@ -78,12 +78,12 @@ exports.NOWORK_ANIMATE_ATTR = {
|
|
|
78
78
|
html: 1
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
class
|
|
81
|
+
class GraphicImpl extends node_tree_1.Node {
|
|
82
82
|
static mixin(source) {
|
|
83
83
|
const keys = Object.keys(source);
|
|
84
84
|
for (let i = 0; i < keys.length; ++i) {
|
|
85
85
|
const propertyName = keys[i];
|
|
86
|
-
Object.defineProperty(
|
|
86
|
+
Object.defineProperty(this.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
get AABBBounds() {
|
|
@@ -522,7 +522,7 @@ class Graphic extends node_tree_1.Node {
|
|
|
522
522
|
if (!symbolType) return null;
|
|
523
523
|
let path = builtin_symbol_1.builtinSymbolsMap[symbolType];
|
|
524
524
|
if (path) return path;
|
|
525
|
-
if (path = Graphic.userSymbolMap[symbolType], path) return path;
|
|
525
|
+
if (path = exports.Graphic.userSymbolMap[symbolType], path) return path;
|
|
526
526
|
symbolType = builtin_symbol_1.builtInSymbolStrMap[symbolType] || symbolType;
|
|
527
527
|
if (!0 === (0, xml_1.isSvg)(symbolType)) {
|
|
528
528
|
const parser = new xml_1.XMLParser, {svg: svg} = parser.parse(symbolType);
|
|
@@ -543,13 +543,13 @@ class Graphic extends node_tree_1.Node {
|
|
|
543
543
|
vutils_1.max)(width, height);
|
|
544
544
|
cacheList.forEach((cache => cache.path.transform(0, 0, scale, scale)));
|
|
545
545
|
const _parsedPath = new builtin_symbol_1.CustomSymbolClass(symbolType, cacheList, !0);
|
|
546
|
-
return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
|
|
546
|
+
return exports.Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
|
|
547
547
|
}
|
|
548
548
|
const cache = (new custom_path2d_1.CustomPath2D).fromString(symbolType), width = cache.bounds.width(), height = cache.bounds.height(), scale = 1 / (0,
|
|
549
549
|
vutils_1.max)(width, height);
|
|
550
550
|
cache.transform(0, 0, scale, scale);
|
|
551
551
|
const _parsedPath = new builtin_symbol_1.CustomSymbolClass(symbolType, cache);
|
|
552
|
-
return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
|
|
552
|
+
return exports.Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
|
|
553
553
|
}
|
|
554
554
|
doUpdateAABBBounds(full, graphicTheme) {
|
|
555
555
|
this.updateAABBBoundsStamp++;
|
|
@@ -1325,6 +1325,19 @@ class Graphic extends node_tree_1.Node {
|
|
|
1325
1325
|
}
|
|
1326
1326
|
}
|
|
1327
1327
|
|
|
1328
|
+
function createGraphicClassState() {
|
|
1329
|
+
return {
|
|
1330
|
+
Graphic: GraphicImpl
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
function getGraphicClassState() {
|
|
1335
|
+
var _a;
|
|
1336
|
+
const globalScope = globalThis;
|
|
1337
|
+
return null !== (_a = globalScope[exports.GRAPHIC_CLASS_SYMBOL]) && void 0 !== _a || (globalScope[exports.GRAPHIC_CLASS_SYMBOL] = createGraphicClassState()),
|
|
1338
|
+
globalScope[exports.GRAPHIC_CLASS_SYMBOL];
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1328
1341
|
function backgroundNotImage(image) {
|
|
1329
1342
|
return "string" == typeof image ? !(image.startsWith("<svg") || (0, vutils_1.isValidUrl)(image) || image.includes("/") || (0,
|
|
1330
1343
|
vutils_1.isBase64)(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
|
|
@@ -1336,5 +1349,7 @@ function isExternalTexture(texture) {
|
|
|
1336
1349
|
vutils_1.isObject)(texture));
|
|
1337
1350
|
}
|
|
1338
1351
|
|
|
1339
|
-
|
|
1352
|
+
GraphicImpl.userSymbolMap = {}, exports.GRAPHIC_CLASS_SYMBOL = Symbol.for("@visactor/vrender-core/graphic-class"),
|
|
1353
|
+
exports.getGraphicClassState = getGraphicClassState, exports.Graphic = getGraphicClassState().Graphic,
|
|
1354
|
+
exports.Graphic.mixin(event_1.EventTarget);
|
|
1340
1355
|
//# sourceMappingURL=graphic.js.map
|