public void OverlayVisualStateChanged(OverlayControl overlayControl, OverlayInfoState state, IList <OverlayEffectConfiguration> effects)
        {
            //validate
            var overlayInfo = overlayControl?.OverlayInfo;

            if (overlayInfo == null || effects == null || effects.Count == 0)
            {
                return;
            }

            //update effects
            _effectManager.UpdateEffects(overlayInfo, overlayInfo.OverlaySize ?? overlayControl.DefaultOverlaySize, state, _hasPresenterSelected, effects);
        }
        private void ToolTipControl_Loaded(object sender, RoutedEventArgs e)
        {
            var    fe       = sender as FrameworkElement;
            double feWidth  = fe.DesiredSize.Width;
            double feHeight = fe.DesiredSize.Height;

            Point?position = null;

            _offset = new Point(feWidth / 2, feHeight + 10);

            if (_toolTipMode == ToolTipMode.Extended && _overlayRect.HasValue)
            {
                // tooltip panel
                if (_view != null)
                {
                    double x       = _overlayRect.Value.X;
                    double y       = _overlayRect.Value.Y;
                    double width   = _overlayRect.Value.Width;
                    double height  = _overlayRect.Value.Height;
                    double padding = ((height < width) ? height : width) * .1;

                    x      -= padding;
                    y      -= padding;
                    width  += padding * 2;
                    height += padding * 2;

                    _view.Width            = feWidth;
                    _view.Height           = (height / width) * feWidth;
                    _imageView.Width       = width;
                    _imageView.Height      = height;
                    _image.RenderTransform = new TranslateTransform()
                    {
                        X = -x, Y = -y
                    };
                    _offset.Y += _view.Height;
                }

                // tooltip position
                if (!_presenterSelected)
                {
                    Point positionOffset = new Point(0, 0);
                    if (_overlayPolygon?.Points != null && _overlayPolygon.Points.Any())
                    {
                        double renderedImageXTransform = OverlayControl.ActualWidth / _overlaySize.Width;
                        double renderedImageYTransform = OverlayControl.ActualHeight / _overlaySize.Height;
                        double polygonMinX             = _overlayPolygon.Points.Select(p => p.X).Min();
                        double polygonMinY             = _overlayPolygon.Points.Select(p => p.Y).Min();
                        double polygonMiddleX          = Math.Abs(_overlayPolygon.Points[1].X - _overlayPolygon.Points[0].X) / 2;
                        double polygonMiddleY          = Math.Abs(_overlayPolygon.Points[1].Y - _overlayPolygon.Points[0].Y) / 2;
                        double xDelta = _overlayPolygon.Points[0].X - polygonMinX;

                        // get middle position in the top line of polygon
                        positionOffset.X += (polygonMinX + xDelta + polygonMiddleX) * renderedImageXTransform;
                        positionOffset.Y += (polygonMinY + polygonMiddleY) * renderedImageYTransform;
                    }

                    Point positionPoint = OverlayControl.TransformToVisual(Window.Current.Content).TransformPoint(new Point(0, 0));
                    positionPoint.X += positionOffset.X;
                    positionPoint.Y += positionOffset.Y;
                    position         = positionPoint;
                }
            }

            UpdatePosition(!_presenterSelected ? position : null);
        }