mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 07:10:41 +00:00
Support 1.18 (experimental) snapshots (#158)
* Half support 1.18-experimental-snapshot-1 * Fetch 1.18 presets and improve rendering of lists * Noise preview with deepslate * Biome preview with deepslate * Generalize canvas logic in one hook * Simplify useCanvas * Use mcschema for 1.18 * Improve noise settings preview controls * Fix build * Update deepslate and improve preview caching * Cleanup, remove old preview code * Couple seed between model and preview * Limit output to improve performance + copy feedback For the vanilla overworld dimension (200K lines), it took 2+ seconds to write the output to the textarea Now capped at 10K chars * Add surface_relative_threshold to decorator preview * Improve fixed list errors
This commit is contained in:
@@ -5,17 +5,14 @@ type BtnInputProps = {
|
||||
icon?: keyof typeof Octicon,
|
||||
label?: string,
|
||||
large?: boolean,
|
||||
type?: 'number' | 'text',
|
||||
doSelect?: number,
|
||||
value?: string,
|
||||
onChange?: (value: string) => unknown,
|
||||
}
|
||||
export function BtnInput({ icon, label, large, type, doSelect, value, onChange }: BtnInputProps) {
|
||||
export function BtnInput({ icon, label, large, doSelect, value, onChange }: BtnInputProps) {
|
||||
const onInput = onChange === undefined ? () => {} : (e: any) => {
|
||||
const value = (e.target as HTMLInputElement).value
|
||||
if (type !== 'number' || (!value.endsWith('.') && !isNaN(Number(value)))) {
|
||||
onChange?.(value)
|
||||
}
|
||||
onChange?.(value)
|
||||
}
|
||||
|
||||
const ref = useRef<HTMLInputElement>(null)
|
||||
@@ -28,6 +25,6 @@ export function BtnInput({ icon, label, large, type, doSelect, value, onChange }
|
||||
return <div class={`btn btn-input ${large ? 'large-input' : ''}`} onClick={e => e.stopPropagation()}>
|
||||
{icon && Octicon[icon]}
|
||||
{label && <span>{label}</span>}
|
||||
<input ref={ref} type="text" value={value} onInput={onInput} />
|
||||
<input ref={ref} type="text" value={value} onChange={onInput} />
|
||||
</div>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user