File tree Expand file tree Collapse file tree 4 files changed +19
-1
lines changed
test/integration/scratch-tests Expand file tree Collapse file tree 4 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,15 @@ class BitmapSkin extends Skin {
59
59
return this . _texture ;
60
60
}
61
61
62
+ /**
63
+ * Get the bounds of the drawable for determining its fenced position.
64
+ * @param {Array<number> } drawable - The Drawable instance this skin is using.
65
+ * @return {!Rectangle } The drawable's bounds. For compatibility with Scratch 2, we always use getAABB for bitmaps.
66
+ */
67
+ getFenceBounds ( drawable ) {
68
+ return drawable . getAABB ( ) ;
69
+ }
70
+
62
71
/**
63
72
* Set the contents of this skin to a snapshot of the provided bitmap data.
64
73
* @param {ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement } bitmapData - new contents for this skin.
Original file line number Diff line number Diff line change @@ -1316,7 +1316,7 @@ class RenderWebGL extends EventEmitter {
1316
1316
1317
1317
const dx = x - drawable . _position [ 0 ] ;
1318
1318
const dy = y - drawable . _position [ 1 ] ;
1319
- const aabb = drawable . getFastBounds ( ) ;
1319
+ const aabb = drawable . _skin . getFenceBounds ( drawable ) ;
1320
1320
const inset = Math . floor ( Math . min ( aabb . width , aabb . height ) / 2 ) ;
1321
1321
1322
1322
const sx = this . _xRight - Math . min ( FENCE_WIDTH , inset ) ;
Original file line number Diff line number Diff line change @@ -136,6 +136,15 @@ class Skin extends EventEmitter {
136
136
return null ;
137
137
}
138
138
139
+ /**
140
+ * Get the bounds of the drawable for determining its fenced position.
141
+ * @param {Array<number> } drawable - The Drawable instance this skin is using.
142
+ * @return {!Rectangle } The drawable's bounds.
143
+ */
144
+ getFenceBounds ( drawable ) {
145
+ return drawable . getFastBounds ( ) ;
146
+ }
147
+
139
148
/**
140
149
* Update and returns the uniforms for this skin.
141
150
* @param {Array<number> } scale - The scaling factors to be used.
You can’t perform that action at this time.
0 commit comments