(type: EventType, button?: MouseButton)
| 190 | } |
| 191 | |
| 192 | private getEventInit(type: EventType, button?: MouseButton) { |
| 193 | const init: MouseEventInit = { |
| 194 | ...this.position.coords, |
| 195 | } |
| 196 | |
| 197 | init.button = getMouseEventButton(button) |
| 198 | init.buttons = this.buttons.getButtons() |
| 199 | |
| 200 | if (type === 'mousedown') { |
| 201 | init.detail = this.clickCount.getOnDown(init.button) |
| 202 | } else if (type === 'mouseup') { |
| 203 | init.detail = this.clickCount.getOnUp(init.button) |
| 204 | } else if (type === 'click' || type === 'auxclick') { |
| 205 | init.detail = this.clickCount.incOnClick(init.button) |
| 206 | } |
| 207 | |
| 208 | return init |
| 209 | } |
| 210 | |
| 211 | private getTarget(instance: Instance) { |
| 212 | return this.position.target ?? instance.config.document.body |
no test coverage detected