@meta2d/core 1.0.97 → 1.0.98

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/src/pen/render.js CHANGED
@@ -637,13 +637,13 @@ function linearGradient(ctx, worldRect, fromColor, toColor, angle) {
637
637
  * @param pen 画笔
638
638
  */
639
639
  function getImagePosition(pen) {
640
- const { worldIconRect: rect, iconWidth, iconHeight, imgNaturalWidth, imgNaturalHeight, } = pen.calculative;
640
+ const { worldIconRect: rect, iconWidth, iconHeight, imgNaturalWidth, imgNaturalHeight, worldRect } = pen.calculative;
641
641
  if (!rect) {
642
642
  return {
643
- x: 0,
644
- y: 0,
645
- width: imgNaturalWidth || pen.calculative.img.naturalWidth,
646
- height: imgNaturalHeight || pen.calculative.img.naturalHeight,
643
+ x: worldRect.x,
644
+ y: worldRect.y,
645
+ width: worldRect.width || imgNaturalWidth || pen.calculative.img.naturalWidth,
646
+ height: worldRect.width || imgNaturalHeight || pen.calculative.img.naturalHeight,
647
647
  };
648
648
  }
649
649
  ;