|
|
@@ -365,32 +365,16 @@ const gridStyle = computed(() => {
|
|
|
const availableWidth = Math.max(wrapperSize.value.width - horizontalPadding, 0)
|
|
|
const availableHeight = Math.max(wrapperSize.value.height - verticalPadding, 0)
|
|
|
|
|
|
- const minX = gridBounds.value?.minX ?? 0
|
|
|
- const minY = gridBounds.value?.minY ?? 0
|
|
|
- const rowHasLocation = Array.from({ length: gridMetrics.value.rows }, () => false)
|
|
|
- const colHasLocation = Array.from({ length: gridMetrics.value.cols }, () => false)
|
|
|
- const isLocation = (cell: MapCell): cell is GridCell => !('type' in cell)
|
|
|
- for (const cell of gridData.value) {
|
|
|
- if (!isLocation(cell)) continue
|
|
|
- const rowIndex = cell.parsed.gridRow - minX
|
|
|
- const colIndex = cell.parsed.gridCol - minY
|
|
|
- if (rowIndex >= 0 && rowIndex < rowHasLocation.length) rowHasLocation[rowIndex] = true
|
|
|
- if (colIndex >= 0 && colIndex < colHasLocation.length) colHasLocation[colIndex] = true
|
|
|
- }
|
|
|
-
|
|
|
- const compressedScale = 2 / 3
|
|
|
- const rowScales = rowHasLocation.map((hasLocation) => (hasLocation ? 1 : compressedScale))
|
|
|
- const colScales = colHasLocation.map((hasLocation) => (hasLocation ? 1 : compressedScale))
|
|
|
- const rowScaleSum = rowScales.reduce((total, scale) => total + scale, 0)
|
|
|
- const colScaleSum = colScales.reduce((total, scale) => total + scale, 0)
|
|
|
-
|
|
|
const baseCellWidth =
|
|
|
availableWidth > 0
|
|
|
- ? Math.max((availableWidth - (gridMetrics.value.cols - 1) * gap) / colScaleSum, 28)
|
|
|
+ ? Math.max((availableWidth - (gridMetrics.value.cols - 1) * gap) / gridMetrics.value.cols, 28)
|
|
|
: 72
|
|
|
const baseCellHeight =
|
|
|
availableHeight > 0
|
|
|
- ? Math.max((availableHeight - (gridMetrics.value.rows - 1) * gap) / rowScaleSum, 24)
|
|
|
+ ? Math.max(
|
|
|
+ (availableHeight - (gridMetrics.value.rows - 1) * gap) / gridMetrics.value.rows,
|
|
|
+ 24
|
|
|
+ )
|
|
|
: 60
|
|
|
const compactSize = Math.min(baseCellWidth, baseCellHeight)
|
|
|
|
|
|
@@ -402,12 +386,8 @@ const gridStyle = computed(() => {
|
|
|
const groupBorderWidth = compactSize <= 34 ? 1 : 2
|
|
|
|
|
|
return {
|
|
|
- gridTemplateColumns: colScales
|
|
|
- .map((scale) => `${(baseCellWidth * scale).toFixed(2)}px`)
|
|
|
- .join(' '),
|
|
|
- gridTemplateRows: rowScales
|
|
|
- .map((scale) => `${(baseCellHeight * scale).toFixed(2)}px`)
|
|
|
- .join(' '),
|
|
|
+ gridTemplateColumns: `repeat(${gridMetrics.value.cols}, minmax(0, 1fr))`,
|
|
|
+ gridTemplateRows: `repeat(${gridMetrics.value.rows}, minmax(0, 1fr))`,
|
|
|
'--cell-group-font-size': `${textFontSize}px`,
|
|
|
'--cell-id-font-size': `${idFontSize}px`,
|
|
|
'--cell-group-display': showGroup,
|
|
|
@@ -1372,10 +1352,14 @@ onBeforeUnmount(() => {
|
|
|
|
|
|
.special-cell-label-charger {
|
|
|
color: var(--special-label-strong);
|
|
|
+ font-size: calc(var(--cell-id-font-size, 11px) + 3px);
|
|
|
+ letter-spacing: 0;
|
|
|
}
|
|
|
|
|
|
.special-cell-label-workpoint {
|
|
|
color: var(--special-label-strong);
|
|
|
+ font-size: calc(var(--cell-id-font-size, 11px) + 3px);
|
|
|
+ letter-spacing: 0;
|
|
|
}
|
|
|
|
|
|
.special-cell-label-workpoint-a {
|