@visactor/vrender-core 0.19.21 → 0.19.22
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/color-string/store.js +1 -1
- package/cjs/common/Reflect-metadata.js +1 -2
- package/cjs/common/color-utils.js +2 -1
- package/cjs/common/render-curve.js +1 -2
- package/cjs/common/sort.js +2 -1
- package/cjs/common/text.js +4 -3
- package/cjs/common/text.js.map +1 -1
- package/cjs/common/utils.js +1 -1
- package/cjs/event/federated-event/base-event.js +12 -2
- package/cjs/event/federated-event/base-event.js.map +1 -1
- package/cjs/picker/pick-interceptor.js +2 -1
- package/cjs/picker/pick-interceptor.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/render/contributions/render/index.d.ts +1 -0
- package/cjs/render/contributions/render/index.js +3 -3
- package/cjs/render/contributions/render/index.js.map +1 -1
- package/dist/index.es.js +200 -176
- package/es/color-string/store.js +1 -1
- package/es/common/Reflect-metadata.js +1 -2
- package/es/common/color-utils.js +2 -1
- package/es/common/render-curve.js +1 -2
- package/es/common/sort.js +2 -1
- package/es/common/text.js +5 -4
- package/es/common/text.js.map +1 -1
- package/es/common/utils.js +1 -1
- package/es/event/federated-event/base-event.js +12 -2
- package/es/event/federated-event/base-event.js.map +1 -1
- package/es/picker/pick-interceptor.js +2 -1
- package/es/picker/pick-interceptor.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/render/contributions/render/index.d.ts +1 -0
- package/es/render/contributions/render/index.js +2 -0
- package/es/render/contributions/render/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, has, isUndefined, isArray, cos, sin, pointAt, isNumber, getDecimalPlaces, isValidNumber, clamp, getAngleByPoint, isNumberClose, isNil, Bounds, getIntersectPoint, Color, DEFAULT_COLORS, normalTransform, isValidUrl, isBase64, acos, sqrt, LRU, lowerCamelCaseToMiddle, clampAngleByRadian, asin, transformBoundsWithMatrix, arrayEqual, getRectIntersect, isRectIntersect, calculateAnchorOfBounds, styleStringToObject, merge } from '@visactor/vutils';
|
|
1
|
+
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, has, isUndefined, isArray, cos, sin, pointAt, isNumber, getDecimalPlaces, isValidNumber, clamp, getAngleByPoint, isNumberClose, isNil, Bounds, getIntersectPoint, Color, DEFAULT_COLORS, normalTransform, isValidUrl, isBase64, acos, sqrt, LRU, lowerCamelCaseToMiddle, isValid, clampAngleByRadian, asin, transformBoundsWithMatrix, arrayEqual, getRectIntersect, isRectIntersect, calculateAnchorOfBounds, styleStringToObject, merge } from '@visactor/vutils';
|
|
2
2
|
|
|
3
3
|
class Generator {
|
|
4
4
|
static GenAutoIncrementId() {
|
|
@@ -5825,8 +5825,15 @@ class FederatedEvent {
|
|
|
5825
5825
|
}
|
|
5826
5826
|
}
|
|
5827
5827
|
preventDefault() {
|
|
5828
|
-
|
|
5829
|
-
this.nativeEvent.
|
|
5828
|
+
try {
|
|
5829
|
+
if (this.nativeEvent instanceof Event && this.nativeEvent.cancelable) {
|
|
5830
|
+
this.nativeEvent.preventDefault();
|
|
5831
|
+
}
|
|
5832
|
+
}
|
|
5833
|
+
catch (err) {
|
|
5834
|
+
this.nativeEvent.preventDefault &&
|
|
5835
|
+
isFunction(this.nativeEvent.preventDefault) &&
|
|
5836
|
+
this.nativeEvent.preventDefault();
|
|
5830
5837
|
}
|
|
5831
5838
|
this.defaultPrevented = true;
|
|
5832
5839
|
}
|
|
@@ -5834,8 +5841,15 @@ class FederatedEvent {
|
|
|
5834
5841
|
this.propagationImmediatelyStopped = true;
|
|
5835
5842
|
}
|
|
5836
5843
|
stopPropagation() {
|
|
5837
|
-
|
|
5838
|
-
this.nativeEvent.
|
|
5844
|
+
try {
|
|
5845
|
+
if (this.nativeEvent instanceof Event && this.nativeEvent.cancelable) {
|
|
5846
|
+
this.nativeEvent.stopPropagation();
|
|
5847
|
+
}
|
|
5848
|
+
}
|
|
5849
|
+
catch (err) {
|
|
5850
|
+
this.nativeEvent.stopPropagation &&
|
|
5851
|
+
isFunction(this.nativeEvent.stopPropagation) &&
|
|
5852
|
+
this.nativeEvent.stopPropagation();
|
|
5839
5853
|
}
|
|
5840
5854
|
this.propagationStopped = true;
|
|
5841
5855
|
}
|
|
@@ -13900,6 +13914,9 @@ function textAttributesToStyle(attrs) {
|
|
|
13900
13914
|
const stringTypes = ['textAlign', 'fontFamily', 'fontVariant', 'fontStyle', 'fontWeight'];
|
|
13901
13915
|
const pxKeys = ['fontSize', 'lineHeight'];
|
|
13902
13916
|
const style = {};
|
|
13917
|
+
const parsePxValue = (value) => {
|
|
13918
|
+
return /^\d+(\.\d+)?$/.test(`${value}`) ? `${value}px` : `${value}`;
|
|
13919
|
+
};
|
|
13903
13920
|
stringTypes.forEach(key => {
|
|
13904
13921
|
if (attrs[key]) {
|
|
13905
13922
|
style[lowerCamelCaseToMiddle(key)] = attrs[key];
|
|
@@ -13908,9 +13925,12 @@ function textAttributesToStyle(attrs) {
|
|
|
13908
13925
|
pxKeys.forEach(key => {
|
|
13909
13926
|
const styleKey = lowerCamelCaseToMiddle(key);
|
|
13910
13927
|
if (!isNil(attrs[key])) {
|
|
13911
|
-
style[styleKey] =
|
|
13928
|
+
style[styleKey] = parsePxValue(attrs[key]);
|
|
13912
13929
|
}
|
|
13913
13930
|
});
|
|
13931
|
+
if (isValid(attrs.maxLineWidth)) {
|
|
13932
|
+
style['max-width'] = parsePxValue(attrs.maxLineWidth);
|
|
13933
|
+
}
|
|
13914
13934
|
if (attrs.underline) {
|
|
13915
13935
|
style['text-decoration'] = 'underline';
|
|
13916
13936
|
}
|
|
@@ -22943,6 +22963,173 @@ DefaultCanvasPolygonRender = __decorate([
|
|
|
22943
22963
|
__metadata("design:paramtypes", [Object])
|
|
22944
22964
|
], DefaultCanvasPolygonRender);
|
|
22945
22965
|
|
|
22966
|
+
let DefaultCanvasGroupRender = class DefaultCanvasGroupRender {
|
|
22967
|
+
constructor(groupRenderContribitions) {
|
|
22968
|
+
this.groupRenderContribitions = groupRenderContribitions;
|
|
22969
|
+
this.numberType = GROUP_NUMBER_TYPE;
|
|
22970
|
+
}
|
|
22971
|
+
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
22972
|
+
const groupAttribute = getTheme(group, params === null || params === void 0 ? void 0 : params.theme).group;
|
|
22973
|
+
const { fill = groupAttribute.fill, background, stroke = groupAttribute.stroke, opacity = groupAttribute.opacity, width = groupAttribute.width, height = groupAttribute.height, clip = groupAttribute.clip, fillOpacity = groupAttribute.fillOpacity, strokeOpacity = groupAttribute.strokeOpacity, cornerRadius = groupAttribute.cornerRadius, path = groupAttribute.path, lineWidth = groupAttribute.lineWidth, visible = groupAttribute.visible } = group.attribute;
|
|
22974
|
+
const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);
|
|
22975
|
+
const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);
|
|
22976
|
+
const doFill = runFill(fill, background);
|
|
22977
|
+
const doStroke = runStroke(stroke, lineWidth);
|
|
22978
|
+
if (!(group.valid && visible)) {
|
|
22979
|
+
return;
|
|
22980
|
+
}
|
|
22981
|
+
if (!clip) {
|
|
22982
|
+
if (!(doFill || doStroke)) {
|
|
22983
|
+
return;
|
|
22984
|
+
}
|
|
22985
|
+
if (!(fVisible || sVisible || fillCb || strokeCb || background)) {
|
|
22986
|
+
return;
|
|
22987
|
+
}
|
|
22988
|
+
}
|
|
22989
|
+
if (path && path.length && drawContext.drawContribution) {
|
|
22990
|
+
const disableFill = context.disableFill;
|
|
22991
|
+
const disableStroke = context.disableStroke;
|
|
22992
|
+
const disableBeginPath = context.disableBeginPath;
|
|
22993
|
+
context.disableFill = true;
|
|
22994
|
+
context.disableStroke = true;
|
|
22995
|
+
context.disableBeginPath = true;
|
|
22996
|
+
path.forEach(g => {
|
|
22997
|
+
const rc = drawContext.drawContribution.getRenderContribution(g);
|
|
22998
|
+
rc.draw(g, drawContext.renderService, drawContext, params);
|
|
22999
|
+
});
|
|
23000
|
+
context.disableFill = disableFill;
|
|
23001
|
+
context.disableStroke = disableStroke;
|
|
23002
|
+
context.disableBeginPath = disableBeginPath;
|
|
23003
|
+
}
|
|
23004
|
+
else if (cornerRadius === 0 || (isArray(cornerRadius) && cornerRadius.every(num => num === 0))) {
|
|
23005
|
+
context.beginPath();
|
|
23006
|
+
context.rect(x, y, width, height);
|
|
23007
|
+
}
|
|
23008
|
+
else {
|
|
23009
|
+
context.beginPath();
|
|
23010
|
+
createRectPath(context, x, y, width, height, cornerRadius);
|
|
23011
|
+
}
|
|
23012
|
+
if (!this._groupRenderContribitions) {
|
|
23013
|
+
this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [];
|
|
23014
|
+
this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);
|
|
23015
|
+
}
|
|
23016
|
+
const doFillOrStroke = {
|
|
23017
|
+
doFill,
|
|
23018
|
+
doStroke
|
|
23019
|
+
};
|
|
23020
|
+
this._groupRenderContribitions.forEach(c => {
|
|
23021
|
+
if (c.time === BaseRenderContributionTime.beforeFillStroke) {
|
|
23022
|
+
c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
|
|
23023
|
+
}
|
|
23024
|
+
});
|
|
23025
|
+
if (clip) {
|
|
23026
|
+
context.clip();
|
|
23027
|
+
}
|
|
23028
|
+
context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);
|
|
23029
|
+
if (doFillOrStroke.doFill) {
|
|
23030
|
+
if (fillCb) {
|
|
23031
|
+
fillCb(context, group.attribute, groupAttribute);
|
|
23032
|
+
}
|
|
23033
|
+
else if (fVisible) {
|
|
23034
|
+
context.setCommonStyle(group, group.attribute, x, y, groupAttribute);
|
|
23035
|
+
context.fill();
|
|
23036
|
+
}
|
|
23037
|
+
}
|
|
23038
|
+
if (doFillOrStroke.doStroke) {
|
|
23039
|
+
if (strokeCb) {
|
|
23040
|
+
strokeCb(context, group.attribute, groupAttribute);
|
|
23041
|
+
}
|
|
23042
|
+
else if (sVisible) {
|
|
23043
|
+
context.setStrokeStyle(group, group.attribute, x, y, groupAttribute);
|
|
23044
|
+
context.stroke();
|
|
23045
|
+
}
|
|
23046
|
+
}
|
|
23047
|
+
this._groupRenderContribitions.forEach(c => {
|
|
23048
|
+
if (c.time === BaseRenderContributionTime.afterFillStroke) {
|
|
23049
|
+
c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb);
|
|
23050
|
+
}
|
|
23051
|
+
});
|
|
23052
|
+
}
|
|
23053
|
+
draw(group, renderService, drawContext, params) {
|
|
23054
|
+
const { context } = drawContext;
|
|
23055
|
+
if (!context) {
|
|
23056
|
+
return;
|
|
23057
|
+
}
|
|
23058
|
+
const { clip, baseOpacity = 1 } = group.attribute;
|
|
23059
|
+
if (clip) {
|
|
23060
|
+
context.save();
|
|
23061
|
+
}
|
|
23062
|
+
else {
|
|
23063
|
+
context.highPerformanceSave();
|
|
23064
|
+
}
|
|
23065
|
+
context.baseGlobalAlpha *= baseOpacity;
|
|
23066
|
+
const groupAttribute = getTheme(group, params === null || params === void 0 ? void 0 : params.theme).group;
|
|
23067
|
+
const lastModelMatrix = context.modelMatrix;
|
|
23068
|
+
const camera = context.camera;
|
|
23069
|
+
if (camera) {
|
|
23070
|
+
const nextModelMatrix = mat4Allocate.allocate();
|
|
23071
|
+
const modelMatrix = mat4Allocate.allocate();
|
|
23072
|
+
getModelMatrix(modelMatrix, group, groupAttribute);
|
|
23073
|
+
if (lastModelMatrix) {
|
|
23074
|
+
multiplyMat4Mat4(nextModelMatrix, lastModelMatrix, modelMatrix);
|
|
23075
|
+
}
|
|
23076
|
+
else {
|
|
23077
|
+
multiplyMat4Mat4(nextModelMatrix, nextModelMatrix, modelMatrix);
|
|
23078
|
+
}
|
|
23079
|
+
context.modelMatrix = nextModelMatrix;
|
|
23080
|
+
mat4Allocate.free(modelMatrix);
|
|
23081
|
+
context.setTransform(1, 0, 0, 1, 0, 0, true);
|
|
23082
|
+
}
|
|
23083
|
+
else {
|
|
23084
|
+
context.transformFromMatrix(group.transMatrix, true);
|
|
23085
|
+
}
|
|
23086
|
+
context.beginPath();
|
|
23087
|
+
if (params.skipDraw) {
|
|
23088
|
+
this.drawShape(group, context, 0, 0, drawContext, params, () => false, () => false);
|
|
23089
|
+
}
|
|
23090
|
+
else {
|
|
23091
|
+
this.drawShape(group, context, 0, 0, drawContext);
|
|
23092
|
+
}
|
|
23093
|
+
const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = group.attribute;
|
|
23094
|
+
if (scrollX || scrollY) {
|
|
23095
|
+
context.translate(scrollX, scrollY);
|
|
23096
|
+
}
|
|
23097
|
+
let p;
|
|
23098
|
+
if (params && params.drawingCb) {
|
|
23099
|
+
p = params.drawingCb();
|
|
23100
|
+
}
|
|
23101
|
+
if (context.modelMatrix !== lastModelMatrix) {
|
|
23102
|
+
mat4Allocate.free(context.modelMatrix);
|
|
23103
|
+
}
|
|
23104
|
+
context.modelMatrix = lastModelMatrix;
|
|
23105
|
+
context.baseGlobalAlpha /= baseOpacity;
|
|
23106
|
+
if (p && p.then) {
|
|
23107
|
+
p.then(() => {
|
|
23108
|
+
if (clip) {
|
|
23109
|
+
context.restore();
|
|
23110
|
+
}
|
|
23111
|
+
else {
|
|
23112
|
+
context.highPerformanceRestore();
|
|
23113
|
+
}
|
|
23114
|
+
});
|
|
23115
|
+
}
|
|
23116
|
+
else {
|
|
23117
|
+
if (clip) {
|
|
23118
|
+
context.restore();
|
|
23119
|
+
}
|
|
23120
|
+
else {
|
|
23121
|
+
context.highPerformanceRestore();
|
|
23122
|
+
}
|
|
23123
|
+
}
|
|
23124
|
+
}
|
|
23125
|
+
};
|
|
23126
|
+
DefaultCanvasGroupRender = __decorate([
|
|
23127
|
+
injectable(),
|
|
23128
|
+
__param(0, inject(ContributionProvider)),
|
|
23129
|
+
__param(0, named(GroupRenderContribution)),
|
|
23130
|
+
__metadata("design:paramtypes", [Object])
|
|
23131
|
+
], DefaultCanvasGroupRender);
|
|
23132
|
+
|
|
22946
23133
|
const repeatStr = ['', 'repeat-x', 'repeat-y', 'repeat'];
|
|
22947
23134
|
let DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender {
|
|
22948
23135
|
constructor(imageRenderContribitions) {
|
|
@@ -23502,6 +23689,9 @@ let ShadowRootPickItemInterceptorContribution = class ShadowRootPickItemIntercep
|
|
|
23502
23689
|
const newPoint = new Point(currentGroupMatrix.a * point.x + currentGroupMatrix.c * point.y + currentGroupMatrix.e, currentGroupMatrix.b * point.x + currentGroupMatrix.d * point.y + currentGroupMatrix.f);
|
|
23503
23690
|
const result = pickerService.pickGroup(g, newPoint, currentGroupMatrix, pickParams);
|
|
23504
23691
|
context.highPerformanceRestore();
|
|
23692
|
+
if (!result.graphic && result.group) {
|
|
23693
|
+
result.graphic = result.group;
|
|
23694
|
+
}
|
|
23505
23695
|
return result;
|
|
23506
23696
|
}
|
|
23507
23697
|
};
|
|
@@ -24439,173 +24629,6 @@ DefaultDrawContribution = __decorate([
|
|
|
24439
24629
|
__metadata("design:paramtypes", [Array, Object])
|
|
24440
24630
|
], DefaultDrawContribution);
|
|
24441
24631
|
|
|
24442
|
-
let DefaultCanvasGroupRender = class DefaultCanvasGroupRender {
|
|
24443
|
-
constructor(groupRenderContribitions) {
|
|
24444
|
-
this.groupRenderContribitions = groupRenderContribitions;
|
|
24445
|
-
this.numberType = GROUP_NUMBER_TYPE;
|
|
24446
|
-
}
|
|
24447
|
-
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
24448
|
-
const groupAttribute = getTheme(group, params === null || params === void 0 ? void 0 : params.theme).group;
|
|
24449
|
-
const { fill = groupAttribute.fill, background, stroke = groupAttribute.stroke, opacity = groupAttribute.opacity, width = groupAttribute.width, height = groupAttribute.height, clip = groupAttribute.clip, fillOpacity = groupAttribute.fillOpacity, strokeOpacity = groupAttribute.strokeOpacity, cornerRadius = groupAttribute.cornerRadius, path = groupAttribute.path, lineWidth = groupAttribute.lineWidth, visible = groupAttribute.visible } = group.attribute;
|
|
24450
|
-
const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);
|
|
24451
|
-
const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);
|
|
24452
|
-
const doFill = runFill(fill, background);
|
|
24453
|
-
const doStroke = runStroke(stroke, lineWidth);
|
|
24454
|
-
if (!(group.valid && visible)) {
|
|
24455
|
-
return;
|
|
24456
|
-
}
|
|
24457
|
-
if (!clip) {
|
|
24458
|
-
if (!(doFill || doStroke)) {
|
|
24459
|
-
return;
|
|
24460
|
-
}
|
|
24461
|
-
if (!(fVisible || sVisible || fillCb || strokeCb || background)) {
|
|
24462
|
-
return;
|
|
24463
|
-
}
|
|
24464
|
-
}
|
|
24465
|
-
if (path && path.length && drawContext.drawContribution) {
|
|
24466
|
-
const disableFill = context.disableFill;
|
|
24467
|
-
const disableStroke = context.disableStroke;
|
|
24468
|
-
const disableBeginPath = context.disableBeginPath;
|
|
24469
|
-
context.disableFill = true;
|
|
24470
|
-
context.disableStroke = true;
|
|
24471
|
-
context.disableBeginPath = true;
|
|
24472
|
-
path.forEach(g => {
|
|
24473
|
-
const rc = drawContext.drawContribution.getRenderContribution(g);
|
|
24474
|
-
rc.draw(g, drawContext.renderService, drawContext, params);
|
|
24475
|
-
});
|
|
24476
|
-
context.disableFill = disableFill;
|
|
24477
|
-
context.disableStroke = disableStroke;
|
|
24478
|
-
context.disableBeginPath = disableBeginPath;
|
|
24479
|
-
}
|
|
24480
|
-
else if (cornerRadius === 0 || (isArray(cornerRadius) && cornerRadius.every(num => num === 0))) {
|
|
24481
|
-
context.beginPath();
|
|
24482
|
-
context.rect(x, y, width, height);
|
|
24483
|
-
}
|
|
24484
|
-
else {
|
|
24485
|
-
context.beginPath();
|
|
24486
|
-
createRectPath(context, x, y, width, height, cornerRadius);
|
|
24487
|
-
}
|
|
24488
|
-
if (!this._groupRenderContribitions) {
|
|
24489
|
-
this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [];
|
|
24490
|
-
this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);
|
|
24491
|
-
}
|
|
24492
|
-
const doFillOrStroke = {
|
|
24493
|
-
doFill,
|
|
24494
|
-
doStroke
|
|
24495
|
-
};
|
|
24496
|
-
this._groupRenderContribitions.forEach(c => {
|
|
24497
|
-
if (c.time === BaseRenderContributionTime.beforeFillStroke) {
|
|
24498
|
-
c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
|
|
24499
|
-
}
|
|
24500
|
-
});
|
|
24501
|
-
if (clip) {
|
|
24502
|
-
context.clip();
|
|
24503
|
-
}
|
|
24504
|
-
context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);
|
|
24505
|
-
if (doFillOrStroke.doFill) {
|
|
24506
|
-
if (fillCb) {
|
|
24507
|
-
fillCb(context, group.attribute, groupAttribute);
|
|
24508
|
-
}
|
|
24509
|
-
else if (fVisible) {
|
|
24510
|
-
context.setCommonStyle(group, group.attribute, x, y, groupAttribute);
|
|
24511
|
-
context.fill();
|
|
24512
|
-
}
|
|
24513
|
-
}
|
|
24514
|
-
if (doFillOrStroke.doStroke) {
|
|
24515
|
-
if (strokeCb) {
|
|
24516
|
-
strokeCb(context, group.attribute, groupAttribute);
|
|
24517
|
-
}
|
|
24518
|
-
else if (sVisible) {
|
|
24519
|
-
context.setStrokeStyle(group, group.attribute, x, y, groupAttribute);
|
|
24520
|
-
context.stroke();
|
|
24521
|
-
}
|
|
24522
|
-
}
|
|
24523
|
-
this._groupRenderContribitions.forEach(c => {
|
|
24524
|
-
if (c.time === BaseRenderContributionTime.afterFillStroke) {
|
|
24525
|
-
c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb);
|
|
24526
|
-
}
|
|
24527
|
-
});
|
|
24528
|
-
}
|
|
24529
|
-
draw(group, renderService, drawContext, params) {
|
|
24530
|
-
const { context } = drawContext;
|
|
24531
|
-
if (!context) {
|
|
24532
|
-
return;
|
|
24533
|
-
}
|
|
24534
|
-
const { clip, baseOpacity = 1 } = group.attribute;
|
|
24535
|
-
if (clip) {
|
|
24536
|
-
context.save();
|
|
24537
|
-
}
|
|
24538
|
-
else {
|
|
24539
|
-
context.highPerformanceSave();
|
|
24540
|
-
}
|
|
24541
|
-
context.baseGlobalAlpha *= baseOpacity;
|
|
24542
|
-
const groupAttribute = getTheme(group, params === null || params === void 0 ? void 0 : params.theme).group;
|
|
24543
|
-
const lastModelMatrix = context.modelMatrix;
|
|
24544
|
-
const camera = context.camera;
|
|
24545
|
-
if (camera) {
|
|
24546
|
-
const nextModelMatrix = mat4Allocate.allocate();
|
|
24547
|
-
const modelMatrix = mat4Allocate.allocate();
|
|
24548
|
-
getModelMatrix(modelMatrix, group, groupAttribute);
|
|
24549
|
-
if (lastModelMatrix) {
|
|
24550
|
-
multiplyMat4Mat4(nextModelMatrix, lastModelMatrix, modelMatrix);
|
|
24551
|
-
}
|
|
24552
|
-
else {
|
|
24553
|
-
multiplyMat4Mat4(nextModelMatrix, nextModelMatrix, modelMatrix);
|
|
24554
|
-
}
|
|
24555
|
-
context.modelMatrix = nextModelMatrix;
|
|
24556
|
-
mat4Allocate.free(modelMatrix);
|
|
24557
|
-
context.setTransform(1, 0, 0, 1, 0, 0, true);
|
|
24558
|
-
}
|
|
24559
|
-
else {
|
|
24560
|
-
context.transformFromMatrix(group.transMatrix, true);
|
|
24561
|
-
}
|
|
24562
|
-
context.beginPath();
|
|
24563
|
-
if (params.skipDraw) {
|
|
24564
|
-
this.drawShape(group, context, 0, 0, drawContext, params, () => false, () => false);
|
|
24565
|
-
}
|
|
24566
|
-
else {
|
|
24567
|
-
this.drawShape(group, context, 0, 0, drawContext);
|
|
24568
|
-
}
|
|
24569
|
-
const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = group.attribute;
|
|
24570
|
-
if (scrollX || scrollY) {
|
|
24571
|
-
context.translate(scrollX, scrollY);
|
|
24572
|
-
}
|
|
24573
|
-
let p;
|
|
24574
|
-
if (params && params.drawingCb) {
|
|
24575
|
-
p = params.drawingCb();
|
|
24576
|
-
}
|
|
24577
|
-
if (context.modelMatrix !== lastModelMatrix) {
|
|
24578
|
-
mat4Allocate.free(context.modelMatrix);
|
|
24579
|
-
}
|
|
24580
|
-
context.modelMatrix = lastModelMatrix;
|
|
24581
|
-
context.baseGlobalAlpha /= baseOpacity;
|
|
24582
|
-
if (p && p.then) {
|
|
24583
|
-
p.then(() => {
|
|
24584
|
-
if (clip) {
|
|
24585
|
-
context.restore();
|
|
24586
|
-
}
|
|
24587
|
-
else {
|
|
24588
|
-
context.highPerformanceRestore();
|
|
24589
|
-
}
|
|
24590
|
-
});
|
|
24591
|
-
}
|
|
24592
|
-
else {
|
|
24593
|
-
if (clip) {
|
|
24594
|
-
context.restore();
|
|
24595
|
-
}
|
|
24596
|
-
else {
|
|
24597
|
-
context.highPerformanceRestore();
|
|
24598
|
-
}
|
|
24599
|
-
}
|
|
24600
|
-
}
|
|
24601
|
-
};
|
|
24602
|
-
DefaultCanvasGroupRender = __decorate([
|
|
24603
|
-
injectable(),
|
|
24604
|
-
__param(0, inject(ContributionProvider)),
|
|
24605
|
-
__param(0, named(GroupRenderContribution)),
|
|
24606
|
-
__metadata("design:paramtypes", [Object])
|
|
24607
|
-
], DefaultCanvasGroupRender);
|
|
24608
|
-
|
|
24609
24632
|
let DefaultIncrementalCanvasLineRender = class DefaultIncrementalCanvasLineRender extends DefaultCanvasLineRender {
|
|
24610
24633
|
constructor() {
|
|
24611
24634
|
super(...arguments);
|
|
@@ -25254,8 +25277,9 @@ class HtmlAttributePlugin {
|
|
|
25254
25277
|
}
|
|
25255
25278
|
const containerTL = application.global.getElementTopLeft(nativeContainer, false);
|
|
25256
25279
|
const windowTL = stage.window.getTopLeft(false);
|
|
25257
|
-
const
|
|
25258
|
-
const
|
|
25280
|
+
const viewBox = stage.viewBox;
|
|
25281
|
+
const offsetX = left + windowTL.left - containerTL.left + viewBox.x1;
|
|
25282
|
+
const offsetTop = top + windowTL.top - containerTL.top + viewBox.y1;
|
|
25259
25283
|
calculateStyle.left = `${offsetX}px`;
|
|
25260
25284
|
calculateStyle.top = `${offsetTop}px`;
|
|
25261
25285
|
if (graphic.type === 'text' && anchorType === 'position') {
|
|
@@ -29479,4 +29503,4 @@ function registerWrapTextGraphic() {
|
|
|
29479
29503
|
graphicCreator.RegisterGraphicCreator('wrapText', createWrapText);
|
|
29480
29504
|
}
|
|
29481
29505
|
|
|
29482
|
-
export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MatrixAllocate, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VGlobal, VWindow, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache$1 as calcLineCache, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getContextFont, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, imageModule, incrementalAddTo, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, layerService, lineModule, lookAt, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiply, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerGlyphGraphic, registerGroupGraphic, registerImageGraphic, registerLineGraphic, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerSymbolGraphic, registerTextGraphic, registerWrapTextGraphic, renderCommandList, rewriteProto, richtextModule, rotateX, rotateY, runFill, runStroke, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformKeys, transformMat4, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };
|
|
29506
|
+
export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MatrixAllocate, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VGlobal, VWindow, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache$1 as calcLineCache, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getContextFont, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, imageModule, incrementalAddTo, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, layerService, lineModule, lookAt, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiply, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerGlyphGraphic, registerGroupGraphic, registerImageGraphic, registerLineGraphic, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerSymbolGraphic, registerTextGraphic, registerWrapTextGraphic, renderCommandList, rewriteProto, richtextModule, rotateX, rotateY, runFill, runStroke, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformKeys, transformMat4, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };
|
package/es/color-string/store.js
CHANGED
package/es/common/color-utils.js
CHANGED
|
@@ -102,5 +102,4 @@ export function drawIncrementalAreaSegments(path, lastSeg, segments, params) {
|
|
|
102
102
|
path.lineTo(null !== (_c = startP.x1) && void 0 !== _c ? _c : startP.x, null !== (_d = startP.y1) && void 0 !== _d ? _d : startP.y),
|
|
103
103
|
path.closePath();
|
|
104
104
|
}));
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=render-curve.js.map
|
|
105
|
+
}
|
package/es/common/sort.js
CHANGED
package/es/common/text.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isNil, isString, lowerCamelCaseToMiddle } from "@visactor/vutils";
|
|
1
|
+
import { isNil, isString, isValid, lowerCamelCaseToMiddle } from "@visactor/vutils";
|
|
2
2
|
|
|
3
3
|
export function getContextFont(text, defaultAttr = {}, fontSizeScale) {
|
|
4
4
|
fontSizeScale || (fontSizeScale = 1);
|
|
@@ -20,13 +20,14 @@ export function textLayoutOffsetY(baseline, lineHeight, fontSize, buf = 0) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function textAttributesToStyle(attrs) {
|
|
23
|
-
const style = {}
|
|
23
|
+
const style = {}, parsePxValue = value => /^\d+(\.\d+)?$/.test(`${value}`) ? `${value}px` : `${value}`;
|
|
24
24
|
return [ "textAlign", "fontFamily", "fontVariant", "fontStyle", "fontWeight" ].forEach((key => {
|
|
25
25
|
attrs[key] && (style[lowerCamelCaseToMiddle(key)] = attrs[key]);
|
|
26
26
|
})), [ "fontSize", "lineHeight" ].forEach((key => {
|
|
27
27
|
const styleKey = lowerCamelCaseToMiddle(key);
|
|
28
|
-
isNil(attrs[key]) || (style[styleKey] =
|
|
29
|
-
})), attrs.
|
|
28
|
+
isNil(attrs[key]) || (style[styleKey] = parsePxValue(attrs[key]));
|
|
29
|
+
})), isValid(attrs.maxLineWidth) && (style["max-width"] = parsePxValue(attrs.maxLineWidth)),
|
|
30
|
+
attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"),
|
|
30
31
|
attrs.fill && isString(attrs.fill) && (style.color = attrs.fill), style;
|
|
31
32
|
}
|
|
32
33
|
//# sourceMappingURL=text.js.map
|
package/es/common/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAwB,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/common/text.ts"],"names":[],"mappings":"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","file":"text.js","sourcesContent":["// 存放一些公共方法,公共配置\n\nimport { isNil, isString, isValid, type ITextFontParams, lowerCamelCaseToMiddle } from '@visactor/vutils';\nimport type { ITextGraphicAttribute, TextAlignType, TextBaselineType } from '../interface';\n\nexport function getContextFont(\n text: Partial<ITextFontParams>,\n defaultAttr: Partial<ITextFontParams> = {},\n fontSizeScale?: number\n): string {\n if (!fontSizeScale) {\n fontSizeScale = 1;\n }\n const {\n fontStyle = defaultAttr.fontStyle,\n fontVariant = defaultAttr.fontVariant,\n fontWeight = defaultAttr.fontWeight,\n fontSize = defaultAttr.fontSize,\n fontFamily = defaultAttr.fontFamily\n } = text;\n return (\n '' +\n (fontStyle ? fontStyle + ' ' : '') +\n (fontVariant ? fontVariant + ' ' : '') +\n (fontWeight ? fontWeight + ' ' : '') +\n fontSize * fontSizeScale +\n 'px ' +\n (fontFamily ? fontFamily : 'sans-serif')\n );\n}\n// TODO: 更好的方案\n/**\n * 用于绘制的时候偏移\n * 经验值,来源于 https://github.com/vega/vega/blob/b45cf431cd6c0d0c0e1567f087f9b3b55bc236fa/packages/vega-scenegraph/src/util/text.js\n * @param baseline\n * @param h\n * @returns\n */\nexport function textDrawOffsetY(baseline: TextBaselineType, h: number): number {\n const offset =\n baseline === 'top'\n ? Math.ceil(0.79 * h)\n : baseline === 'middle'\n ? Math.round(0.3 * h)\n : baseline === 'bottom'\n ? Math.round(-0.21 * h)\n : 0;\n return offset;\n}\n\n/**\n * 用于绘制的时候偏移\n * @param textAlign\n * @param width\n * @returns\n */\nexport function textDrawOffsetX(textAlign: TextAlignType, width: number): number {\n if (textAlign === 'end' || textAlign === 'right') {\n return -width;\n } else if (textAlign === 'center') {\n return -width / 2;\n }\n return 0;\n}\n\n/**\n * 用于计算布局的偏移\n * 经验值,来源于 https://github.com/vega/vega/blob/b45cf431cd6c0d0c0e1567f087f9b3b55bc236fa/packages/vega-scenegraph/src/util/text.js\n * @param baseline\n * @param lineHeight\n * @returns\n */\nexport function textLayoutOffsetY(\n baseline: TextBaselineType,\n lineHeight: number,\n fontSize: number,\n buf: number = 0\n): number {\n if (baseline === 'middle') {\n return -lineHeight / 2;\n }\n if (baseline === 'top') {\n return 0;\n }\n if (baseline === 'bottom') {\n return buf - lineHeight;\n }\n if (!baseline || baseline === 'alphabetic') {\n if (!fontSize) {\n fontSize = lineHeight;\n }\n return -(lineHeight - fontSize) / 2 - 0.79 * fontSize;\n }\n return 0;\n}\n\nexport function textAttributesToStyle(attrs: ITextGraphicAttribute) {\n const stringTypes = ['textAlign', 'fontFamily', 'fontVariant', 'fontStyle', 'fontWeight'];\n const pxKeys = ['fontSize', 'lineHeight'];\n const style: any = {};\n const parsePxValue = (value: string | number) => {\n return /^\\d+(\\.\\d+)?$/.test(`${value}`) ? `${value}px` : `${value}`;\n };\n\n stringTypes.forEach(key => {\n if (attrs[key]) {\n style[lowerCamelCaseToMiddle(key)] = attrs[key];\n }\n });\n\n pxKeys.forEach(key => {\n const styleKey = lowerCamelCaseToMiddle(key);\n if (!isNil(attrs[key])) {\n style[styleKey] = parsePxValue(attrs[key]);\n }\n });\n\n if (isValid(attrs.maxLineWidth)) {\n style['max-width'] = parsePxValue(attrs.maxLineWidth);\n }\n\n if (attrs.underline) {\n style['text-decoration'] = 'underline';\n } else if (attrs.lineThrough) {\n style['text-decoration'] = 'line-through';\n }\n\n if (attrs.fill) {\n if (isString(attrs.fill)) {\n style.color = attrs.fill;\n }\n }\n\n return style;\n}\n"]}
|
package/es/common/utils.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isFunction } from "@visactor/vutils";
|
|
2
|
+
|
|
1
3
|
export class FederatedEvent {
|
|
2
4
|
get layerX() {
|
|
3
5
|
return this.layer.x;
|
|
@@ -66,14 +68,22 @@ export class FederatedEvent {
|
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
preventDefault() {
|
|
69
|
-
|
|
71
|
+
try {
|
|
72
|
+
this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.preventDefault();
|
|
73
|
+
} catch (err) {
|
|
74
|
+
this.nativeEvent.preventDefault && isFunction(this.nativeEvent.preventDefault) && this.nativeEvent.preventDefault();
|
|
75
|
+
}
|
|
70
76
|
this.defaultPrevented = !0;
|
|
71
77
|
}
|
|
72
78
|
stopImmediatePropagation() {
|
|
73
79
|
this.propagationImmediatelyStopped = !0;
|
|
74
80
|
}
|
|
75
81
|
stopPropagation() {
|
|
76
|
-
|
|
82
|
+
try {
|
|
83
|
+
this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.stopPropagation();
|
|
84
|
+
} catch (err) {
|
|
85
|
+
this.nativeEvent.stopPropagation && isFunction(this.nativeEvent.stopPropagation) && this.nativeEvent.stopPropagation();
|
|
86
|
+
}
|
|
77
87
|
this.propagationStopped = !0;
|
|
78
88
|
}
|
|
79
89
|
initEvent() {}
|