// Internal for unit testing. internal void HandleDragStart(CGPoint viewPoint) { Debug.Assert(activeGlyphDropHandler == null); activeGlyphDropHandler = null; // Get the ITextViewLine corresponding to the click point. ITextViewLine textLine = GetTextViewLine(viewPoint.Y); if (textLine == null) { return; } // Is there a draggable glyph here? IActiveGlyphDropHandler draggableTextMarkerGlyphTag = null; foreach (IInteractiveGlyph textMarkerGlyphTag in GetTextMarkerGlyphTagsStartingOnLine(textLine)) { if (textMarkerGlyphTag.DropHandler != null) { draggableTextMarkerGlyphTag = textMarkerGlyphTag.DropHandler; break; } } if (draggableTextMarkerGlyphTag == null) { return; } // We have a draggable glyph. Start dragging it! // Store the handler for the glyph being dragged. activeGlyphDropHandler = draggableTextMarkerGlyphTag; HideTooltip(); dragOccurred = false; // Capture mouse events so we catch mouse moves over the entire screen and the mouse up event. // Note: This may trigger an immediate OnMouseMove event, so make sure we do it last. //glyphMargin.VisualElement.CaptureMouse(); }
internal bool HandleDragEnd(CGPoint viewPoint) { // Clean up our dragging state. //glyphMargin.VisualElement.ReleaseMouseCapture(); //Mouse.OverrideCursor = null; IActiveGlyphDropHandler glyphDropHandler = activeGlyphDropHandler; activeGlyphDropHandler = null; // Did we actually do a drag? if (!dragOccurred) { return(false); } dragOccurred = false; if (glyphDropHandler != null) { var(line, column) = GetLineNumberAndColumn(viewPoint); // If this line isn't in the data (surface) buffer, we can't use it if (line < 0) { return(false); } // Query if we can drop here. if (glyphDropHandler.CanDrop(line, column)) { glyphDropHandler.DropAtLocation(line, column); } } // Even if we couldn't drop here, we return true to ensure that we don't handle this as a normal click. return(true); }