/// <summary>
 /// Notification that the resizing of the specified ISmartContent object is about to begin.
 /// Overrides of this method can set the values within the passed ResizeOptions class
 /// to control various aspects of resizing behavior.
 /// </summary>
 /// <param name="content">SmartContent which is being resized.</param>
 /// <param name="options">Options which control resizing behavior.</param>
 public virtual void OnResizeStart(ISmartContent content, ResizeOptions options)
 {
 }
 /// <summary>
 /// Notification that the resizing of the specified ISmartContent object is about to begin.
 /// Overrides of this method can set the values within the passed ResizeOptions class
 /// to control various aspects of resizing behavior.
 /// </summary>
 /// <param name="content">SmartContent which is being resized.</param>
 /// <param name="options">Options which control resizing behavior.</param>
 public virtual void OnResizeStart(ISmartContent content, ResizeOptions options)
 {
 }
        public override void OnResizeStart(ISmartContent content, ResizeOptions options)
        {
            // access content object
            VideoSmartContent VideoContent = new VideoSmartContent(content);

            // make sure we keep to the current aspect ratio
            options.AspectRatio = VideoContent.HtmlSize.Width / (double)VideoContent.HtmlSize.Height;
        }
        protected override void OnResizeStart(Size size, bool preserveAspectRatio)
        {
            _resizeUndo = EditorContext.CreateUndoUnit();
            base.OnResizeStart(size, preserveAspectRatio);

            // save references
            _initialParentSize = size;
            _preserveAspectRatio = preserveAspectRatio;

            // initialize smart content
            string contentSourceId;
            string contentId;
            ContentSourceManager.ParseContainingElementId(HTMLElement.id, out contentSourceId, out contentId);

            // clone the smart content for resizing so that settings changes made during the resize
            //operation are undoable
            String newContentId = Guid.NewGuid().ToString();
            SmartContent content = (SmartContent)_contentSourceContext.CloneSmartContent(contentId, newContentId);

            if (content == null)
            {
                Trace.WriteLine("Could not clone smart content for resize.");
                return;
            }

            HTMLElement.id = ContentSourceManager.MakeContainingElementId(contentSourceId, newContentId);

            // call sizer
            ResizeOptions resizeOptions = new ResizeOptions();
            _contentSource.OnResizeStart(content, resizeOptions);

            // determine the target size
            IHTMLElement targetSizeElement = GetResizeTargetElement(resizeOptions.ResizeableElementId);
            _initialTargetSize = new Size(targetSizeElement.offsetWidth, targetSizeElement.offsetHeight);
            // Account for areas of the smart content that are not being scaled when preserving aspect ratio.
            // For example, in YouTube plugin, label text below the image.
            UpdateResizerAspectRatioOffset(_initialParentSize - _initialTargetSize);

            // determine the aspect ratio
            if (resizeOptions.AspectRatio > 0)
                _aspectRatio = resizeOptions.AspectRatio;
            else
                _aspectRatio = ((double)_initialTargetSize.Width) / _initialTargetSize.Height;
        }
 public override void OnResizeStart(ISmartContent content, ResizeOptions options)
 {
     //force the resize operation to scale based on the size of the map image.
     MapSettings settings = new MapSettings(content.Properties);
     options.ResizeableElementId = settings.MapId;
 }