MCPcopy
hub / github.com/RaspberryPiFoundation/blockly / append

Method append

packages/blockly/core/layer_manager.ts:148–158  ·  view source on GitHub ↗

* Appends the given element to a layer. If the layer does not exist, it is * created. * * @internal

(elem: IRenderedElement, layerNum: number)

Source from the content-addressed store, hash-verified

146 * @internal
147 */
148 append(elem: IRenderedElement, layerNum: number) {
149 if (!this.layers.has(layerNum)) {
150 this.createLayer(layerNum);
151 }
152 const childElem = elem.getSvgRoot();
153 if (this.layers.get(layerNum)?.lastChild !== childElem) {
154 // Only append the child if it isn't already last (to avoid re-firing
155 // events like focused).
156 this.layers.get(layerNum)?.appendChild(childElem);
157 }
158 }
159
160 /**
161 * Creates a layer and inserts it at the proper place given the layer number.

Callers 15

moveOffDragLayerMethod · 0.95
createDragLayerMethod · 0.80
createAnimationLayerMethod · 0.80
createInsertionMarkerMethod · 0.80
runMethod · 0.80
runMethod · 0.80
pasteMethod · 0.80
constructorMethod · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 3

createLayerMethod · 0.95
getMethod · 0.80
getSvgRootMethod · 0.65

Tested by 3

test_count_byFunction · 0.64
test_count_loopsFunction · 0.64
test_insertFunction · 0.64