コード例 #1
0
        private void ContextMenuItemSelected(MenuItemCommandParameter param)
        {
            double fov = 1;

            if (param.Frame is CameraFovFrame cameraFovFrame)
            {
                double w = cameraFovFrame.Width;
                double h = cameraFovFrame.Height;
                fov = Math.Sqrt(w * w + h * h);
            }
            else
            {
                double scale = Math.Min(map.Width, map.Height) / (Math.Sqrt(map.Width * map.Width + map.Height * map.Height) / 2);
                if (param.Frame is CircularFovFrame circularFovFrame)
                {
                    fov = circularFovFrame.Size / scale;
                }
                else if (param.Frame is FinderFovFrame finderFovFrame)
                {
                    fov = finderFovFrame.Sizes.Max() / scale;
                }
            }

            if (map.SelectedObject != null)
            {
                map.GoToObject(map.SelectedObject, TimeSpan.FromSeconds(1), fov);
            }
            else
            {
                map.GoToPoint(map.MousePosition, TimeSpan.FromSeconds(1), fov);
            }
        }
コード例 #2
0
        private void MenuItemChecked(MenuItemCommandParameter param)
        {
            param.MenuItem.IsChecked = !param.MenuItem.IsChecked;
            param.Frame.Enabled      = param.MenuItem.IsChecked;

            settings.SetAndSave("FovFrames", fovFrames);

            NotifyPropertyChanged(
                nameof(FrameContextMenuItems),
                nameof(IsContextMenuVisible));
        }
コード例 #3
0
        private void ContextMenuItemSelected(MenuItemCommandParameter param)
        {
            double fov = 1;

            if (param.Frame is CircularFovFrame circularFovFrame)
            {
                fov = circularFovFrame.Size;
            }
            else if (param.Frame is CameraFovFrame cameraFovFrame)
            {
                double w = cameraFovFrame.Width;
                double h = cameraFovFrame.Height;
                fov = Math.Sqrt(w * w + h * h) * 1.7;
            }

            if (map.SelectedObject != null)
            {
                map.GoToObject(map.SelectedObject, TimeSpan.FromSeconds(1), fov);
            }
            else
            {
                map.GoToPoint(map.MousePosition, TimeSpan.FromSeconds(1), fov);
            }
        }