* Set active (hovered) elements * @param {array} activeElements New active data points
(activeElements)
| 1098 | * @param {array} activeElements New active data points |
| 1099 | */ |
| 1100 | setActiveElements(activeElements) { |
| 1101 | const lastActive = this._active || []; |
| 1102 | const active = activeElements.map(({datasetIndex, index}) => { |
| 1103 | const meta = this.getDatasetMeta(datasetIndex); |
| 1104 | if (!meta) { |
| 1105 | throw new Error('No dataset found at index ' + datasetIndex); |
| 1106 | } |
| 1107 | |
| 1108 | return { |
| 1109 | datasetIndex, |
| 1110 | element: meta.data[index], |
| 1111 | index, |
| 1112 | }; |
| 1113 | }).filter(({element}) => element); |
| 1114 | const changed = !_elementsEqual(active, lastActive); |
| 1115 | |
| 1116 | if (changed) { |
| 1117 | this._active = active; |
| 1118 | // Make sure we don't use the previous mouse event to override the active elements in update. |
| 1119 | this._lastEvent = null; |
| 1120 | this._updateHoverStyles(active, lastActive); |
| 1121 | } |
| 1122 | } |
| 1123 | |
| 1124 | /** |
| 1125 | * Calls enabled plugins on the specified hook and with the given args. |
nothing calls this directly
no test coverage detected