You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The official example Mouse Wheel Zoom uses camera.preRender(), but in TypeScript this method is marked as protected, causing type errors.
this.input.on('wheel',(pointer,gameObjects,deltaX,deltaY,deltaZ)=>{// Get the current world point under pointer.constworldPoint=camera.getWorldPoint(pointer.x,pointer.y);constnewZoom=camera.zoom-camera.zoom*0.001*deltaY;camera.zoom=Phaser.Math.Clamp(newZoom,0.25,2);// Update camera matrix, so `getWorldPoint` returns zoom-adjusted coordinates.camera.preRender();constnewWorldPoint=camera.getWorldPoint(pointer.x,pointer.y);// Scroll the camera to keep the pointer under the same world point.camera.scrollX-=newWorldPoint.x-worldPoint.x;camera.scrollY-=newWorldPoint.y-worldPoint.y;});
Error:
Expected Behavior
Maybe preRender should be accessible as a public method, matching the behavior shown in examples? Or is there other way to fix it rather than @ts-ignore?
The text was updated successfully, but these errors were encountered:
Hi @zoubingwu. Thanks for submitting this issue. We have fixed this and pushed it to the master branch. It will be part of the next release. Do test it out and let us know if you encounter any issues.
Description
The official example Mouse Wheel Zoom uses
camera.preRender()
, but in TypeScript this method is marked as protected, causing type errors.Error:
![Image](https://private-user-images.githubusercontent.com/18644268/408537961-f4c5371c-24c3-4603-99d5-3c48c15c63cf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMDMyMTAsIm5iZiI6MTczOTAwMjkxMCwicGF0aCI6Ii8xODY0NDI2OC80MDg1Mzc5NjEtZjRjNTM3MWMtMjRjMy00NjAzLTk5ZDUtM2M0OGMxNWM2M2NmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA4MjE1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM3OTRhODYzYzFjNTg0MmJiYTYzNGRhNmEzYzM1YjM3ZGJhYjI0ZDMzMWNjNjYzMjljMTFjMThlZDdjMTc2OTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.JarywVQy61ek96Krer6pwy1dEd7bbhmhWEkCdWE2bhY)
Expected Behavior
Maybe
preRender
should be accessible as a public method, matching the behavior shown in examples? Or is there other way to fix it rather than@ts-ignore
?The text was updated successfully, but these errors were encountered: