@visactor/vrender-core 0.16.1-alpha.0 → 0.16.2-alpha.0
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/animate/animate.js +1 -1
- package/cjs/animate/animate.js.map +1 -1
- package/cjs/event/federated-event/base-event.js +1 -0
- package/cjs/event/federated-event/base-event.js.map +1 -1
- package/cjs/graphic/graphic.js +2 -2
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/richtext/line.d.ts +1 -0
- package/cjs/graphic/richtext/line.js +6 -3
- package/cjs/graphic/richtext/line.js.map +1 -1
- package/cjs/graphic/richtext/utils.js +2 -1
- package/cjs/graphic/richtext/utils.js.map +1 -1
- package/cjs/graphic/richtext.js +11 -2
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +9 -5
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/render/contributions/render/draw-interceptor.js +2 -1
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/cjs/render/contributions/render/glyph-render.d.ts +1 -2
- package/cjs/render/contributions/render/glyph-render.js +13 -8
- package/cjs/render/contributions/render/glyph-render.js.map +1 -1
- package/dist/index.js +88 -23
- package/dist/index.min.js +1 -1
- package/es/animate/animate.js +1 -1
- package/es/animate/animate.js.map +1 -1
- package/es/event/federated-event/base-event.js +1 -0
- package/es/event/federated-event/base-event.js.map +1 -1
- package/es/graphic/graphic.js +2 -2
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/richtext/line.d.ts +1 -0
- package/es/graphic/richtext/line.js +6 -4
- package/es/graphic/richtext/line.js.map +1 -1
- package/es/graphic/richtext/utils.js +2 -1
- package/es/graphic/richtext/utils.js.map +1 -1
- package/es/graphic/richtext.js +11 -2
- package/es/graphic/richtext.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +12 -6
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.js +2 -1
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/glyph-render.d.ts +1 -2
- package/es/render/contributions/render/glyph-render.js +12 -9
- package/es/render/contributions/render/glyph-render.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4373,7 +4373,7 @@
|
|
|
4373
4373
|
return;
|
|
4374
4374
|
}
|
|
4375
4375
|
ctx.globalAlpha = 1;
|
|
4376
|
-
ctx.lineWidth = 1;
|
|
4376
|
+
ctx.lineWidth = character && typeof character.lineHeight === 'number' ? character.lineHeight : 1;
|
|
4377
4377
|
ctx.strokeStyle = strokeStyle;
|
|
4378
4378
|
let fontSize = character.fontSize || 16;
|
|
4379
4379
|
switch (character.script) {
|
|
@@ -6405,6 +6405,9 @@
|
|
|
6405
6405
|
this.propagationImmediatelyStopped = true;
|
|
6406
6406
|
}
|
|
6407
6407
|
stopPropagation() {
|
|
6408
|
+
if (this.nativeEvent instanceof Event && this.nativeEvent.cancelable) {
|
|
6409
|
+
this.nativeEvent.stopPropagation();
|
|
6410
|
+
}
|
|
6408
6411
|
this.propagationStopped = true;
|
|
6409
6412
|
}
|
|
6410
6413
|
initEvent() {
|
|
@@ -8562,6 +8565,7 @@
|
|
|
8562
8565
|
}
|
|
8563
8566
|
});
|
|
8564
8567
|
}
|
|
8568
|
+
step.propKeys = Object.keys(step.props);
|
|
8565
8569
|
lastStep = lastStep.prev;
|
|
8566
8570
|
}
|
|
8567
8571
|
const initProps = this.stepHead.props;
|
|
@@ -11896,10 +11900,13 @@
|
|
|
11896
11900
|
}
|
|
11897
11901
|
clearStates(hasAnimation) {
|
|
11898
11902
|
if (this.hasState() && this.normalAttrs) {
|
|
11903
|
+
this.currentStates = [];
|
|
11899
11904
|
this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, true);
|
|
11900
11905
|
}
|
|
11906
|
+
else {
|
|
11907
|
+
this.currentStates = [];
|
|
11908
|
+
}
|
|
11901
11909
|
this.normalAttrs = null;
|
|
11902
|
-
this.currentStates = [];
|
|
11903
11910
|
}
|
|
11904
11911
|
removeState(stateName, hasAnimation) {
|
|
11905
11912
|
const index = this.currentStates ? this.currentStates.indexOf(stateName) : -1;
|
|
@@ -16638,7 +16645,6 @@
|
|
|
16638
16645
|
: this.paragraphs[0].character.textAlign) || 'left';
|
|
16639
16646
|
this.direction = direction;
|
|
16640
16647
|
this.directionKey = DIRECTION_KEY[this.direction];
|
|
16641
|
-
const directionKey = this.directionKey;
|
|
16642
16648
|
this.actualWidth = 0;
|
|
16643
16649
|
let maxHeight = 0;
|
|
16644
16650
|
this.paragraphs.forEach((word, index) => {
|
|
@@ -16654,6 +16660,11 @@
|
|
|
16654
16660
|
});
|
|
16655
16661
|
this.height = maxHeight;
|
|
16656
16662
|
this.blankWidth = !isWidthMax ? this.width - this.actualWidth : 0;
|
|
16663
|
+
this.calcOffset(width, isWidthMax);
|
|
16664
|
+
}
|
|
16665
|
+
calcOffset(width, isWidthMax) {
|
|
16666
|
+
const directionKey = this.directionKey;
|
|
16667
|
+
const maxHeight = this.height;
|
|
16657
16668
|
let x = this.left;
|
|
16658
16669
|
let spacing = 0;
|
|
16659
16670
|
if (this.actualWidth < width && !isWidthMax) {
|
|
@@ -17086,18 +17097,35 @@
|
|
|
17086
17097
|
paragraphs.push(new Paragraph(textConfig[i].text, false, textConfig[i]));
|
|
17087
17098
|
}
|
|
17088
17099
|
}
|
|
17089
|
-
const
|
|
17090
|
-
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
const
|
|
17100
|
+
const maxWidthFinite = typeof maxWidth === 'number' && Number.isFinite(maxWidth) && maxWidth > 0;
|
|
17101
|
+
const maxHeightFinite = typeof maxHeight === 'number' && Number.isFinite(maxHeight) && maxHeight > 0;
|
|
17102
|
+
const richTextWidthEnable = typeof width === 'number' &&
|
|
17103
|
+
Number.isFinite(width) &&
|
|
17104
|
+
width > 0 &&
|
|
17105
|
+
(!maxWidthFinite || width <= maxWidth);
|
|
17106
|
+
const richTextHeightEnable = typeof height === 'number' &&
|
|
17107
|
+
Number.isFinite(height) &&
|
|
17108
|
+
height > 0 &&
|
|
17109
|
+
(!maxHeightFinite || height <= maxHeight);
|
|
17110
|
+
const frameWidth = richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0;
|
|
17111
|
+
const frameHeight = richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0;
|
|
17112
|
+
const frame = new Frame(0, 0, frameWidth || 0, frameHeight || 0, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection || 'horizontal', !richTextWidthEnable && maxWidthFinite, !richTextHeightEnable && maxHeightFinite, singleLine || false, (_a = this._frameCache) === null || _a === void 0 ? void 0 : _a.icons);
|
|
17096
17113
|
const wrapper = new Wrapper(frame);
|
|
17097
17114
|
for (let i = 0; i < paragraphs.length; i++) {
|
|
17098
17115
|
wrapper.deal(paragraphs[i]);
|
|
17099
17116
|
}
|
|
17100
17117
|
wrapper.send();
|
|
17118
|
+
const directionEnable = frame.layoutDirection === 'horizontal' ? richTextWidthEnable : richTextHeightEnable;
|
|
17119
|
+
if (!directionEnable) {
|
|
17120
|
+
const frameSize = frame.getActualSizeWidthEllipsis();
|
|
17121
|
+
let offsetSize = frame.layoutDirection === 'horizontal' ? frameSize.width : frameSize.height;
|
|
17122
|
+
if (frame.layoutDirection === 'horizontal' ? maxWidthFinite : maxHeightFinite) {
|
|
17123
|
+
offsetSize = Math.min(offsetSize, frame.layoutDirection === 'horizontal' ? maxWidth : maxHeight);
|
|
17124
|
+
}
|
|
17125
|
+
frame.lines.forEach(function (l) {
|
|
17126
|
+
l.calcOffset(offsetSize, false);
|
|
17127
|
+
});
|
|
17128
|
+
}
|
|
17101
17129
|
this._frameCache = frame;
|
|
17102
17130
|
}
|
|
17103
17131
|
clone() {
|
|
@@ -23092,7 +23120,10 @@
|
|
|
23092
23120
|
}
|
|
23093
23121
|
const { context } = drawContext;
|
|
23094
23122
|
context.highPerformanceSave();
|
|
23095
|
-
context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);
|
|
23123
|
+
graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);
|
|
23124
|
+
graphic.glyphHost &&
|
|
23125
|
+
graphic.glyphHost.parent &&
|
|
23126
|
+
context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, true);
|
|
23096
23127
|
const b = graphic.AABBBounds;
|
|
23097
23128
|
if (graphic.attribute._debug_bounds !== true) {
|
|
23098
23129
|
graphic.attribute._debug_bounds(context, graphic);
|
|
@@ -24297,22 +24328,37 @@
|
|
|
24297
24328
|
injectable()
|
|
24298
24329
|
], DefaultCanvasRichTextRender);
|
|
24299
24330
|
|
|
24300
|
-
let DefaultCanvasGlyphRender = class DefaultCanvasGlyphRender
|
|
24331
|
+
let DefaultCanvasGlyphRender = class DefaultCanvasGlyphRender {
|
|
24301
24332
|
constructor() {
|
|
24302
|
-
super(...arguments);
|
|
24303
24333
|
this.numberType = GLYPH_NUMBER_TYPE;
|
|
24304
24334
|
}
|
|
24305
24335
|
drawShape(glyph, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
24336
|
+
if (!drawContext.drawContribution) {
|
|
24337
|
+
return;
|
|
24338
|
+
}
|
|
24339
|
+
glyph.getSubGraphic().forEach(item => {
|
|
24340
|
+
const renderer = drawContext.drawContribution.getRenderContribution(item);
|
|
24341
|
+
if (renderer && renderer.drawShape) {
|
|
24342
|
+
renderer.drawShape(item, context, x, y, drawContext, params, fillCb, strokeCb);
|
|
24343
|
+
}
|
|
24344
|
+
});
|
|
24345
|
+
}
|
|
24346
|
+
draw(glyph, renderService, drawContext, params) {
|
|
24347
|
+
const { context } = drawContext;
|
|
24348
|
+
if (!context) {
|
|
24349
|
+
return;
|
|
24350
|
+
}
|
|
24351
|
+
context.highPerformanceSave();
|
|
24352
|
+
if (!drawContext.drawContribution) {
|
|
24353
|
+
return;
|
|
24354
|
+
}
|
|
24306
24355
|
const glyphTheme = getTheme(glyph);
|
|
24307
24356
|
const subGraphic = glyph.getSubGraphic();
|
|
24308
24357
|
subGraphic.length &&
|
|
24309
24358
|
subGraphic.forEach(g => {
|
|
24310
24359
|
drawContext.drawContribution.renderItem(g, drawContext, { theme: glyphTheme });
|
|
24311
24360
|
});
|
|
24312
|
-
|
|
24313
|
-
draw(glyph, renderService, drawContext, params) {
|
|
24314
|
-
const glyphAttr = getTheme(glyph).glyph;
|
|
24315
|
-
this._draw(glyph, glyphAttr, false, drawContext, params);
|
|
24361
|
+
context.highPerformanceRestore();
|
|
24316
24362
|
}
|
|
24317
24363
|
};
|
|
24318
24364
|
DefaultCanvasGlyphRender = __decorate([
|
|
@@ -25271,6 +25317,7 @@
|
|
|
25271
25317
|
}
|
|
25272
25318
|
}
|
|
25273
25319
|
|
|
25320
|
+
const _tempBounds = new vutils.AABBBounds();
|
|
25274
25321
|
class FlexLayoutPlugin {
|
|
25275
25322
|
constructor() {
|
|
25276
25323
|
this.name = 'FlexLayoutPlugin';
|
|
@@ -25526,13 +25573,30 @@
|
|
|
25526
25573
|
}
|
|
25527
25574
|
activate(context) {
|
|
25528
25575
|
this.pluginService = context;
|
|
25529
|
-
graphicService.hooks.onAttributeUpdate.tap(this.key, graphic => {
|
|
25576
|
+
application.graphicService.hooks.onAttributeUpdate.tap(this.key, graphic => {
|
|
25530
25577
|
if (graphic.glyphHost) {
|
|
25531
25578
|
graphic = graphic.glyphHost;
|
|
25532
25579
|
}
|
|
25533
25580
|
this.tryLayout(graphic);
|
|
25534
25581
|
});
|
|
25535
|
-
graphicService.hooks.
|
|
25582
|
+
application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
|
|
25583
|
+
if (graphic.glyphHost) {
|
|
25584
|
+
graphic = graphic.glyphHost;
|
|
25585
|
+
}
|
|
25586
|
+
if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
|
|
25587
|
+
return;
|
|
25588
|
+
}
|
|
25589
|
+
_tempBounds.copy(bounds);
|
|
25590
|
+
});
|
|
25591
|
+
application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
|
|
25592
|
+
if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
|
|
25593
|
+
return;
|
|
25594
|
+
}
|
|
25595
|
+
if (!_tempBounds.equals(bounds)) {
|
|
25596
|
+
this.tryLayout(graphic);
|
|
25597
|
+
}
|
|
25598
|
+
});
|
|
25599
|
+
application.graphicService.hooks.onSetStage.tap(this.key, graphic => {
|
|
25536
25600
|
if (graphic.glyphHost) {
|
|
25537
25601
|
graphic = graphic.glyphHost;
|
|
25538
25602
|
}
|
|
@@ -25540,10 +25604,11 @@
|
|
|
25540
25604
|
});
|
|
25541
25605
|
}
|
|
25542
25606
|
deactivate(context) {
|
|
25543
|
-
graphicService.hooks.onAttributeUpdate.taps =
|
|
25544
|
-
|
|
25545
|
-
|
|
25546
|
-
|
|
25607
|
+
application.graphicService.hooks.onAttributeUpdate.taps =
|
|
25608
|
+
application.graphicService.hooks.onAttributeUpdate.taps.filter(item => {
|
|
25609
|
+
return item.name !== this.key;
|
|
25610
|
+
});
|
|
25611
|
+
application.graphicService.hooks.onSetStage.taps = application.graphicService.hooks.onSetStage.taps.filter(item => {
|
|
25547
25612
|
return item.name !== this.key;
|
|
25548
25613
|
});
|
|
25549
25614
|
}
|