MCPcopy Create free account
hub / github.com/cryptii/cryptii / setDraggingPipePartIndex

Method setDraggingPipePartIndex

src/View/Pipe.js:394–412  ·  view source on GitHub ↗

* Updates the pipe part index the user is currently dragging to. * Updates the drop handle. * @param {number} index Pipe part index

(index)

Source from the content-addressed store, hash-verified

392 * @param {number} index Pipe part index
393 */
394 setDraggingPipePartIndex (index) {
395 if (this._draggingTargetIndex !== index) {
396 // Remove dragging class from current target
397 if (this._draggingTargetIndex !== null) {
398 this._$pipeParts[this._draggingTargetIndex]
399 .classList.remove('pipe__part-pipe--dragging')
400 }
401 // Update index
402 this._draggingTargetIndex = index
403 // Add dragging class on new target
404 if (index !== null) {
405 this._$pipeParts[this._draggingTargetIndex]
406 .classList.add('pipe__part-pipe--dragging')
407 this.getElement().classList.add('pipe--dragging')
408 } else {
409 this.getElement().classList.remove('pipe--dragging')
410 }
411 }
412 }
413
414 /**
415 * Triggered when using the mouse wheel on the view.

Callers 3

brickDragDidEndMethod · 0.95
dragDidOverPipeMethod · 0.95
dragDidDropMethod · 0.95

Calls 1

getElementMethod · 0.80

Tested by

no test coverage detected