Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @private
- * returns the stage point relative to the render canvas
- */
- private function canvasPointFor(stageX:Number, stageY:Number):Point {
- _stagePt.x = stageX;
- _stagePt.y = stageY;
- return _mcr.renderCanvas.globalToLocal(_stagePt);
- }
- /**
- * @private
- * converts a mouse event point to screen coordinates
- */
- private function pointInWorld( event:MouseEvent ):Vector3D {
- _halfPoint.x = _mcr.config.tileWidth * 0.5;
- _halfPoint.y = -_mcr.config.tileHeight * 0.5;
- return positionMap.mapToWorld(
- canvasPointFor(event.stageX, event.stageY)
- .add(view.viewport.topLeft)
- .add(_halfPoint));
- }
- /**
- * @private
- * converts a point to a tile position
- */
- private function tileInWorld( event:MouseEvent ):Vector3D {
- return positionMap.mapWorldToTile(pointInWorld(event));
- }
Add Comment
Please, Sign In to add comment