@antv/g-lite 2.0.8 → 2.0.9
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/display-objects/HTML.d.ts +4 -4
- package/dist/index.esm.js +44 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +44 -27
- 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/services/aabb/HTMLUpdater.d.ts +10 -0
- package/dist/services/aabb/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '../dom';
|
|
2
|
-
import { AABB
|
|
2
|
+
import { AABB } from '../shapes';
|
|
3
3
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
4
4
|
import { DisplayObject } from './DisplayObject';
|
|
5
5
|
export interface HTMLStyleProps extends BaseStyleProps {
|
|
@@ -32,9 +32,9 @@ export declare class HTML extends DisplayObject<HTMLStyleProps, ParsedHTMLStyleP
|
|
|
32
32
|
/**
|
|
33
33
|
* override with $el.getBoundingClientRect
|
|
34
34
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect
|
|
35
|
+
*
|
|
36
|
+
* ! The calculation logic of the html element should be consistent with that of the canvas element
|
|
35
37
|
*/
|
|
36
|
-
|
|
37
|
-
getClientRects(): Rectangle[];
|
|
38
|
-
getBounds(): AABB;
|
|
38
|
+
getClientRects(): import("../shapes").Rectangle[];
|
|
39
39
|
getLocalBounds(): AABB;
|
|
40
40
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -8341,6 +8341,21 @@ var GroupUpdater = /** @class */ (function () {
|
|
|
8341
8341
|
return GroupUpdater;
|
|
8342
8342
|
}());
|
|
8343
8343
|
|
|
8344
|
+
var HTMLUpdater = /** @class */ (function () {
|
|
8345
|
+
function HTMLUpdater() {
|
|
8346
|
+
}
|
|
8347
|
+
HTMLUpdater.prototype.update = function (parsedStyle, object) {
|
|
8348
|
+
var _a = parsedStyle.x, x = _a === void 0 ? 0 : _a, _b = parsedStyle.y, y = _b === void 0 ? 0 : _b, _c = parsedStyle.width, width = _c === void 0 ? 0 : _c, _d = parsedStyle.height, height = _d === void 0 ? 0 : _d;
|
|
8349
|
+
return {
|
|
8350
|
+
cx: x + width / 2,
|
|
8351
|
+
cy: y + height / 2,
|
|
8352
|
+
hwidth: width / 2,
|
|
8353
|
+
hheight: height / 2,
|
|
8354
|
+
};
|
|
8355
|
+
};
|
|
8356
|
+
return HTMLUpdater;
|
|
8357
|
+
}());
|
|
8358
|
+
|
|
8344
8359
|
function isFederatedEvent(value) {
|
|
8345
8360
|
return !!value.type;
|
|
8346
8361
|
}
|
|
@@ -11655,7 +11670,7 @@ var geometryUpdaterFactory = (function () {
|
|
|
11655
11670
|
_a[Shape.POLYLINE] = polylineUpdater,
|
|
11656
11671
|
_a[Shape.POLYGON] = polylineUpdater,
|
|
11657
11672
|
_a[Shape.PATH] = new PathUpdater(),
|
|
11658
|
-
_a[Shape.HTML] =
|
|
11673
|
+
_a[Shape.HTML] = new HTMLUpdater(),
|
|
11659
11674
|
_a[Shape.MESH] = null,
|
|
11660
11675
|
_a;
|
|
11661
11676
|
})();
|
|
@@ -13168,35 +13183,36 @@ var HTML = /** @class */ (function (_super) {
|
|
|
13168
13183
|
/**
|
|
13169
13184
|
* override with $el.getBoundingClientRect
|
|
13170
13185
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
|
|
13177
|
-
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
return new Rectangle(x, y, width, height);
|
|
13183
|
-
}
|
|
13184
|
-
};
|
|
13186
|
+
*
|
|
13187
|
+
* ! The calculation logic of the html element should be consistent with that of the canvas element
|
|
13188
|
+
*/
|
|
13189
|
+
// getBoundingClientRect(): Rectangle {
|
|
13190
|
+
// if (this.parsedStyle.$el) {
|
|
13191
|
+
// return this.parsedStyle.$el.getBoundingClientRect();
|
|
13192
|
+
// } else {
|
|
13193
|
+
// const { x, y, width, height } = this.parsedStyle;
|
|
13194
|
+
// return new Rectangle(x, y, width, height);
|
|
13195
|
+
// }
|
|
13196
|
+
// }
|
|
13185
13197
|
HTML.prototype.getClientRects = function () {
|
|
13186
13198
|
return [this.getBoundingClientRect()];
|
|
13187
13199
|
};
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13192
|
-
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
+
// getBounds() {
|
|
13201
|
+
// const clientRect = this.getBoundingClientRect();
|
|
13202
|
+
// // calc context's offset
|
|
13203
|
+
// // @ts-ignore
|
|
13204
|
+
// const canvasRect = this.ownerDocument?.defaultView
|
|
13205
|
+
// ?.getContextService()
|
|
13206
|
+
// .getBoundingClientRect();
|
|
13207
|
+
// const aabb = new AABB();
|
|
13208
|
+
// const minX = clientRect.left - (canvasRect?.left || 0);
|
|
13209
|
+
// const minY = clientRect.top - (canvasRect?.top || 0);
|
|
13210
|
+
// aabb.setMinMax(
|
|
13211
|
+
// [minX, minY, 0],
|
|
13212
|
+
// [minX + clientRect.width, minY + clientRect.height, 0],
|
|
13213
|
+
// );
|
|
13214
|
+
// return aabb;
|
|
13215
|
+
// }
|
|
13200
13216
|
HTML.prototype.getLocalBounds = function () {
|
|
13201
13217
|
if (this.parentNode) {
|
|
13202
13218
|
var parentInvert = mat4.invert(mat4.create(), this.parentNode.getWorldTransform());
|
|
@@ -15442,5 +15458,5 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15442
15458
|
return Canvas;
|
|
15443
15459
|
}(EventTarget));
|
|
15444
15460
|
|
|
15445
|
-
export { AABB, AbstractRenderer, AbstractRendererPlugin, BUILT_IN_PROPERTIES, CSS, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSStyleValue, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasEvent, Circle, CircleUpdater, ClipSpaceNearZ, CustomElement, CustomElementRegistry, CustomEvent, DefaultSceneGraphSelector, DefaultSceneGraphService, DisplayObject, Document, ERROR_MSG_METHOD_NOT_IMPLEMENTED, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, Frustum, GradientType, Group, GroupUpdater, HTML, Image, Line, LineUpdater, Mask, MutationEvent, Node, OffscreenCanvasCreator, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertySyntax, RBush, Rect, RectUpdater, Rectangle, RenderReason, RenderingService, Shape, SortReason, Strategy, Text, TextService, TextUpdater, UnitType, computeLinearGradient, computeRadialGradient, convertToPath, createVec3, decompose, definedProps, deg2rad, deg2turn, findClosestClipPathTarget, fromRotationTranslationScale, getAngle, getEuler, getOrCalculatePathTotalLength, grad2deg, isBrowser, isCSSGradientValue, isCSSRGB, isCanvas, isDisplayObject, isFederatedEvent, isFillOrStrokeAffected, isPattern, mergeColors, parseColor, parseLength, parsePath, parseTransform, parsedTransformToMat4, propertyMetadataCache, rad2deg, resetEntityCounter, runtime, setDOMSize, translatePathToString, turn2deg };
|
|
15461
|
+
export { AABB, AbstractRenderer, AbstractRendererPlugin, BUILT_IN_PROPERTIES, CSS, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSStyleValue, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasEvent, Circle, CircleUpdater, ClipSpaceNearZ, CustomElement, CustomElementRegistry, CustomEvent, DefaultSceneGraphSelector, DefaultSceneGraphService, DisplayObject, Document, ERROR_MSG_METHOD_NOT_IMPLEMENTED, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, Frustum, GradientType, Group, GroupUpdater, HTML, HTMLUpdater, Image, Line, LineUpdater, Mask, MutationEvent, Node, OffscreenCanvasCreator, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertySyntax, RBush, Rect, RectUpdater, Rectangle, RenderReason, RenderingService, Shape, SortReason, Strategy, Text, TextService, TextUpdater, UnitType, computeLinearGradient, computeRadialGradient, convertToPath, createVec3, decompose, definedProps, deg2rad, deg2turn, findClosestClipPathTarget, fromRotationTranslationScale, getAngle, getEuler, getOrCalculatePathTotalLength, grad2deg, isBrowser, isCSSGradientValue, isCSSRGB, isCanvas, isDisplayObject, isFederatedEvent, isFillOrStrokeAffected, isPattern, mergeColors, parseColor, parseLength, parsePath, parseTransform, parsedTransformToMat4, propertyMetadataCache, rad2deg, resetEntityCounter, runtime, setDOMSize, translatePathToString, turn2deg };
|
|
15446
15462
|
//# sourceMappingURL=index.esm.js.map
|