Exemple #1
0
        public TileSet()
        {
            zoom = UISchema.Zoom.Value;
            name = UISchema.TileSet.Value;

            SetupHandlers ();
            LoadPixbufs ();
        }
 public async Task SetZoomSettingAsync(ZoomSetting setting)
 {
     await NoValue(RequestGenerator.Serialize("setZoomSetting", ApiVersion.V1_0, setting)).ConfigureAwait(false);
 }
Exemple #3
0
        private void SetupHandlers()
        {
            // Schema Notify Events
            UISchema.TileSet.Changed += delegate {
                name = UISchema.TileSet.Value;
                LoadPixbufs ();
                TileSetChanged.Raise (this);
            };
            UISchema.Zoom.Changed += delegate {
                zoom = UISchema.Zoom.Value;
                LoadPixbufs ();
                TileSetChanged.Raise (this);
            };

            // UI Action Events
            UIActions.Instance["ZoomIn"].Activated += delegate {
                if (zoom != ZoomSetting.Largest) {
                    Zoom += 25;
                }
            };
            UIActions.Instance["ZoomOut"].Activated += delegate {
                if (zoom != ZoomSetting.Smallest) {
                    Zoom -= 25;
                }
            };
            UIActions.Instance["NormalSize"].Activated += delegate {
                if (zoom != ZoomSetting.Normal) {
                    Zoom = ZoomSetting.Normal;
                }
            };
        }
Exemple #4
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);
            zoomSelectEnd = e.Location;
            if (e.Button == MouseButtons.Left)
            {
                if (zoomSelecting)
                {
                    zoomSelecting = false;
                    if (Math.Abs(zoomSelectStart.X - zoomSelectEnd.X) > 3 &&
                        Math.Abs(zoomSelectStart.Y - zoomSelectEnd.Y) > 3)
                    {
                        zoomHistory.Push(zoom);
                        zoom = new ZoomSetting
                        {
                            Start = new Vector2(
                                ScreenToWorldX(Math.Min(zoomSelectStart.X, zoomSelectEnd.X)),
                                ScreenToWorldY(Math.Min(zoomSelectStart.Y, zoomSelectEnd.Y))),
                            Size = new Vector2(
                                ScreenToSizeX(Math.Abs(zoomSelectStart.X - zoomSelectEnd.X)),
                                ScreenToSizeY(Math.Abs(zoomSelectStart.Y - zoomSelectEnd.Y)))
                        };
                    }
                    else
                    {
                        Server.Objects.Object o = FindObject(e.X, e.Y);
                        if (o != null)
                        {
                            ObjectWindow w = new ObjectWindow(o);
                            w.Show();
                        }
                    }
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                if (zoomHistory.Count > 0)
                {
                    zoom = zoomHistory.Pop();
                }
            }

            CalcRatio();
            Invalidate();
        }