Comparing version 1.24.1 to 1.24.2
@@ -79,2 +79,13 @@ import SerializableCommand from '../commands/SerializableCommand'; | ||
private recomputeBBox; | ||
/** | ||
* Renders a TextComponent or a TextComponent child onto a `canvas`. | ||
* | ||
* `visibleRect` can be provided as a performance optimization. If not the top-level | ||
* text node, `baseTransform` (specifies the transformation of the parent text component | ||
* in canvas space) should also be provided. | ||
* | ||
* Note that passing a `baseTransform` is preferable to transforming `visibleRect`. At high | ||
* zoom levels, transforming `visibleRect` by the inverse of the parent transform can lead to | ||
* inaccuracy due to precision loss. | ||
*/ | ||
private renderInternal; | ||
@@ -81,0 +92,0 @@ render(canvas: AbstractRenderer, visibleRect?: Rect2): void; |
@@ -157,7 +157,18 @@ "use strict"; | ||
} | ||
renderInternal(canvas, visibleRect) { | ||
/** | ||
* Renders a TextComponent or a TextComponent child onto a `canvas`. | ||
* | ||
* `visibleRect` can be provided as a performance optimization. If not the top-level | ||
* text node, `baseTransform` (specifies the transformation of the parent text component | ||
* in canvas space) should also be provided. | ||
* | ||
* Note that passing a `baseTransform` is preferable to transforming `visibleRect`. At high | ||
* zoom levels, transforming `visibleRect` by the inverse of the parent transform can lead to | ||
* inaccuracy due to precision loss. | ||
*/ | ||
renderInternal(canvas, visibleRect, baseTransform = math_1.Mat33.identity) { | ||
const cursor = new TextComponent.TextCursor(this.transform, this.style); | ||
for (const textObject of this.textObjects) { | ||
const { transform, bbox } = cursor.update(textObject); | ||
if (visibleRect && !visibleRect.intersects(bbox)) { | ||
if (visibleRect && !visibleRect.intersects(bbox.transformedBoundingBox(baseTransform))) { | ||
continue; | ||
@@ -170,3 +181,3 @@ } | ||
canvas.pushTransform(transform); | ||
textObject.renderInternal(canvas, visibleRect?.transformedBoundingBox(transform.inverse())); | ||
textObject.renderInternal(canvas, visibleRect, baseTransform.rightMul(transform)); | ||
canvas.popTransform(); | ||
@@ -173,0 +184,0 @@ } |
@@ -9,3 +9,3 @@ "use strict"; | ||
exports.default = { | ||
number: '1.24.1', | ||
number: '1.24.2', | ||
}; |
@@ -79,2 +79,13 @@ import SerializableCommand from '../commands/SerializableCommand'; | ||
private recomputeBBox; | ||
/** | ||
* Renders a TextComponent or a TextComponent child onto a `canvas`. | ||
* | ||
* `visibleRect` can be provided as a performance optimization. If not the top-level | ||
* text node, `baseTransform` (specifies the transformation of the parent text component | ||
* in canvas space) should also be provided. | ||
* | ||
* Note that passing a `baseTransform` is preferable to transforming `visibleRect`. At high | ||
* zoom levels, transforming `visibleRect` by the inverse of the parent transform can lead to | ||
* inaccuracy due to precision loss. | ||
*/ | ||
private renderInternal; | ||
@@ -81,0 +92,0 @@ render(canvas: AbstractRenderer, visibleRect?: Rect2): void; |
{ | ||
"name": "js-draw", | ||
"version": "1.24.1", | ||
"version": "1.24.2", | ||
"description": "Draw pictures using a pen, touchscreen, or mouse! JS-draw is a drawing library for JavaScript and TypeScript. ", | ||
@@ -67,7 +67,7 @@ "types": "./dist/mjs/lib.d.ts", | ||
"dependencies": { | ||
"@js-draw/math": "^1.24.1", | ||
"@js-draw/math": "^1.24.2", | ||
"@melloware/coloris": "0.22.0" | ||
}, | ||
"devDependencies": { | ||
"@js-draw/build-tool": "^1.24.1", | ||
"@js-draw/build-tool": "^1.24.2", | ||
"@types/jest": "29.5.5", | ||
@@ -90,3 +90,3 @@ "@types/jsdom": "21.1.3" | ||
], | ||
"gitHead": "ef847374748e32d6d96d993a2236a99d9109a32c" | ||
"gitHead": "32c8db56fc8996c8d485118d1ee37077428344a3" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4462876
63100
Updated@js-draw/math@^1.24.2