Exemplo n.º 1
0
        /// <summary>
        /// Scales the text according to the size of the avatar.
        /// </summary>
        private async Task SetScaleForTextAccordingToParent()
        {
            if (ChildContent == null)
            {
                return;
            }

            if (!isReadyForInterop)
            {
                return;
            }

            avatarDimension = await avatarRef.GetDimension(jsRuntime);

            textDimension = await textRef.GetDimension(jsRuntime);

            // We're checking if the text is bigger than the avatar, if it is we scale the text accoridingly.

            decimal newScale = 1M;;

            if (avatarDimension == null || textDimension == null)
            {
                return;
            }

            if (avatarDimension.Width - 8M < textDimension.Width)
            {
                newScale = (avatarDimension.Width - 8M) / textDimension.Width;
            }

            if (newScale == scale)
            {
                return;
            }

            scale = newScale;
            StateHasChanged();
        }
Exemplo n.º 2
0
 public async Task <Dimension> GetDimensions()
 {
     return(await tabPaneRef.GetDimension(jsRuntime));
 }