MCPcopy Create free account
hub / github.com/breck7/scroll / extend

Function extend

external/.scrollLibs.js:10280–10315  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

10278 var counter = 0
10279
10280 function extend(e) {
10281 var curCount = ++counter
10282 var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle")
10283 if (!cur) {
10284 return
10285 }
10286 if (cmp(cur, lastPos) != 0) {
10287 cm.curOp.focus = activeElt()
10288 extendTo(cur)
10289 var visible = visibleLines(display, doc)
10290 if (cur.line >= visible.to || cur.line < visible.from) {
10291 setTimeout(
10292 operation(cm, function () {
10293 if (counter == curCount) {
10294 extend(e)
10295 }
10296 }),
10297 150
10298 )
10299 }
10300 } else {
10301 var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0
10302 if (outside) {
10303 setTimeout(
10304 operation(cm, function () {
10305 if (counter != curCount) {
10306 return
10307 }
10308 display.scroller.scrollTop += outside
10309 extend(e)
10310 }),
10311 50
10312 )
10313 }
10314 }
10315 }
10316
10317 function done(e) {
10318 cm.state.selectingText = false

Callers 1

leftButtonSelectFunction · 0.70

Calls 6

posFromMouseFunction · 0.85
cmpFunction · 0.85
activeEltFunction · 0.85
extendToFunction · 0.85
visibleLinesFunction · 0.85
operationFunction · 0.85

Tested by

no test coverage detected