make mouse coords zero indexed.

This commit is contained in:
Christopher Jeffrey 2013-07-14 07:35:00 -05:00
parent 2105eb3d5b
commit 965af859b0
2 changed files with 11 additions and 0 deletions

View File

@ -275,6 +275,8 @@ Program.prototype._bindMouse = function(s) {
if (key.x === -32) key.x = 255;
if (key.y === -32) key.y = 255;
if (this.zero) key.x--, key.y--;
mod = b >> 3;
key.shift = mod & 4;
key.meta = mod & 8;
@ -333,6 +335,8 @@ Program.prototype._bindMouse = function(s) {
key.x = x;
key.y = y;
if (this.zero) key.x--, key.y--;
// NOTE: Duplicate of the above.
mod = b >> 3;
key.shift = mod & 4;
@ -393,6 +397,8 @@ Program.prototype._bindMouse = function(s) {
key.x = x;
key.y = y;
if (this.zero) key.x--, key.y--;
b &= 3;
// NOTE: Get mod. And wheel.
@ -428,6 +434,8 @@ Program.prototype._bindMouse = function(s) {
key.x = x;
key.y = y;
if (this.zero) key.x--, key.y--;
key.action = b === 3
? 'mouseup'
: 'mousedown';
@ -456,6 +464,8 @@ Program.prototype._bindMouse = function(s) {
key.x = x;
key.y = y;
if (this.zero) key.x--, key.y--;
key.action = 'mousedown';
key.button =
b === 1 ? 'left'

View File

@ -1053,6 +1053,7 @@ Screen.prototype.setEffects = function(el, fel, over, out, effects, temp) {
if (typeof val === 'string') {
effects[key] = val;
} else if (val && typeof val === 'object' && !Array.isArray(val)) {
// TODO: Remove this now that colors are handled lazily.
Object.keys(effects[key]).forEach(function(k) {
var v = effects[key][k];
effects[key][k] = v;