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

Working Text for Shortcuts

parent 6539f24f
......@@ -16,7 +16,7 @@ var _ = require('lodash'),
var menuItems = [];
items.allItems.forEach(function(item) {
menuItems.push( new FastTapMenuItem(item.name, item.icon) );
menuItems.push( new FastTapMenuItem(item.name, item.binding, item.icon) );
});
var fastTapMenu = new FastTapMenu({
......
......@@ -4,20 +4,23 @@ var int2clr = require('./int2clr.js');
var BG_COLOR = 0xc8c8c8;
var BG_COLOR_HOVER = 0xd6d6d6;
function FastTapMenuItem(name, iconPath, width, height) {
function FastTapMenuItem(name, binding, iconPath, width, height) {
PIXI.Container.call(this);
this.name = name;
this.binding = binding;
this.w = width;
this.h = height;
this.hovered = false;
this.label = new PIXI.Text(this.name, {font:"11pt Arial", fill:"#000000", align:"center"});
this.key = new PIXI.Text(this.binding, {font:"11pt Arial",fill:"#0066ff", align:"center"});
this.icon = new PIXI.Sprite( PIXI.Texture.fromImage(iconPath) );
this.bg = new PIXI.Graphics();
this.addChild(this.bg);
this.addChild(this.icon);
this.addChild(this.label);
this.addChild(this.key);
this.interactive = true;
this.mouseover = function(data) {
......@@ -37,11 +40,14 @@ FastTapMenuItem.prototype = Object.create(PIXI.Container.prototype);
FastTapMenuItem.prototype.setItemAlpha = function(alpha) {
this.icon.alpha = alpha;
this.label.alpha = alpha;
this.key.alpha = alpha;
};
FastTapMenuItem.prototype.updateLayout = function() {
this.label.position.x = Math.floor(this.w / 8 - this.label.width / 8);
this.label.position.y = Math.floor(this.h - (this.h / 3));
this.key.position.x = Math.floor(this.w / 1.25 - this.key.width / 1.25);
this.key.position.y = Math.floor(this.h - (this.h/1.75));
this.icon.anchor.x = 0.5;
this.icon.anchor.y = 0.5;
this.icon.width = this.w / 4;
......
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