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

Method viewBrickDidDrop

src/Pipe.js:954–966  ·  view source on GitHub ↗

* Triggered when a brick is dropped on given index. * @param {PipeView} view Sender * @param {number} index Index at which the brick is dropped * @param {Brick|object} brick Brick instance or serialized brick object * @param {boolean} copy Wether to copy or move the brick

(view, index, brick, copy = false)

Source from the content-addressed store, hash-verified

952 * @param {boolean} copy Wether to copy or move the brick
953 */
954 viewBrickDidDrop (view, index, brick, copy = false) {
955 if (brick instanceof Brick) {
956 if (copy) {
957 this.duplicateBrick(brick, index)
958 } else {
959 this.moveBrick(brick, index)
960 }
961 } else {
962 this.spliceBricks(index, 0, [brick])
963 }
964 // Track action
965 EventManager.trigger('pipeBrickDrop', { pipe: this, index, brick, copy })
966 }
967
968 /**
969 * Triggered when a hidden brick group has been clicked.

Callers 1

dragDidDropMethod · 0.80

Calls 4

duplicateBrickMethod · 0.95
moveBrickMethod · 0.95
spliceBricksMethod · 0.95
triggerMethod · 0.80

Tested by

no test coverage detected