ソースを参照

minor fixes

git-svn-id: https://svn.shirogames.com/evoland1/lib@16 9d342a87-36e0-4458-8f1b-22e0acdbfa51
ncannasse 13 年 前
コミット
c4c9cb5afb
1 ファイル変更7 行追加4 行削除
  1. 7 4
      h2d/Scene.hx

+ 7 - 4
h2d/Scene.hx

@@ -21,6 +21,9 @@ class Scene extends Sprite {
 	
 	
 	public function new() {
 	public function new() {
 		super(null);
 		super(null);
+		var e = h3d.Engine.getCurrent();
+		width = e.width;
+		height = e.height;
 		interactive = new flash.Vector();
 		interactive = new flash.Vector();
 		pushList = new Array();
 		pushList = new Array();
 		stage = flash.Lib.current.stage;
 		stage = flash.Lib.current.stage;
@@ -48,11 +51,11 @@ class Scene extends Sprite {
 	}
 	}
 	
 	
 	function get_mouseX() {
 	function get_mouseX() {
-		return stage.mouseX * width / stage.stageWidth;
+		return (stage.mouseX - x) * width / (stage.stageWidth * scaleX);
 	}
 	}
 
 
 	function get_mouseY() {
 	function get_mouseY() {
-		return stage.mouseY * height / stage.stageHeight;
+		return (stage.mouseY - y) * height / (stage.stageHeight * scaleY);
 	}
 	}
 	
 	
 	function onMouseDown(e:flash.events.MouseEvent) {
 	function onMouseDown(e:flash.events.MouseEvent) {
@@ -106,13 +109,13 @@ class Scene extends Sprite {
 			
 			
 			var max = h1 * w2 - w1 * h2;
 			var max = h1 * w2 - w1 * h2;
 			// bottom/right
 			// bottom/right
-			if( ky > max || kx * r > max )
+			if( ky >= max || kx * r >= max )
 				continue;
 				continue;
 
 
 						
 						
 			event.relX = (kx * r / max) * i.width;
 			event.relX = (kx * r / max) * i.width;
 			event.relY = (ky / max) * i.height;
 			event.relY = (ky / max) * i.height;
-
+			
 			i.handleEvent(event);
 			i.handleEvent(event);
 			if( event.cancel )
 			if( event.cancel )
 				event.cancel = false;
 				event.cancel = false;