private void EntityAdded(EntityPlacement placement)
        {
            var ctrl = new EntityPlacementControl();
            var info = this.Screen.Stage.Project.EntityByName(placement.entity);
            var vm = new EntityPlacementControlViewModel(placement, info, Screen);
            ctrl.DataContext = vm;
            ctrl.Visibility = Visibility.Visible;

            PositionControl(ctrl, vm);
            Canvas.SetZIndex(ctrl, 10000);

            vm.PlacementModified += (s, e) => PositionControl(ctrl, vm);

            this.Children.Add(ctrl);
            Update();
        }
        private void PositionControl(EntityPlacementControl ctrl, EntityPlacementControlViewModel viewModel)
        {
            if (viewModel.DefaultSprite != null)
            {
                bool flipHorizontal = (viewModel.Placement.direction == Direction.Left) ^ viewModel.DefaultSprite.Reversed;
                var offset = flipHorizontal ? viewModel.DefaultSprite.Width - viewModel.DefaultSprite.HotSpot.X : viewModel.DefaultSprite.HotSpot.X;

                Canvas.SetLeft(ctrl, Zoom * (viewModel.Placement.screenX - offset));
                Canvas.SetTop(ctrl, Zoom * (viewModel.Placement.screenY - viewModel.DefaultSprite.HotSpot.Y));
            }
            else
            {
                Canvas.SetLeft(ctrl, Zoom * viewModel.Placement.screenX);
                Canvas.SetTop(ctrl, Zoom * viewModel.Placement.screenY);
            }

            InvalidateVisual();
        }