Merge pull request #498 from yueyuzhao/issue/282-paint-editor-calibration

Set screen matrix scale to Paint.currentZoom
This commit is contained in:
chrisgarrity 2021-08-24 14:55:07 -04:00 committed by GitHub
commit 1a218c46b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1139,12 +1139,10 @@ export default class PaintAction {
pt2.x = pt.x;
pt2.y = pt.y;
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());
// 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;
}
}