MCPcopy Create free account
hub / github.com/codecombat/codecombat / setHighlightedConnection

Method setHighlightedConnection

app/views/play/CampaignView.js:1754–1774  ·  view source on GitHub ↗
(index)

Source from the content-addressed store, hash-verified

1752 }
1753
1754 setHighlightedConnection (index) {
1755 if (!this.editorMode) { return }
1756 this.highlightedConnectionIndex = index == null ? null : index
1757 const $svg = this.$el.find('.map #visual-connections-svg')
1758 if (!$svg.length) { return }
1759 const $paths = $svg.find('path[data-connection-index]')
1760 if (!$paths.length) { return }
1761 $paths.each(function () {
1762 const el = this
1763 const c = (el.getAttribute('class') || '').replace(/\s*connection-highlighted\s*/g, ' ').trim()
1764 el.setAttribute('class', c)
1765 })
1766 if (this.highlightedConnectionIndex != null) {
1767 const $target = $svg.find(`path[data-connection-index="${this.highlightedConnectionIndex}"]`)
1768 if ($target.length) {
1769 const el = $target[0]
1770 const c = (el.getAttribute('class') || '').trim()
1771 el.setAttribute('class', (c ? c + ' ' : '') + 'connection-highlighted')
1772 }
1773 }
1774 }
1775
1776 applyCampaignStyles () {
1777 if (!this.campaign?.loaded) { return }

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected