MCPcopy Create free account
hub / github.com/neomjs/neo / sortCharacters

Method sortCharacters

src/component/MagicMoveText.mjs:547–555  ·  view source on GitHub ↗

* A sort comparator function used to order character VDOM nodes based on their * `top` and `left` style properties. This ensures a consistent DOM order. * @param {Object} a The first VDOM node. * @param {Object} b The second VDOM node. * @returns {Number} * @protected

(a, b)

Source from the content-addressed store, hash-verified

545 * @protected
546 */
547 sortCharacters(a, b) {
548 let deltaTop = parseFloat(a.style.top) - parseFloat(b.style.top);
549
550 if (deltaTop !== 0) {
551 return deltaTop
552 }
553
554 return parseFloat(a.style.left) - parseFloat(b.style.left)
555 }
556
557 /**
558 * Starts or stops the `setInterval` for automatic text cycling.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected