Autoformatter applied on all js files
This commit is contained in:
1 parent
72c1017b20
commit
c627aedcf6
59 files changed
+9087
-10892
No files matched your search
@@ -1,130 +1,113 @@
|
||||
function newChartAspectRatio() {
|
||||
function newChartAspectRatio () {
|
||||
let thisObject = {
|
||||
aspectRatio: undefined,
|
||||
draw: draw,
|
||||
getContainer: getContainer,
|
||||
initialize: initialize
|
||||
}
|
||||
|
||||
let thisObject = {
|
||||
aspectRatio: undefined,
|
||||
draw: draw,
|
||||
getContainer: getContainer,
|
||||
initialize: initialize
|
||||
};
|
||||
let container = newContainer()
|
||||
container.initialize()
|
||||
thisObject.container = container
|
||||
|
||||
let container = newContainer();
|
||||
container.initialize();
|
||||
thisObject.container = container;
|
||||
thisObject.container.frame.width = 50
|
||||
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
|
||||
|
||||
thisObject.container.frame.width = 50;
|
||||
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT;
|
||||
resize()
|
||||
|
||||
resize();
|
||||
container.isDraggeable = false
|
||||
container.isClickeable = false
|
||||
container.isWheeleable = true
|
||||
|
||||
container.isDraggeable = false;
|
||||
container.isClickeable = false;
|
||||
container.isWheeleable = true;
|
||||
thisObject.aspectRatio = {}
|
||||
|
||||
thisObject.aspectRatio = {};
|
||||
const INITIAL_Y_ASPECT_RATIO = 5 / 10
|
||||
const MIN_Y_ASPECT_RATIO = 1 / 10
|
||||
const MAX_Y_ASPECT_RATIO = 10 / 10
|
||||
|
||||
const INITIAL_Y_ASPECT_RATIO = 5 / 10;
|
||||
const MIN_Y_ASPECT_RATIO = 1 / 10;
|
||||
const MAX_Y_ASPECT_RATIO = 10 / 10;
|
||||
thisObject.aspectRatio.x = 1
|
||||
thisObject.aspectRatio.y = INITIAL_Y_ASPECT_RATIO
|
||||
|
||||
thisObject.aspectRatio.x = 1;
|
||||
thisObject.aspectRatio.y = INITIAL_Y_ASPECT_RATIO;
|
||||
canDrawIcon = false
|
||||
|
||||
canDrawIcon = false;
|
||||
return thisObject
|
||||
|
||||
return thisObject;
|
||||
function initialize () {
|
||||
icon = new Image()
|
||||
|
||||
function initialize() {
|
||||
icon.onload = onImageLoad
|
||||
|
||||
icon = new Image();
|
||||
function onImageLoad () {
|
||||
canDrawIcon = true
|
||||
}
|
||||
|
||||
icon.onload = onImageLoad;
|
||||
icon.src = window.canvasApp.urlPrefix + 'Images/Icons/chart-scale.png'
|
||||
|
||||
function onImageLoad() {
|
||||
canDrawIcon = true;
|
||||
}
|
||||
thisObject.container.eventHandler.listenToEvent('Mouse Wheel', onMouseWheel)
|
||||
|
||||
icon.src = window.canvasApp.urlPrefix + "Images/Icons/chart-scale.png";
|
||||
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
|
||||
}
|
||||
|
||||
thisObject.container.eventHandler.listenToEvent('Mouse Wheel', onMouseWheel);
|
||||
function resize () {
|
||||
container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width
|
||||
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
|
||||
}
|
||||
|
||||
window.canvasApp.eventHandler.listenToEvent("Browser Resized", resize);
|
||||
function onMouseWheel (pDelta) {
|
||||
if (viewPort.isMinZoom() === false) { return } // We only make this button to work at the min zoom level.
|
||||
|
||||
}
|
||||
if (pDelta < 0) {
|
||||
pDelta = -0.1
|
||||
} else {
|
||||
pDelta = 0.1
|
||||
}
|
||||
|
||||
function resize() {
|
||||
thisObject.aspectRatio.y = thisObject.aspectRatio.y + pDelta
|
||||
thisObject.aspectRatio.y = Math.round(thisObject.aspectRatio.y * 100) / 100
|
||||
|
||||
container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width;
|
||||
container.frame.position.y = viewPort.visibleArea.bottomLeft.y;
|
||||
if (thisObject.aspectRatio.y < MIN_Y_ASPECT_RATIO) {
|
||||
thisObject.aspectRatio.y = MIN_Y_ASPECT_RATIO
|
||||
}
|
||||
|
||||
}
|
||||
if (thisObject.aspectRatio.y > MAX_Y_ASPECT_RATIO) {
|
||||
thisObject.aspectRatio.y = MAX_Y_ASPECT_RATIO
|
||||
}
|
||||
|
||||
function onMouseWheel(pDelta) {
|
||||
thisObject.container.eventHandler.raiseEvent('Chart Aspect Ratio Changed', thisObject.aspectRatio)
|
||||
}
|
||||
|
||||
if (viewPort.isMinZoom() === false) { return; } // We only make this button to work at the min zoom level.
|
||||
|
||||
if (pDelta < 0) {
|
||||
pDelta = -0.1;
|
||||
} else {
|
||||
pDelta = 0.1;
|
||||
}
|
||||
|
||||
thisObject.aspectRatio.y = thisObject.aspectRatio.y + pDelta;
|
||||
thisObject.aspectRatio.y = Math.round(thisObject.aspectRatio.y * 100) / 100;
|
||||
|
||||
if (thisObject.aspectRatio.y < MIN_Y_ASPECT_RATIO) {
|
||||
|
||||
thisObject.aspectRatio.y = MIN_Y_ASPECT_RATIO;
|
||||
|
||||
}
|
||||
|
||||
if (thisObject.aspectRatio.y > MAX_Y_ASPECT_RATIO) {
|
||||
|
||||
thisObject.aspectRatio.y = MAX_Y_ASPECT_RATIO;
|
||||
|
||||
}
|
||||
|
||||
thisObject.container.eventHandler.raiseEvent("Chart Aspect Ratio Changed", thisObject.aspectRatio);
|
||||
|
||||
}
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
let container;
|
||||
function getContainer (point) {
|
||||
let container
|
||||
|
||||
/* First we check if this point is inside this object UI. */
|
||||
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
|
||||
return this.container;
|
||||
|
||||
} else {
|
||||
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
return this.container
|
||||
} else {
|
||||
/* This point does not belong to this space. */
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
function draw() {
|
||||
function draw () {
|
||||
thisObject.container.frame.draw(false, false)
|
||||
|
||||
thisObject.container.frame.draw(false, false);
|
||||
if (canDrawIcon === false) { return }
|
||||
if (viewPort.isMinZoom() === false) { return } // We only show this button at the min zoom level.
|
||||
|
||||
if (canDrawIcon === false) { return; }
|
||||
if (viewPort.isMinZoom() === false) { return; } // We only show this button at the min zoom level.
|
||||
let breakpointsHeight = 15
|
||||
|
||||
let breakpointsHeight = 15;
|
||||
let imageHeight = 15
|
||||
let imageWidth = 15
|
||||
|
||||
let imageHeight = 15;
|
||||
let imageWidth = 15;
|
||||
let imagePoint = {
|
||||
x: 10,
|
||||
y: thisObject.container.frame.height / 2 - imageHeight / 2 + breakpointsHeight
|
||||
}
|
||||
|
||||
let imagePoint = {
|
||||
x: 10,
|
||||
y: thisObject.container.frame.height / 2 - imageHeight / 2 + breakpointsHeight
|
||||
};
|
||||
imagePoint = thisObject.container.frame.frameThisPoint(imagePoint)
|
||||
|
||||
imagePoint = thisObject.container.frame.frameThisPoint(imagePoint);
|
||||
|
||||
browserCanvasContext.drawImage(icon, imagePoint.x, imagePoint.y, imageWidth, imageHeight);
|
||||
}
|
||||
|
||||
}
|
||||
browserCanvasContext.drawImage(icon, imagePoint.x, imagePoint.y, imageWidth, imageHeight)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user