Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Adjust event listeners for terminal resize event (#483)
Browse files Browse the repository at this point in the history
* Fix resize issue

* Formatting
  • Loading branch information
octosteve authored Jun 8, 2017
1 parent 29c7737 commit 25ce168
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/terminal-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class TerminalView extends View {

this.attach();
this.subscribe();
this.resizeAfterDrag = this.resizeAfterDrag.bind(this)
}

attach() {
Expand Down Expand Up @@ -61,6 +62,10 @@ class TerminalView extends View {
this.on('mousedown', '.terminal-resize-handle', e => {
this.resizeByDragStarted(e);
});

this.on('mouseup', '.terminal-resize-handle', e => {
this.resizeByDragStopped(e);
});
}

sendToTerminal(data) {
Expand Down Expand Up @@ -187,14 +192,12 @@ class TerminalView extends View {
this.fit()
}

resizeByDragStarted() {
$(document).on('mousemove', e => this.resizeAfterDrag(e))
$(document).on('mouseup', () => this.resizeByDragStopped())
resizeByDragStarted({target}) {
$(document).on('mousemove', this.resizeAfterDrag)
}

resizeByDragStopped() {
$(document).off('mousemove', e => this.resizeAfterDrag(e))
$(document).off('mouseup', () => this.resizeByDragStopped())
$(document).off('mousemove', this.resizeAfterDrag)
}

resizeAfterDrag({pageY, which}) {
Expand Down

0 comments on commit 25ce168

Please sign in to comment.