// (TODO: Victor after the animation of the expand/condense is done, remove the "30px margin" // -- by Victor) private bool IsMouseInExtendedBubble(Point mousePosition, ExtendedPreview previewTextBox) { Point positionOnTextBox = new Point(mousePosition.X - (double)previewTextbox.GetValue(Canvas.LeftProperty), mousePosition.Y - (double)previewTextbox.GetValue(Canvas.TopProperty) - Configurations.InfoBubbleArrowHeight); if (positionOnTextBox.X > -30 && positionOnTextBox.X < previewTextbox.PreviewPanel.ActualWidth + 30 // within the preview region && positionOnTextBox.Y > -1 && positionOnTextBox.Y < previewTextbox.PreviewPanel.ActualHeight + 30) return true; else return false; }
public void ExtendBubble(uint bubbleId, string extendedString, double width, double height) { IInfoBubble bubble; graphController.GetInfoBubble(bubbleId, out bubble); previewTextbox = new ExtendedPreview(extendedString, width, height, graphControl, this); graphCanvas.AddTextbox(previewTextbox); extendedBubble.Add(previewTextbox); previewTextbox.Tag = bubbleId; previewTextbox.Visibility = Visibility.Visible; previewTextbox.SetValue(Canvas.LeftProperty, (double)(int)(bubble.AnchorPoint.X - (previewTextbox.InternalTextBox.Width + Configurations.PreviewBubbleExtendedScrollBarWidth - 2) / 2)); previewTextbox.SetValue(Canvas.TopProperty, bubble.AnchorPoint.Y); previewTextbox.PreviewMouseLeftButtonDown += OnPreviewTextboxMouseDown; previewTextbox.InternalTextBox.CaptureMouse(); }