Skip to content
This repository was archived by the owner on Feb 16, 2025. It is now read-only.

Commit dc2c560

Browse files
committed
Trigger AddInput/RemoveInput events when an input is connected or disconnected
1 parent 9f7b7d9 commit dc2c560

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

webxr/headless/mod.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,18 @@ impl HeadlessDeviceData {
323323
}
324324
}
325325
MockInputMsg::Disconnect => {
326-
input.active = false;
327-
input.clicking = false;
326+
if input.active {
327+
self.events.callback(Event::RemoveInput(input.source.id));
328+
input.active = false;
329+
input.clicking = false;
330+
}
331+
}
332+
MockInputMsg::Reconnect => {
333+
if !input.active {
334+
self.events.callback(Event::AddInput(input.source));
335+
input.active = true;
336+
}
328337
}
329-
MockInputMsg::Reconnect => input.active = true,
330338
}
331339
}
332340
}

0 commit comments

Comments
 (0)