-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39459 from phillip-kruger/dev-ui-hotkeys
Add key listeners to the log in Dev UI
- Loading branch information
Showing
10 changed files
with
338 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...ons/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-abstract-log-element.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { QwcHotReloadElement, html, css} from 'qwc-hot-reload-element'; | ||
export * from 'lit'; | ||
|
||
/** | ||
* This is an abstract component that handle some common event for logs | ||
*/ | ||
class QwcAbstractLogElement extends QwcHotReloadElement { | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
connectedCallback() { | ||
super.connectedCallback(); | ||
this.setAttribute('tabindex', '0'); | ||
this.bindKeyHandler = this._handleKeyPress.bind(this); | ||
this.bindScrollHandler = this._handleScroll.bind(this); | ||
this.addEventListener('keydown', this.bindKeyHandler); | ||
this.addEventListener('wheel', this.bindScrollHandler, { passive: false }); | ||
} | ||
|
||
disconnectedCallback() { | ||
this.removeEventListener('keydown', this.bindKeyHandler); | ||
this.removeEventListener('wheel', this.bindScrollHandler); | ||
super.disconnectedCallback(); | ||
} | ||
|
||
_handleScroll(event){ | ||
if (event.ctrlKey) { | ||
// Prevent the default zoom action when Ctrl + scroll is detected | ||
event.preventDefault(); | ||
if (event.deltaY < 0) { | ||
this._handleZoomIn(event); | ||
} else if (event.deltaY > 0) { | ||
this._handleZoomOut(event); | ||
} | ||
} | ||
} | ||
|
||
_handleKeyPress(event) { | ||
throw new Error("Method '_handleKeyPress(event)' must be implemented."); | ||
} | ||
|
||
_handleZoomIn(event){ | ||
throw new Error("Method '_handleZoomIn(event)' must be implemented."); | ||
} | ||
|
||
_handleZoomOut(event){ | ||
throw new Error("Method '_handleZoomOut(event)' must be implemented."); | ||
} | ||
|
||
} | ||
|
||
export { QwcAbstractLogElement }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.