<commit_before>﻿using WootzJs.Mvc.Mvc.Views.Css;
using WootzJs.Web;

namespace WootzJs.Mvc.Mvc.Views
{
    public class Image : InlineControl
    {
        public Image()
        {
        }

        public Image(string source)
        {
            Source = source;
        }

        public Image(string defaultSource, string highlightedSource)
        {
            Source = defaultSource;
            MouseEntered += () => Source = highlightedSource;
            MouseExited += () => Source = defaultSource;
        }

        public Image(string defaultSource, string highlightedSource, CssColor highlightColor)
        {
            Source = defaultSource;
            MouseEntered += () =>
            {
                Source = highlightedSource;
                Style.BackgroundColor = highlightColor;
            };
            MouseExited += () =>
            {
                Source = defaultSource;
                Style.BackgroundColor = CssColor.Inherit;
            };
        }

        public int Width
        {
            get { return int.Parse(Node.GetAttribute("width")); }
            set { Node.SetAttribute("width", value.ToString()); }<commit_msg>Add ability to set width and height when setting the image<commit_after>﻿using WootzJs.Mvc.Mvc.Views.Css;
using WootzJs.Web;

namespace WootzJs.Mvc.Mvc.Views
{
    public class Image : InlineControl
    {
        public Image()
        {
        }

        public Image(string source, int? width = null, int? height = null)
        {
            Source = source;
            if (width != null)
                Width = width.Value;
            if (height != null)
                Height = height.Value;
        }

        public Image(string defaultSource, string highlightedSource)
        {
            Source = defaultSource;
            MouseEntered += () => Source = highlightedSource;
            MouseExited += () => Source = defaultSource;
        }

        public Image(string defaultSource, string highlightedSource, CssColor highlightColor)
        {
            Source = defaultSource;
            MouseEntered += () =>
            {
                Source = highlightedSource;
                Style.BackgroundColor = highlightColor;
            };
            MouseExited += () =>
            {
                Source = defaultSource;
                Style.BackgroundColor = CssColor.Inherit;
            };
        }

        public int Width
        {
            get { return int.Parse(Node.GetAttribute("width")); }
            set { Node.SetAttribute("width", value.ToString()); }
{'fraction_non_alphanumeric': 0.0940536338904003, 'fraction_numerical': 0.0, 'mean_word_length': 1.5561072492552135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4126468', 'n_tokens_mistral': 643, 'n_tokens_neox': 628, 'n_words': 142}