UNPKG

@visactor/vrender-core

Version:
338 lines (307 loc) 8.06 kB
import { Logger, Matrix, pi2 } from "@visactor/vutils"; import { CustomPath2D } from "../common/custom-path2d"; import { MeasureModeEnum } from "../interface"; export const DefaultLayout = { alignSelf: "auto" }; export const DefaultTransform = { x: 0, y: 0, z: 0, dx: 0, dy: 0, dz: 0, scrollX: 0, scrollY: 0, scaleX: 1, scaleY: 1, scaleZ: 1, angle: 0, alpha: 0, beta: 0, scaleCenter: [ 0, 0 ], anchor: [ 0, 0 ], anchor3d: [ 0, 0 ], postMatrix: new Matrix }; export const DefaultFillStyle = { fillOpacity: 1, fill: !1, shadowBlur: 0, shadowColor: "black", shadowOffsetX: 0, shadowOffsetY: 0 }; const commonStroke = { strokeOpacity: 1, lineDash: [], lineDashOffset: 0, lineWidth: 1, lineCap: "butt", lineJoin: "miter", miterLimit: 10, strokeBoundsBuffer: 2, stroke: !1 }; export const DefaultStrokeStyle = Object.assign({ outerBorder: Object.assign(Object.assign({}, commonStroke), { distance: 0 }), innerBorder: Object.assign(Object.assign({}, commonStroke), { distance: 0 }) }, commonStroke); export const DefaultTextStyle = { text: "", maxLineWidth: 1 / 0, maxWidth: 1 / 0, textAlign: "left", textBaseline: "alphabetic", fontSize: 16, fontFamily: "PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol", fontWeight: "", ellipsis: "…", fontVariant: "", fontStyle: "", lineHeight: void 0, underline: 0, lineThrough: 0, scaleIn3d: !1, direction: "horizontal", wordBreak: "break-all", ignoreBuf: !1, verticalMode: 0, wrap: !1, whiteSpace: "no-wrap", heightLimit: 1 / 0, lineClamp: 1 / 0, suffixPosition: "end", underlineDash: [], underlineOffset: 0, disableAutoClipedPoptip: void 0, measureMode: MeasureModeEnum.fontBounding, keepCenterInLine: !1 }; export const DefaultPickStyle = { pickStrokeBuffer: 0 }; export const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({ forceBoundsWidth: void 0, forceBoundsHeight: void 0, opacity: 1, background: null, autoAnimateTexture: !1, textureRatio: 1, textureOptions: null, backgroundOpacity: 1, backgroundCornerRadius: 0, texture: null, textureColor: "black", textureSize: 10, texturePadding: 2, backgroundMode: "no-repeat", backgroundFit: !0, backgroundKeepAspectRatio: !1, backgroundClip: !0, backgroundScale: 1, backgroundOffsetX: 0, backgroundOffsetY: 0, blur: 0, filter: "", cursor: null, html: null, react: null }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout), DefaultPickStyle); export const DefaultConnectAttribute = { connectedType: "none", connectedStyle: {}, connectedX: NaN, connectedY: NaN }; export const DefaultDebugAttribute = { _debug_bounds: !1 }; export const DefaultAttribute = Object.assign(Object.assign(Object.assign({ strokeSeg: null, renderable: !0, pickable: !0, shadowGraphic: void 0, childrenPickable: !0, fillPickable: !0, strokePickable: !0, visible: !0, zIndex: 0, layout: null, boundsPadding: 0, fillStrokeOrder: 0, renderStyle: "default", pickMode: "accurate", customPickShape: null, boundsMode: "accurate", keepDirIn3d: !0, shadowRootIdx: 1, globalZIndex: 1, globalCompositeOperation: "", overflow: "hidden", shadowPickMode: "graphic", keepStrokeScale: !1, clipConfig: null }, DefaultDebugAttribute), DefaultStyle), DefaultTransform); export function addAttributeToPrototype(obj, c, keys) { keys.forEach((key => { c.prototype[key] = obj[key]; })); } export function rewriteProto(obj, c) { Object.setPrototypeOf(obj, c); } export const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), { startAngle: 0, endAngle: pi2, innerRadius: 0, outerRadius: 1, innerPadding: 0, outerPadding: 0, cornerRadius: 0, padRadius: 0, padAngle: 0, cap: !1, forceShowCap: !1 }); export const DefaultAreaAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: "linear", clipRange: 1, closePath: !1, curveTension: 1 }); export const DefaultCircleAttribute = Object.assign(Object.assign({}, DefaultAttribute), { radius: 1, startAngle: 0, endAngle: pi2 }); export const DefaultGroupAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, cornerRadius: 0, path: [], clip: !1, visibleAll: !0, display: "relative", flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-start", alignItems: "flex-start", alignContent: "flex-start", baseOpacity: 1, cornerType: "round" }); export const DefaultGlyphAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: "", width: 0, height: 0, cornerRadius: 0, clip: !1 }); export const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: "linear", clipRange: 1, clipRangeByDimension: "default", closePath: !1, curveTension: 1 }); export const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: new CustomPath2D, fillStrokeOrder: 1, clipRange: 1, customPath: () => { Logger.getInstance().warn("空函数"); } }); export const DefaultPolygonAttribute = Object.assign(Object.assign({}, DefaultAttribute), { points: [], cornerRadius: 0, closePath: !0 }); export const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, x1: 0, y1: 0, strokeBoundsBuffer: 0, cornerRadius: 0, cornerType: "round" }); export const DefaultRect3dAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, x1: 0, y1: 0, cornerRadius: 0, length: 0, cornerType: "round" }); export const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), { symbolType: "circle", size: 10, keepDirIn3d: !0, clipRange: 1 }); export const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { strokeBoundsBuffer: 0, keepDirIn3d: !0 }); export const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { upgradeAttrs: null, editable: !1, editOptions: null, ascentDescentMode: "actual", width: 300, height: 300, ellipsis: !0, wordBreak: "break-word", verticalDirection: "top", textAlign: "left", textBaseline: "top", layoutDirection: "horizontal", textConfig: [], disableAutoWrapLine: !1, maxHeight: void 0, maxWidth: void 0, singleLine: !1 }); export const DefaultImageAttribute = Object.assign(Object.assign({ repeatX: "no-repeat", repeatY: "no-repeat", image: "", width: 0, height: 0, maxWidth: 500, maxHeight: 500 }, DefaultAttribute), { fill: !0, cornerRadius: 0, cornerType: "round" }); export const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImageAttribute), { backgroundShowMode: "never", backgroundWidth: 0, backgroundHeight: 0, textAlign: "left", textBaseline: "middle", direction: "horizontal", margin: 0, id: "", width: 20, height: 20, backgroundFill: "rgba(101, 117, 168, 0.1)", backgroundFillOpacity: 1, backgroundStroke: !1, backgroundStrokeOpacity: 1, backgroundRadius: 4, opacity: 1 }); //# sourceMappingURL=config.js.map