コード例 #1
0
        public void ShowSelector()
        {
            int cursorPoint = textView.Caret.Position.BufferPosition;

            if (textView.Caret.ContainingTextViewLine.End.Position == cursorPoint)
            {
                //caret is at end of line back it up one
                cursorPoint = cursorPoint - 1;
            }

            SnapshotPoint point  = new SnapshotPoint(textView.TextSnapshot, cursorPoint);
            SnapshotPoint point2 = new SnapshotPoint(textView.TextSnapshot, cursorPoint + 1);
            var           span   = new SnapshotSpan(point, point2);

            // Align the image with the top of the bounds of the text geometry
            Geometry g = textView.TextViewLines.GetMarkerGeometry(span);

            if (g != null)
            {
                AceJumperControl aceJumperControl = new AceJumperControl(this.textView);
                Canvas.SetLeft(aceJumperControl, g.Bounds.Left);
                Canvas.SetTop(aceJumperControl, g.Bounds.Top);

                this.aceLayer.AddAdornment(AdornmentPositioningBehavior.ViewportRelative, span, null, aceJumperControl, null);
                this.Active = true;
            }
        }
コード例 #2
0
ファイル: AceJump.cs プロジェクト: jsturtevant/ace-jump
        public void ShowSelector()
        {
            int cursorPoint = textView.Caret.Position.BufferPosition;
            if (textView.Caret.ContainingTextViewLine.End.Position == cursorPoint)
            {
                //caret is at end of line back it up one
                cursorPoint = cursorPoint - 1;
            }

            SnapshotPoint point = new SnapshotPoint(textView.TextSnapshot, cursorPoint);
            SnapshotPoint point2 = new SnapshotPoint(textView.TextSnapshot, cursorPoint+1);
            var span = new SnapshotSpan(point, point2);

            // Align the image with the top of the bounds of the text geometry
             Geometry g = textView.TextViewLines.GetMarkerGeometry(span);
            if (g != null)
            {
                AceJumperControl aceJumperControl = new AceJumperControl(this.textView);
                Canvas.SetLeft(aceJumperControl, g.Bounds.Left);
                Canvas.SetTop(aceJumperControl, g.Bounds.Top);

                this.aceLayer.AddAdornment(AdornmentPositioningBehavior.ViewportRelative, span, null, aceJumperControl, null);
                this.Active = true;
            }
        }