adjusted the default zoom level when loading the bin page
This commit is contained in:
parent
ea13f97c57
commit
e8c31b23ee
2 changed files with 11 additions and 2 deletions
|
|
@ -35,6 +35,9 @@ interface Props {
|
|||
* if it becomes an issue I can make the changes necessary to pass the cable components in
|
||||
*/
|
||||
// cables?: GrainCable[]
|
||||
/**
|
||||
* the percentage of the bin to be filled, expects a number between 0 and 1
|
||||
*/
|
||||
fillPercent?: number
|
||||
nodeClick?: (node: NodeData, cable: CableData) => void
|
||||
showGrain?: boolean
|
||||
|
|
@ -48,10 +51,12 @@ interface Props {
|
|||
showTemp?: boolean
|
||||
showMoisture?: boolean
|
||||
xOffset?: number
|
||||
width?: number
|
||||
height?: number
|
||||
}
|
||||
|
||||
export default function Bin3dView(props: Props) {
|
||||
const { bin, scale = 100, fillPercent, nodeClick, showTempHeatmap, showGrain, showHotspots, showResetButton, showMoistureHeatmap, showTemp, showMoisture, xOffset } = props
|
||||
const { bin, scale = 100, fillPercent, nodeClick, showTempHeatmap, showGrain, showHotspots, showResetButton, showMoistureHeatmap, showTemp, showMoisture, xOffset, width = 1, height = 1 } = props
|
||||
|
||||
// Resolve effective dimensions, falling back to defaults when advanced
|
||||
// dimensions have not been configured (bin methods return 0 in that case).
|
||||
|
|
@ -70,8 +75,10 @@ export default function Bin3dView(props: Props) {
|
|||
const diameter = dims.diameter / scale;
|
||||
const largestDim = Math.max(totalHeight, diameter);
|
||||
const fovRad = (75 * Math.PI) / 180;
|
||||
const aspect = width/height
|
||||
const aspectPadding = aspect < 1 ? 1.4 : 1.0 // extra room on mobile
|
||||
// const padding = 1.3; // 30% breathing room
|
||||
const padding = 1.3 + (largestDim / 100) * 2; //more dynamic breathing room based on the bin size
|
||||
const padding = (1.1 + (largestDim/100) * 4.5) * aspectPadding
|
||||
return (largestDim / (2 * Math.tan(fovRad / 2))) * padding;
|
||||
}, [dims, scale]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue