mirror of
https://github.com/scratchfoundation/scratchjr.git
synced 2025-07-25 21:38:52 -04:00
Merge pull request #498 from yueyuzhao/issue/282-paint-editor-calibration
Set screen matrix scale to Paint.currentZoom
This commit is contained in:
commit
1a218c46b6
1 changed files with 3 additions and 5 deletions
|
@ -1139,12 +1139,10 @@ export default class PaintAction {
|
||||||
pt2.x = pt.x;
|
pt2.x = pt.x;
|
||||||
pt2.y = pt.y;
|
pt2.y = pt.y;
|
||||||
var screenMatrix = Paint.root.getScreenCTM();
|
var screenMatrix = Paint.root.getScreenCTM();
|
||||||
|
// screenMatrix should include the currentScale, apply scaling
|
||||||
|
screenMatrix.a = Paint.currentZoom;
|
||||||
|
screenMatrix.d = Paint.currentZoom;
|
||||||
var globalPoint = pt2.matrixTransform(screenMatrix.inverse());
|
var globalPoint = pt2.matrixTransform(screenMatrix.inverse());
|
||||||
// screenMatrix should include the currentScale, if it doesn't match, apply scaling
|
|
||||||
if (screenMatrix.a != Paint.currentZoom) {
|
|
||||||
globalPoint.x = globalPoint.x / Paint.currentZoom;
|
|
||||||
globalPoint.y = globalPoint.y / Paint.currentZoom;
|
|
||||||
}
|
|
||||||
return globalPoint;
|
return globalPoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue