gis-common 5.1.35 → 5.1.36
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/gis-common.es.js +19 -0
- package/dist/gis-common.umd.js +1 -1
- package/dist/index.d.ts +19 -2
- package/package.json +1 -1
package/dist/gis-common.es.js
CHANGED
|
@@ -3424,6 +3424,14 @@ class CanvasDrawer {
|
|
|
3424
3424
|
this.ctx.stroke();
|
|
3425
3425
|
}
|
|
3426
3426
|
}
|
|
3427
|
+
/**
|
|
3428
|
+
* 绘制图像
|
|
3429
|
+
*
|
|
3430
|
+
* @param coordinate 绘制位置的坐标
|
|
3431
|
+
* @param image 要绘制的图像(ImageBitmap)
|
|
3432
|
+
* @param options 绘制选项,包括宽度、高度和旋转角度
|
|
3433
|
+
* @throws 当画布上下文不存在时抛出错误
|
|
3434
|
+
*/
|
|
3427
3435
|
drawImage({ x, y }, image, options = {}) {
|
|
3428
3436
|
const width = options.width || image.width;
|
|
3429
3437
|
const height = options.height || image.height;
|
|
@@ -3437,12 +3445,23 @@ class CanvasDrawer {
|
|
|
3437
3445
|
this.ctx.drawImage(image, -width / 2, -height / 2, width, height);
|
|
3438
3446
|
this.ctx.restore();
|
|
3439
3447
|
}
|
|
3448
|
+
/**
|
|
3449
|
+
* 绘制文本
|
|
3450
|
+
*
|
|
3451
|
+
* @param coordinate 绘制位置的坐标
|
|
3452
|
+
* @param text 要绘制的文本内容
|
|
3453
|
+
* @param options 绘制选项,包括字体和颜色
|
|
3454
|
+
* @throws 当画布上下文不存在时抛出错误
|
|
3455
|
+
*/
|
|
3440
3456
|
drawText({ x, y }, text, options) {
|
|
3441
3457
|
this.ctx.font = options.font || "10px sans-serif";
|
|
3442
3458
|
this.ctx.strokeStyle = options.color || "#000";
|
|
3443
3459
|
this.ctx.lineWidth = 2;
|
|
3444
3460
|
this.ctx.strokeText(text, x, y);
|
|
3445
3461
|
}
|
|
3462
|
+
destroy() {
|
|
3463
|
+
this.canvas.remove();
|
|
3464
|
+
}
|
|
3446
3465
|
static createCanvas(width = 1, height = 1) {
|
|
3447
3466
|
const canvas = document.createElement("canvas");
|
|
3448
3467
|
if (width) {
|