Merge pull request #113 from rschamp/dnd

Add scratchOffset data to extractDrawable
This commit is contained in:
Ray Schamp 2017-03-03 09:32:21 -05:00 committed by GitHub
commit 03d9eed8d0

View File

@ -675,6 +675,8 @@ class RenderWebGL extends EventEmitter {
* @property {Uint8Array} data Raw pixel data for the drawable * @property {Uint8Array} data Raw pixel data for the drawable
* @property {int} width Drawable bounding box width * @property {int} width Drawable bounding box width
* @property {int} height Drawable bounding box height * @property {int} height Drawable bounding box height
* @property {Array<number>} scratchOffset [x, y] offset in Scratch coordinates
* from the drawable position to the client x, y coordinate
* @property {int} x The x coordinate relative to drawable bounding box * @property {int} x The x coordinate relative to drawable bounding box
* @property {int} y The y coordinate relative to drawable bounding box * @property {int} y The y coordinate relative to drawable bounding box
*/ */
@ -738,6 +740,10 @@ class RenderWebGL extends EventEmitter {
data: data, data: data,
width: bounds.width, width: bounds.width,
height: bounds.height, height: bounds.height,
scratchOffset: [
(this._nativeSize[0] / 2) - x + drawable._position[0],
(this._nativeSize[1] / 2) - y - drawable._position[1]
],
x: pickX, x: pickX,
y: pickY y: pickY
}; };