@visactor/vrender-core 0.17.7-alpha.1 → 0.17.7-alpha.2
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/core/graphic-utils.d.ts +2 -1
- package/cjs/core/graphic-utils.js +29 -1
- package/cjs/core/graphic-utils.js.map +1 -1
- package/cjs/interface/core.d.ts +2 -1
- package/cjs/interface/core.js.map +1 -1
- package/cjs/modules.d.ts +0 -1
- package/cjs/modules.js +5 -11
- package/cjs/modules.js.map +1 -1
- package/cjs/picker/pick-modules.js +2 -3
- package/cjs/picker/pick-modules.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.js +2 -2
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/dist/index.js +171 -141
- package/dist/index.min.js +1 -1
- package/es/core/graphic-utils.d.ts +2 -1
- package/es/core/graphic-utils.js +32 -0
- package/es/core/graphic-utils.js.map +1 -1
- package/es/interface/core.d.ts +2 -1
- package/es/interface/core.js.map +1 -1
- package/es/modules.d.ts +0 -1
- package/es/modules.js +3 -9
- package/es/modules.js.map +1 -1
- package/es/picker/pick-modules.js +4 -4
- package/es/picker/pick-modules.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.js +2 -2
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4439,6 +4439,123 @@
|
|
|
4439
4439
|
}
|
|
4440
4440
|
const canvasAllocate = new DefaultCanvasAllocate();
|
|
4441
4441
|
|
|
4442
|
+
const VWindow = Symbol.for('VWindow');
|
|
4443
|
+
const WindowHandlerContribution = Symbol.for('WindowHandlerContribution');
|
|
4444
|
+
exports.DefaultWindow = class DefaultWindow {
|
|
4445
|
+
get width() {
|
|
4446
|
+
if (this._handler) {
|
|
4447
|
+
const wh = this._handler.getWH();
|
|
4448
|
+
return (this._width = wh.width);
|
|
4449
|
+
}
|
|
4450
|
+
return this._width;
|
|
4451
|
+
}
|
|
4452
|
+
get height() {
|
|
4453
|
+
if (this._handler) {
|
|
4454
|
+
const wh = this._handler.getWH();
|
|
4455
|
+
return (this._height = wh.height);
|
|
4456
|
+
}
|
|
4457
|
+
return this._height;
|
|
4458
|
+
}
|
|
4459
|
+
get dpr() {
|
|
4460
|
+
return this._handler.getDpr();
|
|
4461
|
+
}
|
|
4462
|
+
constructor() {
|
|
4463
|
+
this.hooks = {
|
|
4464
|
+
onChange: new SyncHook(['x', 'y', 'width', 'height'])
|
|
4465
|
+
};
|
|
4466
|
+
this._uid = Generator.GenAutoIncrementId();
|
|
4467
|
+
this.global = application.global;
|
|
4468
|
+
this.postInit();
|
|
4469
|
+
}
|
|
4470
|
+
postInit() {
|
|
4471
|
+
this.global.hooks.onSetEnv.tap('window', () => {
|
|
4472
|
+
this.active();
|
|
4473
|
+
});
|
|
4474
|
+
this.active();
|
|
4475
|
+
}
|
|
4476
|
+
active() {
|
|
4477
|
+
const global = this.global;
|
|
4478
|
+
if (!global.env || this.actived) {
|
|
4479
|
+
return;
|
|
4480
|
+
}
|
|
4481
|
+
const handler = container.getNamed(WindowHandlerContribution, global.env);
|
|
4482
|
+
handler.configure(this, global);
|
|
4483
|
+
this.actived = true;
|
|
4484
|
+
}
|
|
4485
|
+
get style() {
|
|
4486
|
+
return this._handler.getStyle();
|
|
4487
|
+
}
|
|
4488
|
+
set style(style) {
|
|
4489
|
+
this._handler.setStyle(style);
|
|
4490
|
+
}
|
|
4491
|
+
create(params) {
|
|
4492
|
+
this._handler.createWindow(params);
|
|
4493
|
+
const windowWH = this._handler.getWH();
|
|
4494
|
+
this._width = windowWH.width;
|
|
4495
|
+
this._height = windowWH.height;
|
|
4496
|
+
this.title = this._handler.getTitle();
|
|
4497
|
+
this.resizable = true;
|
|
4498
|
+
}
|
|
4499
|
+
setWindowHandler(handler) {
|
|
4500
|
+
this._handler = handler;
|
|
4501
|
+
}
|
|
4502
|
+
setDpr(dpr) {
|
|
4503
|
+
return this._handler.setDpr(dpr);
|
|
4504
|
+
}
|
|
4505
|
+
resize(w, h) {
|
|
4506
|
+
return this._handler.resizeWindow(w, h);
|
|
4507
|
+
}
|
|
4508
|
+
configure() {
|
|
4509
|
+
throw new Error('暂不支持');
|
|
4510
|
+
}
|
|
4511
|
+
release() {
|
|
4512
|
+
return this._handler.releaseWindow();
|
|
4513
|
+
}
|
|
4514
|
+
getContext() {
|
|
4515
|
+
return this._handler.getContext();
|
|
4516
|
+
}
|
|
4517
|
+
getNativeHandler() {
|
|
4518
|
+
return this._handler.getNativeHandler();
|
|
4519
|
+
}
|
|
4520
|
+
getImageBuffer(type) {
|
|
4521
|
+
if (!this._handler.getImageBuffer) {
|
|
4522
|
+
return null;
|
|
4523
|
+
}
|
|
4524
|
+
return this._handler.getImageBuffer(type);
|
|
4525
|
+
}
|
|
4526
|
+
addEventListener(type, listener, options) {
|
|
4527
|
+
return this._handler.addEventListener(type, listener, options);
|
|
4528
|
+
}
|
|
4529
|
+
removeEventListener(type, listener, options) {
|
|
4530
|
+
return this._handler.removeEventListener(type, listener, options);
|
|
4531
|
+
}
|
|
4532
|
+
dispatchEvent(event) {
|
|
4533
|
+
return this._handler.dispatchEvent(event);
|
|
4534
|
+
}
|
|
4535
|
+
getBoundingClientRect() {
|
|
4536
|
+
return this._handler.getBoundingClientRect();
|
|
4537
|
+
}
|
|
4538
|
+
getContainer() {
|
|
4539
|
+
return this._handler.container;
|
|
4540
|
+
}
|
|
4541
|
+
clearViewBox(viewBox, color) {
|
|
4542
|
+
this._handler.clearViewBox(viewBox, color);
|
|
4543
|
+
}
|
|
4544
|
+
isVisible(bbox) {
|
|
4545
|
+
return this._handler.isVisible(bbox);
|
|
4546
|
+
}
|
|
4547
|
+
onVisibleChange(cb) {
|
|
4548
|
+
return this._handler.onVisibleChange(cb);
|
|
4549
|
+
}
|
|
4550
|
+
getTopLeft(baseWindow) {
|
|
4551
|
+
return this._handler.getTopLeft(baseWindow);
|
|
4552
|
+
}
|
|
4553
|
+
};
|
|
4554
|
+
exports.DefaultWindow = __decorate([
|
|
4555
|
+
injectable(),
|
|
4556
|
+
__metadata("design:paramtypes", [])
|
|
4557
|
+
], exports.DefaultWindow);
|
|
4558
|
+
|
|
4442
4559
|
exports.DefaultGraphicUtil = class DefaultGraphicUtil {
|
|
4443
4560
|
get canvas() {
|
|
4444
4561
|
this.tryInitCanvas();
|
|
@@ -4501,6 +4618,46 @@
|
|
|
4501
4618
|
fontSize: DefaultTextStyle.fontSize
|
|
4502
4619
|
}, getCanvasForMeasure: getCanvasForMeasure || (() => this.canvas), getTextBounds: undefined, specialCharSet: '-/: .,@%\'"~' + vutils.TextMeasure.ALPHABET_CHAR_SET + vutils.TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})), textSpec);
|
|
4503
4620
|
}
|
|
4621
|
+
drawGraphicToCanvas(graphic, stage, canvas) {
|
|
4622
|
+
if (!stage.defaultLayer) {
|
|
4623
|
+
return null;
|
|
4624
|
+
}
|
|
4625
|
+
const window = container.get(VWindow);
|
|
4626
|
+
const bounds = graphic.AABBBounds;
|
|
4627
|
+
const width = bounds.width();
|
|
4628
|
+
const height = bounds.height();
|
|
4629
|
+
window.create({
|
|
4630
|
+
width,
|
|
4631
|
+
height,
|
|
4632
|
+
canvas,
|
|
4633
|
+
dpr: stage.window.dpr,
|
|
4634
|
+
canvasControled: true,
|
|
4635
|
+
offscreen: true,
|
|
4636
|
+
title: ''
|
|
4637
|
+
});
|
|
4638
|
+
const x = -bounds.x1;
|
|
4639
|
+
const y = -bounds.y1;
|
|
4640
|
+
const disableCheckGraphicWidthOutRange = stage.params.optimize.disableCheckGraphicWidthOutRange;
|
|
4641
|
+
stage.params.optimize.disableCheckGraphicWidthOutRange = true;
|
|
4642
|
+
stage.defaultLayer.getNativeHandler().drawTo(window, [graphic], {
|
|
4643
|
+
x,
|
|
4644
|
+
y,
|
|
4645
|
+
width,
|
|
4646
|
+
height,
|
|
4647
|
+
stage,
|
|
4648
|
+
layer: stage.defaultLayer,
|
|
4649
|
+
renderService: stage.renderService,
|
|
4650
|
+
background: 'transparent',
|
|
4651
|
+
clear: true,
|
|
4652
|
+
updateBounds: false
|
|
4653
|
+
});
|
|
4654
|
+
stage.params.optimize.disableCheckGraphicWidthOutRange = disableCheckGraphicWidthOutRange;
|
|
4655
|
+
const c = window.getNativeHandler();
|
|
4656
|
+
if (c.nativeCanvas) {
|
|
4657
|
+
return c.nativeCanvas;
|
|
4658
|
+
}
|
|
4659
|
+
return null;
|
|
4660
|
+
}
|
|
4504
4661
|
};
|
|
4505
4662
|
exports.DefaultGraphicUtil = __decorate([
|
|
4506
4663
|
injectable(),
|
|
@@ -12643,123 +12800,6 @@
|
|
|
12643
12800
|
__metadata("design:paramtypes", [])
|
|
12644
12801
|
], exports.DefaultLayerService);
|
|
12645
12802
|
|
|
12646
|
-
const VWindow = Symbol.for('VWindow');
|
|
12647
|
-
const WindowHandlerContribution = Symbol.for('WindowHandlerContribution');
|
|
12648
|
-
exports.DefaultWindow = class DefaultWindow {
|
|
12649
|
-
get width() {
|
|
12650
|
-
if (this._handler) {
|
|
12651
|
-
const wh = this._handler.getWH();
|
|
12652
|
-
return (this._width = wh.width);
|
|
12653
|
-
}
|
|
12654
|
-
return this._width;
|
|
12655
|
-
}
|
|
12656
|
-
get height() {
|
|
12657
|
-
if (this._handler) {
|
|
12658
|
-
const wh = this._handler.getWH();
|
|
12659
|
-
return (this._height = wh.height);
|
|
12660
|
-
}
|
|
12661
|
-
return this._height;
|
|
12662
|
-
}
|
|
12663
|
-
get dpr() {
|
|
12664
|
-
return this._handler.getDpr();
|
|
12665
|
-
}
|
|
12666
|
-
constructor() {
|
|
12667
|
-
this.hooks = {
|
|
12668
|
-
onChange: new SyncHook(['x', 'y', 'width', 'height'])
|
|
12669
|
-
};
|
|
12670
|
-
this._uid = Generator.GenAutoIncrementId();
|
|
12671
|
-
this.global = application.global;
|
|
12672
|
-
this.postInit();
|
|
12673
|
-
}
|
|
12674
|
-
postInit() {
|
|
12675
|
-
this.global.hooks.onSetEnv.tap('window', () => {
|
|
12676
|
-
this.active();
|
|
12677
|
-
});
|
|
12678
|
-
this.active();
|
|
12679
|
-
}
|
|
12680
|
-
active() {
|
|
12681
|
-
const global = this.global;
|
|
12682
|
-
if (!global.env || this.actived) {
|
|
12683
|
-
return;
|
|
12684
|
-
}
|
|
12685
|
-
const handler = container.getNamed(WindowHandlerContribution, global.env);
|
|
12686
|
-
handler.configure(this, global);
|
|
12687
|
-
this.actived = true;
|
|
12688
|
-
}
|
|
12689
|
-
get style() {
|
|
12690
|
-
return this._handler.getStyle();
|
|
12691
|
-
}
|
|
12692
|
-
set style(style) {
|
|
12693
|
-
this._handler.setStyle(style);
|
|
12694
|
-
}
|
|
12695
|
-
create(params) {
|
|
12696
|
-
this._handler.createWindow(params);
|
|
12697
|
-
const windowWH = this._handler.getWH();
|
|
12698
|
-
this._width = windowWH.width;
|
|
12699
|
-
this._height = windowWH.height;
|
|
12700
|
-
this.title = this._handler.getTitle();
|
|
12701
|
-
this.resizable = true;
|
|
12702
|
-
}
|
|
12703
|
-
setWindowHandler(handler) {
|
|
12704
|
-
this._handler = handler;
|
|
12705
|
-
}
|
|
12706
|
-
setDpr(dpr) {
|
|
12707
|
-
return this._handler.setDpr(dpr);
|
|
12708
|
-
}
|
|
12709
|
-
resize(w, h) {
|
|
12710
|
-
return this._handler.resizeWindow(w, h);
|
|
12711
|
-
}
|
|
12712
|
-
configure() {
|
|
12713
|
-
throw new Error('暂不支持');
|
|
12714
|
-
}
|
|
12715
|
-
release() {
|
|
12716
|
-
return this._handler.releaseWindow();
|
|
12717
|
-
}
|
|
12718
|
-
getContext() {
|
|
12719
|
-
return this._handler.getContext();
|
|
12720
|
-
}
|
|
12721
|
-
getNativeHandler() {
|
|
12722
|
-
return this._handler.getNativeHandler();
|
|
12723
|
-
}
|
|
12724
|
-
getImageBuffer(type) {
|
|
12725
|
-
if (!this._handler.getImageBuffer) {
|
|
12726
|
-
return null;
|
|
12727
|
-
}
|
|
12728
|
-
return this._handler.getImageBuffer(type);
|
|
12729
|
-
}
|
|
12730
|
-
addEventListener(type, listener, options) {
|
|
12731
|
-
return this._handler.addEventListener(type, listener, options);
|
|
12732
|
-
}
|
|
12733
|
-
removeEventListener(type, listener, options) {
|
|
12734
|
-
return this._handler.removeEventListener(type, listener, options);
|
|
12735
|
-
}
|
|
12736
|
-
dispatchEvent(event) {
|
|
12737
|
-
return this._handler.dispatchEvent(event);
|
|
12738
|
-
}
|
|
12739
|
-
getBoundingClientRect() {
|
|
12740
|
-
return this._handler.getBoundingClientRect();
|
|
12741
|
-
}
|
|
12742
|
-
getContainer() {
|
|
12743
|
-
return this._handler.container;
|
|
12744
|
-
}
|
|
12745
|
-
clearViewBox(viewBox, color) {
|
|
12746
|
-
this._handler.clearViewBox(viewBox, color);
|
|
12747
|
-
}
|
|
12748
|
-
isVisible(bbox) {
|
|
12749
|
-
return this._handler.isVisible(bbox);
|
|
12750
|
-
}
|
|
12751
|
-
onVisibleChange(cb) {
|
|
12752
|
-
return this._handler.onVisibleChange(cb);
|
|
12753
|
-
}
|
|
12754
|
-
getTopLeft(baseWindow) {
|
|
12755
|
-
return this._handler.getTopLeft(baseWindow);
|
|
12756
|
-
}
|
|
12757
|
-
};
|
|
12758
|
-
exports.DefaultWindow = __decorate([
|
|
12759
|
-
injectable(),
|
|
12760
|
-
__metadata("design:paramtypes", [])
|
|
12761
|
-
], exports.DefaultWindow);
|
|
12762
|
-
|
|
12763
12803
|
var coreModule = new ContainerModule(bind => {
|
|
12764
12804
|
bind(VGlobal).to(exports.DefaultGlobal).inSingletonScope();
|
|
12765
12805
|
bind(VWindow).to(exports.DefaultWindow);
|
|
@@ -22049,11 +22089,8 @@
|
|
|
22049
22089
|
injectable()
|
|
22050
22090
|
], exports.Canvas3DPickItemInterceptor);
|
|
22051
22091
|
|
|
22052
|
-
var pickModule = new ContainerModule(
|
|
22053
|
-
|
|
22054
|
-
bind(GlobalPickerService).toSelf();
|
|
22055
|
-
bind(PickerService).toService(GlobalPickerService);
|
|
22056
|
-
}
|
|
22092
|
+
var pickModule = new ContainerModule(bind => {
|
|
22093
|
+
bind(PickerService).toService(GlobalPickerService);
|
|
22057
22094
|
bind(exports.Canvas3DPickItemInterceptor).toSelf().inSingletonScope();
|
|
22058
22095
|
bind(PickItemInterceptor).toService(exports.Canvas3DPickItemInterceptor);
|
|
22059
22096
|
bind(exports.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope();
|
|
@@ -22940,8 +22977,8 @@
|
|
|
22940
22977
|
context.inuse = true;
|
|
22941
22978
|
context.clearMatrix();
|
|
22942
22979
|
context.setTransformForCurrent(true);
|
|
22943
|
-
const drawInArea = dirtyBounds.width() * context.dpr
|
|
22944
|
-
dirtyBounds.height() * context.dpr
|
|
22980
|
+
const drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width ||
|
|
22981
|
+
dirtyBounds.height() * context.dpr < context.canvas.height;
|
|
22945
22982
|
context.save();
|
|
22946
22983
|
context.translate(x, y, true);
|
|
22947
22984
|
if (drawInArea) {
|
|
@@ -22961,7 +22998,9 @@
|
|
|
22961
22998
|
return ((_a = a.attribute.zIndex) !== null && _a !== void 0 ? _a : DefaultAttribute.zIndex) - ((_b = b.attribute.zIndex) !== null && _b !== void 0 ? _b : DefaultAttribute.zIndex);
|
|
22962
22999
|
})
|
|
22963
23000
|
.forEach(group => {
|
|
22964
|
-
|
|
23001
|
+
group.isContainer
|
|
23002
|
+
? this.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0))
|
|
23003
|
+
: this.renderItem(group, drawContext);
|
|
22965
23004
|
});
|
|
22966
23005
|
context.restore();
|
|
22967
23006
|
context.restore();
|
|
@@ -23680,21 +23719,13 @@
|
|
|
23680
23719
|
container.load(renderModule);
|
|
23681
23720
|
}
|
|
23682
23721
|
|
|
23683
|
-
|
|
23684
|
-
|
|
23685
|
-
|
|
23686
|
-
|
|
23687
|
-
|
|
23688
|
-
|
|
23689
|
-
|
|
23690
|
-
container.load(graphicModule);
|
|
23691
|
-
container.load(renderModule$1);
|
|
23692
|
-
container.load(pickModule);
|
|
23693
|
-
container.load(pluginModule);
|
|
23694
|
-
load$1(container);
|
|
23695
|
-
load(container);
|
|
23696
|
-
}
|
|
23697
|
-
preLoadAllModule();
|
|
23722
|
+
container.load(coreModule);
|
|
23723
|
+
container.load(graphicModule);
|
|
23724
|
+
container.load(renderModule$1);
|
|
23725
|
+
container.load(pickModule);
|
|
23726
|
+
container.load(pluginModule);
|
|
23727
|
+
load$1(container);
|
|
23728
|
+
load(container);
|
|
23698
23729
|
const vglobal = container.get(VGlobal);
|
|
23699
23730
|
application.global = vglobal;
|
|
23700
23731
|
const graphicUtil = container.get(GraphicUtil);
|
|
@@ -27546,7 +27577,6 @@
|
|
|
27546
27577
|
exports.pointsEqual = pointsEqual;
|
|
27547
27578
|
exports.pointsInterpolation = pointsInterpolation;
|
|
27548
27579
|
exports.polygonModule = polygonModule;
|
|
27549
|
-
exports.preLoadAllModule = preLoadAllModule;
|
|
27550
27580
|
exports.pyramid3dModule = pyramid3dModule;
|
|
27551
27581
|
exports.rafBasedSto = rafBasedSto;
|
|
27552
27582
|
exports.rect3dModule = rect3dModule;
|