@meta2d/core 1.0.9 → 1.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meta2d/core",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -3922,6 +3922,12 @@ var Canvas = /** @class */ (function () {
3922
3922
  var img_1 = new Image();
3923
3923
  img_1.crossOrigin = 'anonymous';
3924
3924
  img_1.src = pen.image;
3925
+ if (this.store.options.cdn &&
3926
+ !(pen.image.startsWith('http') ||
3927
+ pen.image.startsWith('//') ||
3928
+ pen.image.startsWith('data:image'))) {
3929
+ img_1.src = this.store.options.cdn + pen.image;
3930
+ }
3925
3931
  img_1.onload = function () {
3926
3932
  pen.calculative.img = img_1;
3927
3933
  pen.calculative.imgNaturalWidth =
@@ -3947,6 +3953,12 @@ var Canvas = /** @class */ (function () {
3947
3953
  var img_2 = new Image();
3948
3954
  img_2.crossOrigin = 'anonymous';
3949
3955
  img_2.src = pen.backgroundImage;
3956
+ if (this.store.options.cdn &&
3957
+ !(pen.backgroundImage.startsWith('http') ||
3958
+ pen.backgroundImage.startsWith('//') ||
3959
+ pen.backgroundImage.startsWith('data:image'))) {
3960
+ img_2.src = this.store.options.cdn + pen.backgroundImage;
3961
+ }
3950
3962
  img_2.onload = function () {
3951
3963
  pen.calculative.backgroundImg = img_2;
3952
3964
  globalStore.htmlElements[pen.backgroundImage] = img_2;
@@ -3967,6 +3979,12 @@ var Canvas = /** @class */ (function () {
3967
3979
  var img_3 = new Image();
3968
3980
  img_3.crossOrigin = 'anonymous';
3969
3981
  img_3.src = pen.strokeImage;
3982
+ if (this.store.options.cdn &&
3983
+ !(pen.strokeImage.startsWith('http') ||
3984
+ pen.strokeImage.startsWith('//') ||
3985
+ pen.strokeImage.startsWith('data:image'))) {
3986
+ img_3.src = this.store.options.cdn + pen.strokeImage;
3987
+ }
3970
3988
  img_3.onload = function () {
3971
3989
  pen.calculative.strokeImg = img_3;
3972
3990
  globalStore.htmlElements[pen.strokeImage] = img_3;
@@ -4243,10 +4261,6 @@ var Canvas = /** @class */ (function () {
4243
4261
  var x = p2.x - p1.x;
4244
4262
  var y = p2.y - p1.y;
4245
4263
  var rect = deepClone(this.initActiveRect);
4246
- if (e.shiftKey ||
4247
- (this.initPens.length == 1 && this.initPens[0].ratio)) {
4248
- x = (rect.width / rect.height) * y;
4249
- }
4250
4264
  // 得到最准确的 rect 即 resize 后的
4251
4265
  resizeRect(rect, x, y, this.resizeIndex);
4252
4266
  calcCenter(rect);
@@ -4272,7 +4286,8 @@ var Canvas = /** @class */ (function () {
4272
4286
  var offsetY = y - this.lastOffsetY;
4273
4287
  this.lastOffsetX = x;
4274
4288
  this.lastOffsetY = y;
4275
- if (e.ctrlKey) {
4289
+ if (e.ctrlKey ||
4290
+ (this.initPens.length === 1 && this.initPens[0].ratio)) {
4276
4291
  // 1,3 是右上角和左上角的点,此时的 offsetY 符号与 offsetX 是相反的
4277
4292
  var sign = [1, 3].includes(this.resizeIndex) ? -1 : 1;
4278
4293
  offsetY = (sign * (offsetX * h)) / w;