Example #1
0
        public static void EndTemporaryObjectZoom(WorldObject focus)
        {
            if (currentFocusTarget != focus) return;

            Point center = focus.Center();
            Point oldScreenLoc = Spotlight.TranslateWorldPointToScreenPoint(center);

            minZoom = 1f;
            zoom = savedZoom;

            offset = new Vector2(center.X - (oldScreenLoc.X / zoom), center.Y - (oldScreenLoc.Y / zoom));

            currentFocusTarget = savedFocusTarget;
            savedFocusTarget = null;
        }
Example #2
0
        public static void TemporaryZoomOnObject(WorldObject newFocus, Vector2 fingerLocation)
        {
            if (zoom < 1.3f)
            {
                savedZoom = zoom;
                minZoom = 1.3f;
                zoom = 1.3f;
                savedFocusTarget = currentFocusTarget;
                currentFocusTarget = newFocus;
                Point bounds = newFocus.Center();
                offset = new Vector2(bounds.X - (fingerLocation.X/zoom), bounds.Y - (fingerLocation.Y/zoom));
                currentSpotlightAnimatedTransition = SpotlightMotionTransition.None;

            }
            else
            {
                if (fingerLocation.X < 50)
                {
                    offset.X -= 15;
                }
                if (fingerLocation.X > 750)
                {
                    offset.X += 15;
                }
                if (fingerLocation.Y < 50)
                {
                    offset.Y -= 15;
                }
                if (fingerLocation.Y > 430)
                {
                    offset.Y += 15;
                }
                EnforceStageBoundaries();
            }
        }