StonehearthEditor.FilePreview.textBox_MouseMove C# (CSharp) Method

textBox_MouseMove() private method

private textBox_MouseMove ( object sender, MouseEventArgs e ) : void
sender object
e System.Windows.Forms.MouseEventArgs
return void
        private void textBox_MouseMove(object sender, MouseEventArgs e)
        {
            // Translate mouse xy to character position
            var position = this.textBox.CharPositionFromPoint(e.X, e.Y);
            var locKey = this.getLocKey(position);

            if (locKey == this.mI18nLocKey)
                return;

            this.mI18nLocKey = locKey;

            if (locKey == null)
            {
                this.textBox.CallTipCancel();
                return;
            }

            try
            {
                // Translate and display it as a tip
                var translated = ModuleDataManager.GetInstance().LocalizeString(locKey);
                translated = JsonHelper.WordWrap(translated, 100).Trim();
                this.textBox.CallTipShow(position, translated);
            }
            catch (Exception)
            {
                this.textBox.CallTipShow(position, $"(Uncaught exception while trying to find i18n for {locKey})");
            }
        }