Skip to content

Commit

Permalink
Trim lines in bitmap editor
Browse files Browse the repository at this point in the history
  • Loading branch information
kognise committed Apr 11, 2023
1 parent 39350a7 commit 0b12a94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/subeditors/bitmap-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { leftDown, modIcon, rightDown } from '../../lib/utils/keyboard'

const makePixelGrid = (): PaletteItem[][] => new Array(16).fill(0).map(() => new Array(16).fill(transparent))
const textToPixelGrid = (text: string): PaletteItem[][] => {
const rows = text.trim().split('\n')
const rows = text.trim().split('\n').map(row => row.trim())
while (rows.length < 16) rows.push('................')
rows.forEach((_, i) => { while (rows[i]!.length < 16) rows[i] += '.' })
return rows.map(row => [ ...row ].map(char => palette.find(([ key ]) => key === char) ?? transparent))
Expand Down

0 comments on commit 0b12a94

Please sign in to comment.