Resizing Viewport is now possible

This commit is contained in:
Luis Fernando Molina committed 2019-05-10 09:53:07 +02:00
1 parent 6301102a79
commit ebe1b74165
3 files changed
+29 -12

No files matched your search

+4 -4
View File
@@ -159,10 +159,10 @@ maxDate.setDate(maxDate.getDate() + 365 * 1); // We might have charts that proj
const MIN_PLOTABLE_DATE = new Date(2015, 0, 1, 0, 0, 0);
const MAX_PLOTABLE_DATE = maxDate;
const TOP_SPACE_HEIGHT = 5;
const BOTTOM_SPACE_HEIGHT = 35;
const BREAKPOINT_HEIGHT = 15;
const SIDE_PANEL_WIDTH = 450
let TOP_SPACE_HEIGHT = 5;
let BOTTOM_SPACE_HEIGHT = 35;
let BREAKPOINT_HEIGHT = 15;
let SIDE_PANEL_WIDTH = 450
const PRODUCT_CARD_STATUS = {
ON: 'on',
+2 -1
View File
@@ -55,7 +55,8 @@
}
function physics () {
BOTTOM_SPACE_HEIGHT = browserCanvas.height - thisObject.container.frame.position.y
viewPort.resize()
}
function createNewControl (pType, pDrawFunction, pOwner) {
+23 -7
View File
@@ -10,11 +10,12 @@ function newViewPort () {
const CONSOLE_LOG = true
let ANIMATION_INCREMENT = 0.25
const TOP_MARGIN = 15 + TOP_SPACE_HEIGHT
const BOTTOM_MARGIN = 15 + BOTTOM_SPACE_HEIGHT
const LEFT_MARGIN = 50
const RIGHT_MARGIN = 50
const MARGINS = {
let TOP_MARGIN = 15 + TOP_SPACE_HEIGHT
let BOTTOM_MARGIN = 15 + BOTTOM_SPACE_HEIGHT
let LEFT_MARGIN = 50
let RIGHT_MARGIN = 50
let MARGINS = {
TOP: TOP_MARGIN,
BOTTOM: BOTTOM_MARGIN,
LEFT: LEFT_MARGIN,
@@ -44,6 +45,7 @@ function newViewPort () {
animate: animate,
draw: draw,
raiseEvents: raiseEvents,
resize: resize,
initialize: initialize
}
@@ -76,6 +78,22 @@ function newViewPort () {
return thisObject
function initialize () {
resize()
readObjectState()
}
function resize () {
TOP_MARGIN = 15 + TOP_SPACE_HEIGHT
BOTTOM_MARGIN = 15 + BOTTOM_SPACE_HEIGHT
LEFT_MARGIN = 50
RIGHT_MARGIN = 50
MARGINS = {
TOP: TOP_MARGIN,
BOTTOM: BOTTOM_MARGIN,
LEFT: LEFT_MARGIN,
RIGHT: RIGHT_MARGIN
}
thisObject.visibleArea = {
topLeft: { x: LEFT_MARGIN, y: TOP_MARGIN },
topRight: { x: browserCanvas.width - RIGHT_MARGIN, y: TOP_MARGIN },
@@ -85,8 +103,6 @@ function newViewPort () {
thisObject.width = thisObject.visibleArea.topRight.x - thisObject.visibleArea.topLeft.x
thisObject.height = thisObject.visibleArea.bottomRight.y - thisObject.visibleArea.topLeft.y
readObjectState()
}
function getDisplacement () {