Few updates to cover selector width calculation
This commit is contained in:
@@ -4,7 +4,10 @@ open DredgePos
|
|||||||
open Saturn
|
open Saturn
|
||||||
open Giraffe
|
open Giraffe
|
||||||
|
|
||||||
|
let installer = (warbler (fun _ -> htmlString (Controller.RunAllMigrations ())))
|
||||||
|
|
||||||
let router = router {
|
let router = router {
|
||||||
pipe_through Ajax.Router.pipeline
|
pipe_through Ajax.Router.pipeline
|
||||||
get "/" (warbler (fun _ -> htmlString (Controller.RunAllMigrations ())))
|
get "/" installer
|
||||||
|
get "" installer
|
||||||
}
|
}
|
||||||
@@ -184,6 +184,8 @@ const setElementVisibilityByMode = () => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPercentageOfPageContainerWidth = (pixels: number) => ( (pixels / $('#pageContainer').width()) * 100) + '%'
|
||||||
|
|
||||||
const pulseElement = (element: JQuery) => element.addClass('pulse').on('animationend', () => element.removeClass('pulse'))
|
const pulseElement = (element: JQuery) => element.addClass('pulse').on('animationend', () => element.removeClass('pulse'))
|
||||||
|
|
||||||
Array.prototype.where = function<x>(this: x[], property: string, value: any) {
|
Array.prototype.where = function<x>(this: x[], property: string, value: any) {
|
||||||
|
|||||||
@@ -309,14 +309,13 @@ const hideGrids = () => $('.gridContainer').hide()
|
|||||||
|
|
||||||
const gridHtmlGenerated = (gridData: {gridHtml:string, grid: grid}) => {
|
const gridHtmlGenerated = (gridData: {gridHtml:string, grid: grid}) => {
|
||||||
const gridContainer = $('.gridContainer')
|
const gridContainer = $('.gridContainer')
|
||||||
const gridCellWidth = getGridCellWidth()
|
const cellDimensions = getGridCellDimensions()
|
||||||
const gridCellHeight = getGridCellHeight()
|
|
||||||
const grid = gridData.grid
|
const grid = gridData.grid
|
||||||
const gridHtml = gridData.gridHtml
|
const gridHtml = gridData.gridHtml
|
||||||
|
|
||||||
gridContainer
|
gridContainer
|
||||||
.show()
|
.show()
|
||||||
.width(gridCellWidth * grid.cols)
|
.width(cellDimensions.width * grid.cols)
|
||||||
.children('.gridContainerHeader')
|
.children('.gridContainerHeader')
|
||||||
.children('span')
|
.children('span')
|
||||||
.text(grid.name)
|
.text(grid.name)
|
||||||
@@ -326,11 +325,11 @@ const gridHtmlGenerated = (gridData: {gridHtml:string, grid: grid}) => {
|
|||||||
.html(gridHtml)
|
.html(gridHtml)
|
||||||
.show()
|
.show()
|
||||||
.parent()
|
.parent()
|
||||||
.height(gridCellHeight * grid.rows)
|
.height(cellDimensions.width * grid.rows)
|
||||||
.closest('.gridContainer')
|
.closest('.gridContainer')
|
||||||
.find('.pageNavigation')
|
.find('.pageNavigation')
|
||||||
.toggle(gridContainer.find('.gridPage').length > 1)
|
.toggle(gridContainer.find('.gridPage').length > 1)
|
||||||
.height(gridCellHeight)
|
.height(cellDimensions.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
const itemRowClicked = (e: JQuery.TriggeredEvent) => {
|
const itemRowClicked = (e: JQuery.TriggeredEvent) => {
|
||||||
@@ -514,21 +513,28 @@ const customItemTextSubmitted = (text: string) => {
|
|||||||
showVirtualNumpad(lang('enter_item_price'), 4, false, true, true, submitFunction)
|
showVirtualNumpad(lang('enter_item_price'), 4, false, true, true, submitFunction)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getGridCellHeight = () => $('#pageGroupContainer').height()/8
|
const getGridCellDimensions = () => {
|
||||||
const getGridCellWidth = () => $('#pageGroupContainer').width()/6
|
const container = $('#pageGroupContainer')
|
||||||
|
return {
|
||||||
|
height: container.height()/8,
|
||||||
|
width: container.width()/6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const showCoverSelector = (event: JQuery.TriggeredEvent) => {
|
const showCoverSelector = (event: JQuery.TriggeredEvent) => {
|
||||||
const button = $(event.target)
|
const button = $(event.target)
|
||||||
const gridHeight = getGridCellHeight()
|
const gridHeight = getGridCellDimensions().height
|
||||||
|
|
||||||
const coverSelector = $('.coverSelector')
|
const coverSelector = $('.coverSelector')
|
||||||
|
|
||||||
|
const buttonPositionLeftPercent = getPercentageOfPageContainerWidth(button.offset().left)
|
||||||
|
const buttonWidthPercent = getPercentageOfPageContainerWidth(button.width())
|
||||||
|
|
||||||
coverSelector
|
coverSelector
|
||||||
.toggle(!coverSelector.is(':visible'))
|
.toggle(!coverSelector.is(':visible'))
|
||||||
.width(button.width())
|
|
||||||
.css({
|
.css({
|
||||||
left: button.offset().left + 'px',
|
width: buttonWidthPercent,
|
||||||
top: button.offset().top + button.height() + 'px',
|
left: buttonPositionLeftPercent,
|
||||||
|
top: (button.offset().top + button.height()) + 'px'
|
||||||
})
|
})
|
||||||
.find('.coverSelectorButton')
|
.find('.coverSelectorButton')
|
||||||
.height(gridHeight)
|
.height(gridHeight)
|
||||||
|
|||||||
Reference in New Issue
Block a user