picker.js
function handle2dkeys (keys, value, step, min, max) {
	//up and right - increase by one
	if (keys[38]) {
		value[1] = inc(value[1], plainify(step, 1), 1);
	}
	if (keys[39]) {
		value[0] = inc(value[0], plainify(step, 0), 1);
	}
	if (keys[40]) {
		value[1] = inc(value[1], plainify(step, 1), -1);
	}
	if (keys[37]) {
		value[0] = inc(value[0], plainify(step, 0), -1);
	}

	//meta
	var coordIdx = 1;
	if (keys[18] || keys[91] || keys[17] || keys[16]) coordIdx = 0;

	//home - min
	if (keys[36]) {
		value[coordIdx] = min[coordIdx];
	}

	//end - max
	if (keys[35]) {
		value[coordIdx] = max[coordIdx];
	}

	//pageup
	if (keys[33]) {
		value[coordIdx] = inc(value[coordIdx], plainify(step, coordIdx), PAGE);
	}

	//pagedown
	if (keys[34]) {
		value[coordIdx] = inc(value[coordIdx], plainify(step, coordIdx), -PAGE);
	}


	return value;
}
function handle2dkeys (keys, value, step, min, max) {
	//up and right - increase by one
	if (keys[38]) {
		value[1] = inc(value[1], plainify(step, 1), 1);
	}
	if (keys[39]) {
		value[0] = inc(value[0], plainify(step, 0), 1);
	}
	if (keys[40]) {
		value[1] = inc(value[1], plainify(step, 1), -1);
	}
	if (keys[37]) {
		value[0] = inc(value[0], plainify(step, 0), -1);
	}

	//meta
	var coordIdx = 1;
	if (keys[18] || keys[91] || keys[17] || keys[16]) coordIdx = 0;

	//home - min
	if (keys[36]) {
		value[coordIdx] = min[coordIdx];
	}

	//end - max
	if (keys[35]) {
		value[coordIdx] = max[coordIdx];
	}

	//pageup
	if (keys[33]) {
		value[coordIdx] = inc(value[coordIdx], plainify(step, coordIdx), PAGE);
	}

	//pagedown
	if (keys[34]) {
		value[coordIdx] = inc(value[coordIdx], plainify(step, coordIdx), -PAGE);
	}


	return value;
}
function handle2dkeys ( keys , value , step , min , max ) { //up and right - increase by one if ( keys [ 38 ] ) { value [ 1 ] = inc ( value [ 1 ] , plainify ( step , 1 ) , 1 ) ; } if ( keys [ 39 ] ) { value [ 0 ] = inc ( value [ 0 ] , plainify ( step , 0 ) , 1 ) ; } if ( keys [ 40 ] ) { value [ 1 ] = inc ( value [ 1 ] , plainify ( step , 1 ) , - 1 ) ; } if ( keys [ 37 ] ) { value [ 0 ] = inc ( value [ 0 ] , plainify ( step , 0 ) , - 1 ) ; } //meta var coordIdx = 1 ; if ( keys [ 18 ] || keys [ 91 ] || keys [ 17 ] || keys [ 16 ] ) coordIdx = 0 ; //home - min if ( keys [ 36 ] ) { value [ coordIdx ] = min [ coordIdx ] ; } //end - max if ( keys [ 35 ] ) { value [ coordIdx ] = max [ coordIdx ] ; } //pageup if ( keys [ 33 ] ) { value [ coordIdx ] = inc ( value [ coordIdx ] , plainify ( step , coordIdx ) , PAGE ) ; } //pagedown if ( keys [ 34 ] ) { value [ coordIdx ] = inc ( value [ coordIdx ] , plainify ( step , coordIdx ) , - PAGE ) ; } return value ; }
Apply pressed keys on the 2d value
Apply pressed keys on the 2d value