Unused files

This commit is contained in:
Luis Fernando Molina committed 2018-12-29 07:08:04 +01:00
1 parent f3424c66b1
commit 55db40435b
2 files changed
-267

No files matched your search

-127
View File
@@ -1,127 +0,0 @@
function newImageButton() {
var thisObject = {
container: undefined,
draw: draw,
status: 'neutral',
type: undefined,
getContainer: getContainer,
initialize: initialize
};
var container = newContainer();
container.initialize();
container.isDraggeable = false;
container.isClickeable = true;
thisObject.container = container;
let idNeutralImage;
let idOnImage;
let idOffImage;
let idDisabledImage;
return thisObject;
function initialize(pX, pY, pWidth, pHeight, pIdNeutralImage, pIdOnImage, pIdOffImage, pIdDisabledImage) {
idNeutralImage = pIdNeutralImage;
idOnImage = pIdOnImage;
idOffImage = pIdOffImage;
idDisabledImage = pIdDisabledImage;
/* Lets set the basic dimensions of this thisObject. */
var position = {
x: pX,
y: pY
};
thisObject.container.frame.position = position;
thisObject.container.frame.width = pWidth;
thisObject.container.frame.height = pHeight;
/* Now we start listening to the onClick event from the mouse, so that we can allow users operate this thisObject. */
thisObject.container.eventHandler.listenToEvent('onMouseClick', buttonPressed, undefined);
}
function getContainer(point) {
var container;
/* First we check if this point is inside this space. */
if (this.container.frame.isThisPointHere(point, true) === true) {
return this.container;
} else {
/* This point does not belong to this space. */
return undefined;
}
}
function buttonPressed(event, extraData) {
switch (thisObject.status) {
case 'neutral':
browserCanvasContext.fillStyle = onFillStyle;
return;
case 'on':
thisObject.status = 'off';
break;
case 'off':
thisObject.status = 'on';
break;
case 'disabled':
return;
}
}
function draw() {
drawImage();
}
function drawImage() {
let image;
let imagePoint = {
x: 0,
y: 0
};
imagePoint = thisObject.container.frame.frameThisPoint(imagePoint);
switch (thisObject.status) {
case 'neutral':
image = document.getElementById(idNeutralImage);
break;
case 'on':
image = document.getElementById(idOnImage);
break;
case 'off':
image = document.getElementById(idOffImage);
break;
case 'disabled':
image = document.getElementById(idDisabledImage);
break;
}
browserCanvasContext.drawImage(image, imagePoint.x, imagePoint.y, thisObject.container.frame.width, thisObject.container.frame.height);
}
}
-140
View File
@@ -1,140 +0,0 @@
function newTextButton() {
var textButton = {
container: undefined,
draw: draw,
status: 'off',
type: undefined,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
};
var container = newContainer();
container.initialize();
container.isDraggeable = false;
container.isClickeable = true;
textButton.container = container;
return textButton;
function initialize() {
/* Lets set the basic dimensions of this textButton. */
var position = {
x: 0,
y: 0
};
this.container.frame.position = position;
this.container.frame.width = 180;
this.container.frame.height = 14;
/* Now we start listening to the onClick event from the mouse, so that we can allow users operate this textButton. */
}
function getContainer(point) {
var container;
/* First we check if this point is inside this space. */
if (this.container.frame.isThisPointHere(point, true) === true) {
return this.container;
} else {
/* This point does not belong to this space. */
return undefined;
}
}
function draw() {
drawIcon();
}
function drawIcon() {
centerPoint = {
x: 7,
y: 7
};
/* Now the transformations. */
centerPoint = textButton.container.frame.frameThisPoint(centerPoint);
/* Lets start the drawing. */
browserCanvasContext.beginPath();
browserCanvasContext.arc(centerPoint.x, centerPoint.y, 3, 0, 2 * Math.PI);
browserCanvasContext.closePath();
let offFillStyle = 'rgba(232, 28, 28, 1)';
let onFillStyle = 'rgba(45, 232, 28, 1)';
let invisibleFillStyle = 'rgba(247, 244, 27, 1)';
switch (textButton.status) {
case 'on':
browserCanvasContext.fillStyle = onFillStyle;
break;
case 'invisible':
browserCanvasContext.fillStyle = invisibleFillStyle;
break;
case 'off':
browserCanvasContext.fillStyle = offFillStyle;
break;
}
browserCanvasContext.fill();
browserCanvasContext.strokeStyle = 'rgba(150, 150, 150, 1)';
browserCanvasContext.lineWidth = 1;
browserCanvasContext.stroke();
browserCanvasContext.closePath();
/* print the text */
let labelPoint;
let fontSize = 10;
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY;
let label = textButton.type;
let xOffset = 0;
let yOffset = 0;
labelPoint = {
x: 20,
y: textButton.container.frame.height - 5
};
labelPoint = textButton.container.frame.frameThisPoint(labelPoint);
browserCanvasContext.fillStyle = 'rgba(60, 60, 60, 0.50)';
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y);
}
}