@@ -155,7 +155,6 @@ var Mouse = require('../core/Mouse');
155
155
canvas . height = options . height * pixelRatio ;
156
156
canvas . style . width = options . width + 'px' ;
157
157
canvas . style . height = options . height + 'px' ;
158
- render . context . scale ( pixelRatio , pixelRatio ) ;
159
158
} ;
160
159
161
160
/**
@@ -267,7 +266,11 @@ var Mouse = require('../core/Mouse');
267
266
boundsScaleX = boundsWidth / render . options . width ,
268
267
boundsScaleY = boundsHeight / render . options . height ;
269
268
270
- render . context . scale ( 1 / boundsScaleX , 1 / boundsScaleY ) ;
269
+ render . context . setTransform (
270
+ render . options . pixelRatio / boundsScaleX , 0 , 0 ,
271
+ render . options . pixelRatio / boundsScaleY , 0 , 0
272
+ ) ;
273
+
271
274
render . context . translate ( - render . bounds . min . x , - render . bounds . min . y ) ;
272
275
} ;
273
276
@@ -348,15 +351,19 @@ var Mouse = require('../core/Mouse');
348
351
// update mouse
349
352
if ( render . mouse ) {
350
353
Mouse . setScale ( render . mouse , {
351
- x : ( render . bounds . max . x - render . bounds . min . x ) / render . canvas . width ,
352
- y : ( render . bounds . max . y - render . bounds . min . y ) / render . canvas . height
354
+ x : ( render . bounds . max . x - render . bounds . min . x ) / render . options . width ,
355
+ y : ( render . bounds . max . y - render . bounds . min . y ) / render . options . height
353
356
} ) ;
354
357
355
358
Mouse . setOffset ( render . mouse , render . bounds . min ) ;
356
359
}
357
360
} else {
358
361
constraints = allConstraints ;
359
362
bodies = allBodies ;
363
+
364
+ if ( render . options . pixelRatio !== 1 ) {
365
+ render . context . setTransform ( render . options . pixelRatio , 0 , 0 , render . options . pixelRatio , 0 , 0 ) ;
366
+ }
360
367
}
361
368
362
369
if ( ! options . wireframes || ( engine . enableSleeping && options . showSleeping ) ) {
0 commit comments