mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-31 11:40:47 +08:00
Added more keyboard events to d3.event
-- these events come from https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent but I didn't include all of them
This commit is contained in:
+15
-1
@@ -2656,4 +2656,18 @@ function multiTest() {
|
||||
.attr("class", "x axis")
|
||||
.attr("transform", "translate(0," + height + ")")
|
||||
.call(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
// Tests miscellaneous keyboard events
|
||||
function keyboardEventsTest() {
|
||||
var keyPressed: string;
|
||||
d3.select("body").on("keydown", () => {
|
||||
if (d3.event.metaKey) {
|
||||
keyPressed = "meta";
|
||||
} else if (d3.event.ctrlKey) {
|
||||
keyPressed = "ctrl";
|
||||
} else if (d3.event.altKey) {
|
||||
keyPressed = "alt";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+3
-1
@@ -57,7 +57,9 @@ declare module D3 {
|
||||
x: number;
|
||||
y: number;
|
||||
keyCode: number;
|
||||
altKey: any;
|
||||
altKey?: boolean;
|
||||
ctrlKey?: boolean;
|
||||
metaKey?: boolean;
|
||||
type: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user