diff --git a/src/svelte/src/components/DataDisplays/CustomByteDisplay/BinaryData.ts b/src/svelte/src/components/DataDisplays/CustomByteDisplay/BinaryData.ts index 2d7b0b4b3..ff45bad7d 100644 --- a/src/svelte/src/components/DataDisplays/CustomByteDisplay/BinaryData.ts +++ b/src/svelte/src/components/DataDisplays/CustomByteDisplay/BinaryData.ts @@ -17,14 +17,15 @@ import { SimpleWritable } from '../../../stores/localStore' import { + dataDisplayLineCount, type BytesPerRow, type RadixValues, - data_dislay_line_amount, } from '../../../stores/configuration' import { radixBytePad, viewport_offset_to_line_num, } from '../../../utilities/display' + import { get } from 'svelte/store' export const BYTE_ACTION_DIV_OFFSET: number = 24 @@ -38,7 +39,7 @@ export type EditAction = export type ByteValue = { offset: number - text: string | undefined + text: string value: number } @@ -112,9 +113,7 @@ export class ViewportDataStore_t extends SimpleWritable { public upperFetchBoundary(bytesPerRow: BytesPerRow): number { const store = this.storeData() const boundary = - store.fileOffset + - store.length - - get(data_dislay_line_amount) * bytesPerRow + store.fileOffset + store.length - get(dataDisplayLineCount) * bytesPerRow return boundary } @@ -122,7 +121,7 @@ export class ViewportDataStore_t extends SimpleWritable { public lineTopMax(bytesPerRow: BytesPerRow): number { const vpMaxOffset = Math.max( 0, - this.storeData().length - get(data_dislay_line_amount) * bytesPerRow + this.storeData().length - get(dataDisplayLineCount) * bytesPerRow ) const vpLineTopMax = viewport_offset_to_line_num( vpMaxOffset + this.storeData().fileOffset, diff --git a/src/svelte/src/components/DataDisplays/CustomByteDisplay/DataLineFeed.svelte b/src/svelte/src/components/DataDisplays/CustomByteDisplay/DataLineFeed.svelte index 00c7acd4d..0910ee21b 100644 --- a/src/svelte/src/components/DataDisplays/CustomByteDisplay/DataLineFeed.svelte +++ b/src/svelte/src/components/DataDisplays/CustomByteDisplay/DataLineFeed.svelte @@ -29,12 +29,10 @@ limitations under the License. editorActionsAllowed, dataFeedLineTop, seekOffsetInput, - tooltipsEnabled, - viewport, + dataDisplayLineCount } from '../../../stores' import { EditByteModes, - data_dislay_line_amount, type RadixValues, EditActionRestrictions, VIEWPORT_SCROLL_INCREMENT, @@ -94,7 +92,7 @@ limitations under the License. if (fetchBound > $fileMetrics.computedSize) return ( ($fileMetrics.computedSize / $bytesPerRow) * $bytesPerRow - - $data_dislay_line_amount * $bytesPerRow + $dataDisplayLineCount * $bytesPerRow ) return fetchBound @@ -128,7 +126,7 @@ limitations under the License. } const INCREMENT_SEGMENT = () => { $seekOffsetInput = line_num_to_file_offset( - $dataFeedLineTop + $data_dislay_line_amount, + $dataFeedLineTop + $dataDisplayLineCount, viewportData.fileOffset, $bytesPerRow ).toString(addressRadix) @@ -136,7 +134,7 @@ limitations under the License. } const DECREMENT_SEGMENT = () => { $seekOffsetInput = line_num_to_file_offset( - $dataFeedLineTop - $data_dislay_line_amount, + $dataFeedLineTop - $dataDisplayLineCount, viewportData.fileOffset, $bytesPerRow ).toString(addressRadix) @@ -181,7 +179,7 @@ limitations under the License. INCREMENT = 1, } - let height = `calc(${$data_dislay_line_amount} * 20)px` + let height = `calc(${$dataDisplayLineCount} * 20)px` let viewportLines: Array = [] let viewportDataContainer: HTMLDivElement let selectedByteElement: HTMLDivElement @@ -201,9 +199,9 @@ limitations under the License. $: { totalLinesPerFilesize = Math.ceil($fileMetrics.computedSize / $bytesPerRow) totalLinesPerViewport = Math.ceil(viewportData.data.length / $bytesPerRow) - lineTopMaxFile = Math.max(totalLinesPerFilesize - $data_dislay_line_amount, 0) + lineTopMaxFile = Math.max(totalLinesPerFilesize - $dataDisplayLineCount, 0) lineTopMaxViewport = Math.max( - totalLinesPerViewport - $data_dislay_line_amount, + totalLinesPerViewport - $dataDisplayLineCount, 0 ) @@ -253,14 +251,14 @@ limitations under the License. startIndex: number, dataRadix: RadixValues, addressRadix: RadixValues, - endIndex: number = startIndex + ($data_dislay_line_amount - 1) - ): Array { - let ret = [] + endIndex: number = startIndex + ($dataDisplayLineCount - 1) + ): ViewportLineData[] { + let ret:ViewportLineData[] = [] for (let i = startIndex; i <= endIndex; i++) { const viewportLineOffset = i * $bytesPerRow const fileOffset = viewportLineOffset + viewportData.fileOffset - let bytes: Array = [] + let bytes: ByteValue[] = [] const highlight = i % 2 === 0 for (let bytePos = 0; bytePos < $bytesPerRow; bytePos++) { @@ -444,7 +442,7 @@ limitations under the License. ($fileMetrics.computedSize * (percentageTraversed / 100.0)) / $bytesPerRow ) * $bytesPerRow - const firstPageThreshold = $bytesPerRow * $data_dislay_line_amount + const firstPageThreshold = $bytesPerRow * $dataDisplayLineCount const lastPageThreshold = $fileMetrics.computedSize - firstPageThreshold if (offset <= firstPageThreshold) { // scroll to the top because we are somewhere in the first page @@ -570,7 +568,7 @@ limitations under the License. selectionActive={$selectionDataStore.active} currentLine={$dataFeedLineTop} fileOffset={viewportData.fileOffset} - maxDisplayLines={$data_dislay_line_amount} + maxDisplayLines={$dataDisplayLineCount} bind:percentageTraversed on:indicatorClicked={handleClickedIndicator} /> @@ -590,7 +588,7 @@ limitations under the License. fn={INCREMENT_SEGMENT} disabledBy={disableIncrement} width="30pt" - description="Increment offset by {$data_dislay_line_amount * + description="Increment offset by {$dataDisplayLineCount * $bytesPerRow} bytes" tooltipAlwaysEnabled={true} > @@ -624,7 +622,7 @@ limitations under the License. fn={DECREMENT_SEGMENT} disabledBy={disableDecrement} width="30pt" - description="Decrement offset by {$data_dislay_line_amount * + description="Decrement offset by {$dataDisplayLineCount * $bytesPerRow} bytes" tooltipAlwaysEnabled={true} > @@ -646,7 +644,7 @@ limitations under the License.