void Update() { // if (Input.anyKeyDown) { // Demo (); // } if (Input.GetMouseButtonDown(0)) { var mousePosition = Input.mousePosition; //获取屏幕坐标 mousePosition.z = -Camera.main.transform.position.z; var mouseWorldPos = Camera.main.ScreenToWorldPoint(mousePosition); //屏幕坐标转世界坐标 var distance = float.MaxValue; MapCenter center = null; var p = new Vector2(mouseWorldPos.x, mouseWorldPos.y); foreach (var mapCenter in mapCenters) { var dis = Vector2.Distance(p, mapCenter.position); if (distance > dis) { distance = dis; center = mapCenter; } } Debug.Log(center.position); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } }
private void MapCenter_MapSelectedForOpening(object sender, Mapping.Controls.MapCenter.MapEventArgs e) { if (e != null && e.Map != null) { CreateNewApplicationCommand.CreateNewApplication(MapCenter.GetMapXaml(e)); } }
void mapCenter_MapSelectedForOpening(object sender, MapCenter.MapEventArgs e) { if (e != null && e.Map != null) { mapXaml = MapCenter.GetMapXaml(e); btnOk.IsEnabled = true; } BuilderApplication.Instance.HideWindow(mapCenter); }
private void BrowseWebMap_Click(object sender, RoutedEventArgs e) { if (mapCenter == null) { View view = View.Instance; mapCenter = new MapCenter(); mapCenter.Height = Application.Current.RootVisual.RenderSize.Height - 100; mapCenter.Width = Application.Current.RootVisual.RenderSize.Width - 100; mapCenter.InitialVisibility = System.Windows.Visibility.Visible; mapCenter.MapSelectedForOpening += new EventHandler <MapCenter.MapEventArgs>(mapCenter_MapSelectedForOpening); } BuilderApplication.Instance.ShowWindow(ESRI.ArcGIS.Mapping.Builder.Resources.Strings.OpenWebMapFromArcGISCom, mapCenter); }
public Form1() { InitializeComponent(); mc = new MapCenter(); }