Commit de1660f0 authored by Cody Ede (cme527)'s avatar Cody Ede (cme527)
Browse files

Shift Key is live

parent e2539da9
var FastTapMenuItem = require('./FastTapMenuItem.js');
var items = [{name:"Left", binding:"SHIFT+G", icon:"assets/images/borders/Left.png"},
{name:"Right", binding:"SHIFT+G", icon:"assets/images/borders/Right.png"},
{name:"Top", binding:"SHIFT+G", icon:"assets/images/borders/Top.png"},
{name:"Bottom", binding:"SHIFT+G", icon:"assets/images/borders/Bottom.png"},
{name:"Outside", binding:"SHIFT+G", icon:"assets/images/borders/Outside.png"},
{name:"Inside", binding:"SHIFT+G", icon:"assets/images/borders/Inside.png"},
{name:"All", binding:"SHIFT+G", icon:"assets/images/borders/All.png"},
{name:"None", binding:"SHIFT+G", icon:"assets/images/borders/None.png"},
{name:"Red", binding:"SHIFT+G", icon:"assets/images/colours/Red.png"},
{name:"Orange", binding:"SHIFT+G", icon:"assets/images/colours/Orange.png"},
{name:"Yellow", binding:"SHIFT+G", icon:"assets/images/colours/Yellow.png"},
{name:"Green", binding:"SHIFT+G", icon:"assets/images/colours/Green.png"},
{name:"Blue", binding:"SHIFT+G", icon:"assets/images/colours/Blue.png"},
{name:"Purple", binding:"SHIFT+G", icon:"assets/images/colours/Purple.png"},
{name:"Pink", binding:"SHIFT+G", icon:"assets/images/colours/Pink.png"},
{name:"Black", binding:"SHIFT+G", icon:"assets/images/colours/Black.png"},
{name:"Arial", binding:"SHIFT+G", icon:"assets/images/fonts/Arial.png"},
{name:"Courier", binding:"SHIFT+G", icon:"assets/images/fonts/Courier.png"},
{name:"Franklin", binding:"SHIFT+G", icon:"assets/images/fonts/Franklin.png"},
{name:"Garamond", binding:"SHIFT+G", icon:"assets/images/fonts/Garamond.png"},
{name:"Lucida", binding:"SHIFT+G", icon:"assets/images/fonts/Lucida.png"},
{name:"Segoe", binding:"SHIFT+G", icon:"assets/images/fonts/Segoe.png"},
{name:"Times", binding:"SHIFT+G", icon:"assets/images/fonts/Times.png"},
{name:"Verdana", binding:"SHIFT+G", icon:"assets/images/fonts/Verdana.png"},
{name:"8 point", binding:"SHIFT+G", icon:"assets/images/fontsize/8_point.png"},
{name:"10 point", binding:"SHIFT+G", icon:"assets/images/fontsize/10_point.png"},
{name:"12 point", binding:"SHIFT+G", icon:"assets/images/fontsize/12_point.png"},
{name:"14 point", binding:"SHIFT+G", icon:"assets/images/fontsize/14_point.png"},
{name:"18 point", binding:"SHIFT+G", icon:"assets/images/fontsize/18_point.png"},
{name:"24 point", binding:"SHIFT+G", icon:"assets/images/fontsize/24_point.png"},
{name:"28 point", binding:"SHIFT+G", icon:"assets/images/fontsize/28_point.png"},
{name:"32 point", binding:"SHIFT+G", icon:"assets/images/fontsize/32_point.png"},
{name:"Left Justify", binding:"SHIFT+G", icon:"assets/images/paragraph/Left_Justify.png"},
{name:"Center Justify", binding:"SHIFT+G", icon:"assets/images/paragraph/Center_Justify.png"},
{name:"Right Justify", binding:"SHIFT+G", icon:"assets/images/paragraph/Right_Justify.png"},
{name:"Full Justify", binding:"SHIFT+G", icon:"assets/images/paragraph/Full_Justify.png"},
{name:"Bullets", binding:"SHIFT+G", icon:"assets/images/paragraph/Bullets.png"},
{name:"Numbered", binding:"SHIFT+G", icon:"assets/images/paragraph/Numbered.png"},
{name:"Less Indent", binding:"SHIFT+G", icon:"assets/images/paragraph/Less_Indent.png"},
{name:"More Indent", binding:"SHIFT+G", icon:"assets/images/paragraph/More_Indent.png"},
{name:"Square", binding:"SHIFT+G", icon:"assets/images/shapes/Square.png"},
{name:"Arrow", binding:"SHIFT+G", icon:"assets/images/shapes/Arrow.png"},
{name:"Oval", binding:"SHIFT+G", icon:"assets/images/shapes/Oval.png"},
{name:"Cross", binding:"SHIFT+G", icon:"assets/images/shapes/Cross.png"},
{name:"Diamond", binding:"SHIFT+G", icon:"assets/images/shapes/Diamond.png"},
{name:"Round Rect", binding:"SHIFT+G", icon:"assets/images/shapes/RoundRectangle.png"},
{name:"Star", binding:"SHIFT+G", icon:"assets/images/shapes/Star.png"},
{name:"Triangle", binding:"SHIFT+G", icon:"assets/images/shapes/Triangle.png"},
{name:"Bold", binding:"SHIFT+G", icon:"assets/images/style/Bold.png"},
{name:"Italic", binding:"SHIFT+G", icon:"assets/images/style/Italic.png"},
{name:"Underline", binding:"SHIFT+G", icon:"assets/images/style/Underline.png"},
{name:"Shadow", binding:"SHIFT+G", icon:"assets/images/style/Shadow.png"},
{name:"Small Caps", binding:"SHIFT+G", icon:"assets/images/style/Small_Caps.png"},
{name:"Strikethrough", binding:"SHIFT+G", icon:"assets/images/style/Strikethrough.png"},
{name:"Subscript", binding:"SHIFT+G", icon:"assets/images/style/Subscript.png"},
{name:"Superscript", binding:"SHIFT+G", icon:"assets/images/style/Superscript.png"},
{name:"Cloth", binding:"SHIFT+G", icon:"assets/images/textures/Cloth.png"},
{name:"Cork", binding:"SHIFT+G", icon:"assets/images/textures/Cork.png"},
{name:"Marble", binding:"SHIFT+G", icon:"assets/images/textures/Marble.png"},
{name:"Paper", binding:"SHIFT+G", icon:"assets/images/textures/Paper.png"},
{name:"Parchment", binding:"SHIFT+G", icon:"assets/images/textures/Parchment.png"},
{name:"Sand", binding:"SHIFT+G", icon:"assets/images/textures/Sand.png"},
{name:"Water", binding:"SHIFT+G", icon:"assets/images/textures/Water.png"},
{name:"Wood", binding:"SHIFT+G", icon:"assets/images/textures/Wood.png"}];
var items = [{name:"Left", binding:"Shift+G", icon:"assets/images/borders/Left.png"},
{name:"Right", binding:" ", icon:"assets/images/borders/Right.png"},
{name:"Top", binding:" ", icon:"assets/images/borders/Top.png"},
{name:"Bottom", binding:"Shift+A", icon:"assets/images/borders/Bottom.png"},
{name:"Outside", binding:" ", icon:"assets/images/borders/Outside.png"},
{name:"Inside", binding:"Shift+G", icon:"assets/images/borders/Inside.png"},
{name:"All", binding:"Shift+G", icon:"assets/images/borders/All.png"},
{name:"None", binding:"Shift+G", icon:"assets/images/borders/None.png"},
{name:"Red", binding:"Shift+G", icon:"assets/images/colours/Red.png"},
{name:"Orange", binding:"Shift+G", icon:"assets/images/colours/Orange.png"},
{name:"Yellow", binding:"Shift+G", icon:"assets/images/colours/Yellow.png"},
{name:"Green", binding:"Shift+G", icon:"assets/images/colours/Green.png"},
{name:"Blue", binding:"Shift+P", icon:"assets/images/colours/Blue.png"},
{name:"Purple", binding:"Shift+G", icon:"assets/images/colours/Purple.png"},
{name:"Pink", binding:"Shift+G", icon:"assets/images/colours/Pink.png"},
{name:"Black", binding:"Shift+G", icon:"assets/images/colours/Black.png"},
{name:"Arial", binding:"Shift+G", icon:"assets/images/fonts/Arial.png"},
{name:"Courier", binding:"Shift+G", icon:"assets/images/fonts/Courier.png"},
{name:"Franklin", binding:"Shift+G", icon:"assets/images/fonts/Franklin.png"},
{name:"Garamond", binding:"Shift+G", icon:"assets/images/fonts/Garamond.png"},
{name:"Lucida", binding:"Shift+G", icon:"assets/images/fonts/Lucida.png"},
{name:"Segoe", binding:"Shift+G", icon:"assets/images/fonts/Segoe.png"},
{name:"Times", binding:"Shift+G", icon:"assets/images/fonts/Times.png"},
{name:"Verdana", binding:"Shift+G", icon:"assets/images/fonts/Verdana.png"},
{name:"8 point", binding:" ", icon:"assets/images/fontsize/8_point.png"},
{name:"10 point", binding:"Shift+G", icon:"assets/images/fontsize/10_point.png"},
{name:"12 point", binding:"Shift+G", icon:"assets/images/fontsize/12_point.png"},
{name:"14 point", binding:"Shift+G", icon:"assets/images/fontsize/14_point.png"},
{name:"18 point", binding:"Shift+G", icon:"assets/images/fontsize/18_point.png"},
{name:"24 point", binding:"Shift+G", icon:"assets/images/fontsize/24_point.png"},
{name:"28 point", binding:"Shift+G", icon:"assets/images/fontsize/28_point.png"},
{name:"32 point", binding:"Shift+G", icon:"assets/images/fontsize/32_point.png"},
{name:"Left Justify", binding:"Shift+G", icon:"assets/images/paragraph/Left_Justify.png"},
{name:"Center Justify", binding:"Shift+G", icon:"assets/images/paragraph/Center_Justify.png"},
{name:"Right Justify", binding:"Shift+G", icon:"assets/images/paragraph/Right_Justify.png"},
{name:"Full Justify", binding:"Shift+G", icon:"assets/images/paragraph/Full_Justify.png"},
{name:"Bullets", binding:"Shift+G", icon:"assets/images/paragraph/Bullets.png"},
{name:"Numbered", binding:"Shift+G", icon:"assets/images/paragraph/Numbered.png"},
{name:"Less Indent", binding:"Shift+G", icon:"assets/images/paragraph/Less_Indent.png"},
{name:"More Indent", binding:"Shift+G", icon:"assets/images/paragraph/More_Indent.png"},
{name:"Square", binding:"Shift+G", icon:"assets/images/shapes/Square.png"},
{name:"Arrow", binding:"Shift+G", icon:"assets/images/shapes/Arrow.png"},
{name:"Oval", binding:"Shift+G", icon:"assets/images/shapes/Oval.png"},
{name:"Cross", binding:"Shift+G", icon:"assets/images/shapes/Cross.png"},
{name:"Diamond", binding:"Shift+G", icon:"assets/images/shapes/Diamond.png"},
{name:"Round Rect", binding:"Shift+G", icon:"assets/images/shapes/RoundRectangle.png"},
{name:"Star", binding:"Shift+G", icon:"assets/images/shapes/Star.png"},
{name:"Triangle", binding:"Shift+G", icon:"assets/images/shapes/Triangle.png"},
{name:"Bold", binding:"Shift+G", icon:"assets/images/style/Bold.png"},
{name:"Italic", binding:"Shift+G", icon:"assets/images/style/Italic.png"},
{name:"Underline", binding:"Shift+G", icon:"assets/images/style/Underline.png"},
{name:"Shadow", binding:"Shift+G", icon:"assets/images/style/Shadow.png"},
{name:"Small Caps", binding:"Shift+G", icon:"assets/images/style/Small_Caps.png"},
{name:"Strikethrough", binding:"Shift+G", icon:"assets/images/style/Strikethrough.png"},
{name:"Subscript", binding:"Shift+G", icon:"assets/images/style/Subscript.png"},
{name:"Superscript", binding:"Shift+G", icon:"assets/images/style/Superscript.png"},
{name:"Cloth", binding:"Shift+G", icon:"assets/images/textures/Cloth.png"},
{name:"Cork", binding:"Shift+G", icon:"assets/images/textures/Cork.png"},
{name:"Marble", binding:"Shift+G", icon:"assets/images/textures/Marble.png"},
{name:"Paper", binding:"Shift+G", icon:"assets/images/textures/Paper.png"},
{name:"Parchment", binding:"Shift+G", icon:"assets/images/textures/Parchment.png"},
{name:"Sand", binding:"Shift+G", icon:"assets/images/textures/Sand.png"},
{name:"Water", binding:"Shift+G", icon:"assets/images/textures/Water.png"},
{name:"Wood", binding:"Shift+G", icon:"assets/images/textures/Wood.png"}];
function getItemByName(name) {
var item = null;
......
var kd = require('keydrown');
function KeyboardManager() {
this._SPACEKeydown = false;
this._SHIFTKeydown = false;
this._aKeydown = false;
this._bKeydown = false;
this._cKeydown = false;
this._dKeydown = false;
this._eKeydown = false;
this._fKeydown = false;
this._gKeydown = false;
this._hKeydown = false;
this._iKeydown = false;
this._jKeydown = false;
this._Kkeydown = false;
this._lKeydown = false;
this._mKeydown = false;
this._nKeydown = false;
this._oKeydown = false;
this._pKeydown = false;
this._qKeydown = false;
this._rKeydown = false;
this._sKeydown = false;
this._tKeydown = false;
this._uKeydown = false;
this._vKeydown = false;
this._wKeydown = false;
this._xKeydown = false;
this._yKeydown = false;
this._zKeydown = false;
this._1Keydown = false;
this._2Keydown = false;
this._3Keydown = false;
this._4Keydown = false;
this._5Keydown = false;
this._6Keydown = false;
this._7Keydown = false;
this._8Keydown = false;
this._9Keydown = false;
this._0Keydown = false;
this._stateChangeHandlers = [];
}
......@@ -9,18 +48,28 @@ function KeyboardManager() {
KeyboardManager.prototype.tick = function() {
kd.tick();
if (kd.A.isDown() && this._aKeydown == false) {
this._aKeydown = true;
if (kd.SPACE.isDown() && this._SPACEKeydown == false) {
this._SPACEKeydown = true;
this.notifyObservers();
} else if (!kd.A.isDown() && this._aKeydown == true) {
this._aKeydown = false;
} else if (!kd.SPACE.isDown() && this._SPACEKeydown == true) {
this._SPACEKeydown = false;
this.notifyObservers();
}
if (kd.SHIFT.isDown() && this._SHIFTKeydown == false)
{
this._SHIFTKeydown = true;
console.log('The Shiftkey is live');
}
if (!kd.SHIFT.isDown() && this._SHIFTKeydown == true)
{
this._SHIFTKeydown = false;
}
};
KeyboardManager.prototype.notifyObservers = function() {
for (var i = 0; i < this._stateChangeHandlers.length; i++) {
this._stateChangeHandlers[i](this._aKeydown);
this._stateChangeHandlers[i](this._SPACEKeydown);
}
};
......@@ -28,6 +77,7 @@ KeyboardManager.prototype.addStateChangeHandler = function(f) {
this._stateChangeHandlers.push(f);
};
KeyboardManager.prototype.removeStateChangeHandler = function(f) {
for (var i = 0; i < this._stateChangeHandlers.length; i++) {
if (this._stateChangeHandlers[i] === f) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment