Пример #1
0
        void RenderAdornment(PinnedWatch watch)
        {
            var newSpan      = textView.TextSnapshot.SpanFromMDColumnAndLine(watch.Line, watch.Column, watch.EndLine, watch.EndColumn);
            var trackingSpan = textView.TextSnapshot.CreateTrackingSpan(newSpan, SpanTrackingMode.EdgeInclusive);
            var span         = trackingSpan.GetSpan(textView.TextSnapshot);

            if (textView.TextViewLines == null)
            {
                return;
            }

            if (!textView.TextViewLines.FormattedSpan.Contains(span.End))
            {
                return;
            }

            var pinnedWatchView = new PinnedWatchView(watch, DebuggingService.CurrentFrame);
            var materialView    = cocoaViewFactory.CreateMaterialView();

            materialView.Material     = NSVisualEffectMaterial.WindowBackground;
            materialView.ContentView  = pinnedWatchView;
            materialView.CornerRadius = 3;

            var view = (NSView)materialView;

            view.WantsLayer = true;

            try {
                var charBound = textView.TextViewLines.GetCharacterBounds(span.End);
                var origin    = new CGPoint(
                    Math.Round(charBound.Left),
                    Math.Round(charBound.TextTop + charBound.TextHeight / 2 - view.Frame.Height / 2));
                view.SetFrameOrigin(origin);
            } catch (Exception ex) {
                view.SetFrameOrigin(default);
        void RenderAdornment(PinnedWatch watch)
        {
            var span = GetSnapshotSpan(watch);

            if (textView.TextViewLines == null)
            {
                return;
            }

            if (!textView.TextViewLines.FormattedSpan.Contains(span.End))
            {
                return;
            }

            var pinnedWatchView = new PinnedWatchView(watch, DebuggingService.CurrentFrame);
            var materialView    = cocoaViewFactory.CreateMaterialView();

            materialView.Material     = NSVisualEffectMaterial.WindowBackground;
            materialView.ContentView  = pinnedWatchView;
            materialView.CornerRadius = 3;

            var view = (NSView)materialView;

            view.WantsLayer = true;

            UpdateAdornmentLayout(watch, view, span);

            adornments [watch] = view;
        }