Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add resizePixel to Window #38

Open
wants to merge 1 commit into from

1 participant

@cbou

I think a resizePixel method could be useful.

It's inspired from this commit: petejkim/tty.js@1be8a76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 27, 2012
  1. @cbou

    add resizePixel to Window

    cbou authored
This page is out of date. Refresh to see the latest.
Showing with 23 additions and 0 deletions.
  1. +23 −0 static/tty.js
View
23 static/tty.js
@@ -471,6 +471,29 @@ Window.prototype.maximize = function() {
this.emit('maximize');
};
+Window.prototype.resizePixel = function(x, y) {
+ var tempDiv = document.createElement('div');
+ tempDiv.className = 'terminal';
+ tempDiv.style.width = '0';
+ tempDiv.style.height = '0';
+ tempDiv.style.visibility = 'hidden';
+
+ var char = document.createElement('div');
+ char.style.position = 'absolute';
+ char.innerHTML = 'W';
+ tempDiv.appendChild(char);
+
+ this.element.parentNode.insertBefore(tempDiv, this.element.nextSibling);
+
+ var cols = Math.floor(x / char.clientWidth);
+ var rows = Math.floor(y / char.clientHeight);
+
+ tempDiv.parentNode.removeChild(tempDiv);
+ char.parentNode.removeChild(char);
+
+ this.resize(cols, rows);
+};
+
Window.prototype.resize = function(cols, rows) {
this.cols = cols;
this.rows = rows;
Something went wrong with that request. Please try again.