MCPcopy Create free account
hub / github.com/WheretIB/nullc / OnMouseMove

Method OnMouseMove

GUI/RichTextarea.cpp:2280–2309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2278}
2279
2280void TextareaData::OnMouseMove(unsigned int x, unsigned int y)
2281{
2282 unsigned int startX, startY, endX, endY;
2283
2284 // Sort old selection range
2285 SortSelPoints(startX, endX, startY, endY);
2286
2287 // Track the cursor position which is the selection end
2288 currLine = ClientToCursor(x, y, dragEndX, dragEndY, false);
2289
2290 if(IsPressed(VK_CONTROL))
2291 {
2292 if(dragEndY > dragStartY || dragEndX > dragStartX)
2293 dragEndX = AdvanceCursor(currLine, dragEndX, false) + 1;
2294 else
2295 dragEndX = AdvanceCursor(currLine, dragEndX, true);
2296 dragEndX = dragEndX > currLine->length ? currLine->length : dragEndX;
2297 cursorCharX = dragEndX;
2298 cursorCharY = dragEndY;
2299 }else{
2300 // Find cursor position
2301 currLine = ClientToCursor(x, y, cursorCharX, cursorCharY, true);
2302 }
2303
2304 // If current position differs from starting position, enable selection mode
2305 if(dragStartX != dragEndX || dragStartY != dragEndY)
2306 selectionOn = true;
2307 // Redraw selection
2308 InvalidateRect(areaWnd, NULL, false);
2309}
2310
2311AreaLine* TextareaData::ExtendSelectionFromPoint(unsigned int xPos, unsigned int yPos)
2312{

Callers 1

TextareaProcMethod · 0.80

Calls 2

AdvanceCursorFunction · 0.85
IsPressedFunction · 0.70

Tested by

no test coverage detected