コード例 #1
0
ファイル: SCANbigMap.cs プロジェクト: DBT85/SCANsat
		//Display info for mouse over in the map and handle the zoom map
		private void mouseOver(int id)
		{
			float mx = Event.current.mousePosition.x - TextureRect.x;
			float my = Event.current.mousePosition.y - TextureRect.y;
			bool in_map = false;
			double mlon = 0, mlat = 0;

			//Draw the re-size label in the corner
			Rect resizer = new Rect(WindowRect.width - 24, WindowRect.height - 26, 24, 24);
			GUI.Label(resizer, SCANskins.SCAN_ResizeIcon);

			//Handles mouse positioning and converting to lat/long coordinates
			if (mx >= 0 && my >= 0 && mx < MapTexture.width && my < MapTexture.height)
			{
				double mlo = (mx * 360f / MapTexture.width) - 180;
				double mla = 90 - (my * 180f / MapTexture.height);
				mlon = bigmap.unprojectLongitude(mlo, mla);
				mlat = bigmap.unprojectLatitude(mlo, mla);

				if (mlon >= -180 && mlon <= 180 && mlat >= -90 && mlat <= 90)
				{
					in_map = true;
				}
			}

			//Handles mouse click while inside map; opens zoom map
			if (Event.current.isMouse && !ddRect.Contains(Event.current.mousePosition) && !zoomCloseRect.Contains(Event.current.mousePosition))
			{
				if (Event.current.type == EventType.MouseUp)
				{
					if (Event.current.button == 1)
					{
						if (in_map)
						{
							if (spotMap == null)
							{
								spotMap = gameObject.AddComponent<SCANzoomWindow>();
							}
							spotMap.setMapCenter(mlat, mlon, bigmap);
						}
						Event.current.Use();
					}
				}
				//Handle clicking inside the re-size button
				else if (Event.current.isMouse
				&& Event.current.type == EventType.MouseDown
				&& Event.current.button == 0
				&& resizer.Contains(Event.current.mousePosition))
				{
					IsResizing = true;
					dragX = Input.mousePosition.x;
					resizeW = TextureRect.width;
					Event.current.Use();
				}
			}

			//Draw the actual mouse over info label below the map
			SCANuiUtil.mouseOverInfo(mlon, mlat, bigmap, data, bigmap.Body, in_map);
		}
コード例 #2
0
ファイル: SCANkscMap.cs プロジェクト: DBT85/SCANsat
		//Display info for mouse over in the map and handle the zoom map
		private void mouseOver(int id)
		{
			float mx = Event.current.mousePosition.x - TextureRect.x;
			float my = Event.current.mousePosition.y - TextureRect.y;
			bool in_map = false;
			double mlon = 0, mlat = 0;

			//Handles mouse positioning and converting to lat/long coordinates
			if (mx >= 0 && my >= 0 && mx < MapTexture.width && my < MapTexture.height)
			{
				double mlo = (mx * 360f / MapTexture.width) - 180;
				double mla = 90 - (my * 180f / MapTexture.height);
				mlon = bigmap.unprojectLongitude(mlo, mla);
				mlat = bigmap.unprojectLatitude(mlo, mla);

				if (mlon >= -180 && mlon <= 180 && mlat >= -90 && mlat <= 90)
				{
					in_map = true;
				}
			}

			//Handles mouse click while inside map; opens zoom map or zooms in further
			if (Event.current.isMouse && !ddRect.Contains(Event.current.mousePosition) && !zoomCloseRect.Contains(Event.current.mousePosition))
			{
				if (Event.current.type == EventType.MouseUp)
				{
					if (Event.current.button == 1)
					{
						if (in_map)
						{
							if (spotMap == null)
							{
								spotMap = gameObject.AddComponent<SCANzoomWindow>();
							}
							spotMap.setMapCenter(mlat, mlon, bigmap);
						}
					}
					Event.current.Use();
				}
			}

			//Draw the actual mouse over info label below the map
			SCANuiUtil.mouseOverInfo(mlon, mlat, bigmap, data, bigmap.Body, in_map);
		}