fix debug information
This commit is contained in:
parent
3a2a2f6cad
commit
eca6c946f6
@ -324,7 +324,7 @@ class Gamepad {
|
||||
* @returns {object}
|
||||
*/
|
||||
toGamepadInfo(id) {
|
||||
return /(?<name>.*?) \((Vendor: (?<vendor>[0-9a-f]{4}) Product: (?<product>[0-9a-f]{4})|(?<id>.*?))\)/.exec(id).groups;
|
||||
return /(?<name>.*?) \((?:.*?Vendor: (?<vendor>[0-9a-f]{4}) Product: (?<product>[0-9a-f]{4})|(?<id>.*?))\)/.exec(id).groups;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,3 +52,9 @@
|
||||
white-space: nowrap;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#info-vendor,
|
||||
#info-product,
|
||||
#info-id {
|
||||
display: none;
|
||||
}
|
||||
|
@ -20,6 +20,12 @@
|
||||
<div class="value"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="info-id" class="box medium">
|
||||
<div class="content">
|
||||
<div class="label">ID</div>
|
||||
<div class="value"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info">
|
||||
|
@ -1,8 +1,9 @@
|
||||
function DebugTemplate(gamepad) {
|
||||
return {
|
||||
$name: $('#info-name .value'),
|
||||
$vendor: $('#info-vendor .value'),
|
||||
$product: $('#info-product .value'),
|
||||
$vendor: $('#info-vendor'),
|
||||
$product: $('#info-product'),
|
||||
$id: $('#info-id'),
|
||||
$timestamp: $('#info-timestamp .value'),
|
||||
$index: $('#info-index .value'),
|
||||
$mapping: $('#info-mapping .value'),
|
||||
@ -14,10 +15,14 @@ function DebugTemplate(gamepad) {
|
||||
if (!this.activeGamepad) {
|
||||
return;
|
||||
}
|
||||
const { name, vendor, product } = gamepad.toGamepadInfo(this.activeGamepad.id);
|
||||
const { name, vendor, product, id } = gamepad.toGamepadInfo(this.activeGamepad.id);
|
||||
this.$name.html(name).attr('title', name);
|
||||
this.$vendor.html(vendor);
|
||||
this.$product.html(product);
|
||||
if (vendor && product) {
|
||||
this.$vendor.css({display: 'block'}).find('.value').html(vendor);
|
||||
this.$product.css({display: 'block'}).find('.value').html(product);
|
||||
} else {
|
||||
this.$id.css({display: 'block'}).find('.value').html(id);
|
||||
}
|
||||
this.updateTimestamp();
|
||||
this.$index.html(this.activeGamepad.index);
|
||||
this.$mapping.html(this.activeGamepad.mapping || 'N/A');
|
||||
|
Loading…
x
Reference in New Issue
Block a user