@antv/g-lite 2.0.6 → 2.0.8
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/dist/Canvas.d.ts +4 -0
- package/dist/dom/interfaces.d.ts +1 -0
- package/dist/index.esm.js +45 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +45 -6
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/shapes/Rectangle.d.ts +16 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1445,6 +1445,39 @@ var Rectangle = /** @class */ (function () {
|
|
|
1445
1445
|
this.top = y;
|
|
1446
1446
|
this.bottom = y + height;
|
|
1447
1447
|
}
|
|
1448
|
+
/**
|
|
1449
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRect/fromRect_static
|
|
1450
|
+
*/
|
|
1451
|
+
Rectangle.fromRect = function (rect) {
|
|
1452
|
+
return new Rectangle(rect.x, rect.y, rect.width, rect.height);
|
|
1453
|
+
};
|
|
1454
|
+
/**
|
|
1455
|
+
* will return a new rect instance
|
|
1456
|
+
*/
|
|
1457
|
+
Rectangle.applyTransform = function (rect, matrix) {
|
|
1458
|
+
var topLeft = glMatrix.vec4.fromValues(rect.x, rect.y, 0, 1);
|
|
1459
|
+
var topRight = glMatrix.vec4.fromValues(rect.x + rect.width, rect.y, 0, 1);
|
|
1460
|
+
var bottomLeft = glMatrix.vec4.fromValues(rect.x, rect.y + rect.height, 0, 1);
|
|
1461
|
+
var bottomRight = glMatrix.vec4.fromValues(rect.x + rect.width, rect.y + rect.height, 0, 1);
|
|
1462
|
+
var transformedTopLeft = glMatrix.vec4.create();
|
|
1463
|
+
var transformedTopRight = glMatrix.vec4.create();
|
|
1464
|
+
var transformedBottomLeft = glMatrix.vec4.create();
|
|
1465
|
+
var transformedBottomRight = glMatrix.vec4.create();
|
|
1466
|
+
glMatrix.vec4.transformMat4(transformedTopLeft, topLeft, matrix);
|
|
1467
|
+
glMatrix.vec4.transformMat4(transformedTopRight, topRight, matrix);
|
|
1468
|
+
glMatrix.vec4.transformMat4(transformedBottomLeft, bottomLeft, matrix);
|
|
1469
|
+
glMatrix.vec4.transformMat4(transformedBottomRight, bottomRight, matrix);
|
|
1470
|
+
var minX = Math.min(transformedTopLeft[0], transformedTopRight[0], transformedBottomLeft[0], transformedBottomRight[0]);
|
|
1471
|
+
var minY = Math.min(transformedTopLeft[1], transformedTopRight[1], transformedBottomLeft[1], transformedBottomRight[1]);
|
|
1472
|
+
var maxX = Math.max(transformedTopLeft[0], transformedTopRight[0], transformedBottomLeft[0], transformedBottomRight[0]);
|
|
1473
|
+
var maxY = Math.max(transformedTopLeft[1], transformedTopRight[1], transformedBottomLeft[1], transformedBottomRight[1]);
|
|
1474
|
+
return Rectangle.fromRect({
|
|
1475
|
+
x: minX,
|
|
1476
|
+
y: minY,
|
|
1477
|
+
width: maxX - minX,
|
|
1478
|
+
height: maxY - minY,
|
|
1479
|
+
});
|
|
1480
|
+
};
|
|
1448
1481
|
Rectangle.prototype.toJSON = function () { };
|
|
1449
1482
|
return Rectangle;
|
|
1450
1483
|
}());
|
|
@@ -9284,9 +9317,10 @@ var EventService = /** @class */ (function () {
|
|
|
9284
9317
|
timeStamp: now,
|
|
9285
9318
|
};
|
|
9286
9319
|
}
|
|
9320
|
+
var canvas = _this.context.renderingContext.root.ownerDocument.defaultView;
|
|
9287
9321
|
var clickHistory = trackingData.clicksByButton[from.button];
|
|
9288
9322
|
if (clickHistory.target === clickEvent.target &&
|
|
9289
|
-
now - clickHistory.timeStamp <
|
|
9323
|
+
now - clickHistory.timeStamp < canvas.dblClickSpeed) {
|
|
9290
9324
|
++clickHistory.clickCount;
|
|
9291
9325
|
}
|
|
9292
9326
|
else {
|
|
@@ -13158,7 +13192,11 @@ var HTML = /** @class */ (function (_super) {
|
|
|
13158
13192
|
*/
|
|
13159
13193
|
HTML.prototype.getBoundingClientRect = function () {
|
|
13160
13194
|
if (this.parsedStyle.$el) {
|
|
13161
|
-
|
|
13195
|
+
var cameraMatrix = this.ownerDocument.defaultView
|
|
13196
|
+
.getCamera()
|
|
13197
|
+
.getOrthoMatrix();
|
|
13198
|
+
var bBox = this.parsedStyle.$el.getBoundingClientRect();
|
|
13199
|
+
return Rectangle.applyTransform(bBox, glMatrix.mat4.invert(glMatrix.mat4.create(), cameraMatrix));
|
|
13162
13200
|
}
|
|
13163
13201
|
else {
|
|
13164
13202
|
var _a = this.parsedStyle, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
|
@@ -14958,7 +14996,7 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
14958
14996
|
_this.document.defaultView = _this;
|
|
14959
14997
|
// create registry of custom elements
|
|
14960
14998
|
_this.customElements = new CustomElementRegistry();
|
|
14961
|
-
var container = config.container, canvas = config.canvas, offscreenCanvas = config.offscreenCanvas, width = config.width, height = config.height, devicePixelRatio = config.devicePixelRatio, renderer = config.renderer, background = config.background, cursor = config.cursor, document = config.document, requestAnimationFrame = config.requestAnimationFrame, cancelAnimationFrame = config.cancelAnimationFrame, createImage = config.createImage, supportsPointerEvents = config.supportsPointerEvents, supportsTouchEvents = config.supportsTouchEvents, supportsCSSTransform = config.supportsCSSTransform, supportsMutipleCanvasesInOneContainer = config.supportsMutipleCanvasesInOneContainer, useNativeClickEvent = config.useNativeClickEvent, alwaysTriggerPointerEventOnCanvas = config.alwaysTriggerPointerEventOnCanvas, isTouchEvent = config.isTouchEvent, isMouseEvent = config.isMouseEvent;
|
|
14999
|
+
var container = config.container, canvas = config.canvas, offscreenCanvas = config.offscreenCanvas, width = config.width, height = config.height, devicePixelRatio = config.devicePixelRatio, renderer = config.renderer, background = config.background, cursor = config.cursor, document = config.document, requestAnimationFrame = config.requestAnimationFrame, cancelAnimationFrame = config.cancelAnimationFrame, createImage = config.createImage, supportsPointerEvents = config.supportsPointerEvents, supportsTouchEvents = config.supportsTouchEvents, supportsCSSTransform = config.supportsCSSTransform, supportsMutipleCanvasesInOneContainer = config.supportsMutipleCanvasesInOneContainer, useNativeClickEvent = config.useNativeClickEvent, alwaysTriggerPointerEventOnCanvas = config.alwaysTriggerPointerEventOnCanvas, isTouchEvent = config.isTouchEvent, isMouseEvent = config.isMouseEvent, dblClickSpeed = config.dblClickSpeed;
|
|
14962
15000
|
if (!supportsMutipleCanvasesInOneContainer) {
|
|
14963
15001
|
cleanExistedCanvas(container, _this);
|
|
14964
15002
|
}
|
|
@@ -15006,6 +15044,7 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15006
15044
|
(!_this.supportsPointerEvents ||
|
|
15007
15045
|
!(event instanceof runtime.globalThis.PointerEvent)));
|
|
15008
15046
|
});
|
|
15047
|
+
_this.dblClickSpeed = dblClickSpeed !== null && dblClickSpeed !== void 0 ? dblClickSpeed : 200;
|
|
15009
15048
|
_this.initRenderingContext({
|
|
15010
15049
|
container: container,
|
|
15011
15050
|
canvas: canvas,
|
|
@@ -15285,13 +15324,13 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15285
15324
|
else {
|
|
15286
15325
|
_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.READY));
|
|
15287
15326
|
}
|
|
15288
|
-
if (_this.readyPromise) {
|
|
15289
|
-
_this.resolveReadyPromise();
|
|
15290
|
-
}
|
|
15291
15327
|
}
|
|
15292
15328
|
else {
|
|
15293
15329
|
_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.RENDERER_CHANGED));
|
|
15294
15330
|
}
|
|
15331
|
+
if (_this.readyPromise) {
|
|
15332
|
+
_this.resolveReadyPromise();
|
|
15333
|
+
}
|
|
15295
15334
|
if (!firstContentfullPaint) {
|
|
15296
15335
|
_this.getRoot().forEach(function (node) {
|
|
15297
15336
|
var renderable = node.renderable;
|