mirror of
https://github.com/misode/misode.github.io.git
synced 2026-05-01 01:59:33 +00:00
Add preview controls
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { DataModel, Path, ModelPath } from "@mcschema/core"
|
||||
import { App } from "../App"
|
||||
import { Octicon } from "../components/Octicon"
|
||||
import { Property } from "../state/Property"
|
||||
import { View } from "../views/View"
|
||||
import { NormalNoise } from './NormalNoise'
|
||||
import { Preview } from './Preview'
|
||||
|
||||
@@ -31,6 +34,22 @@ export class BiomeNoisePreview extends Preview {
|
||||
&& path.push('type').get() === 'minecraft:multi_noise'
|
||||
}
|
||||
|
||||
menu(view: View, redraw: () => void) {
|
||||
return `
|
||||
<div class="btn" data-id="${view.onClick(() => {
|
||||
this.viewScale -= 0.5
|
||||
redraw()
|
||||
})}">
|
||||
${Octicon.plus}
|
||||
</div>
|
||||
<div class="btn" data-id="${view.onClick(() => {
|
||||
this.viewScale += 0.5
|
||||
redraw()
|
||||
})}">
|
||||
${Octicon.dash}
|
||||
</div>`
|
||||
}
|
||||
|
||||
draw(model: DataModel, img: ImageData) {
|
||||
this.noise = BiomeNoisePreview.noiseMaps.map((id, i) => {
|
||||
const config = this.state[`${id}_noise`]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DataModel, ModelPath } from "@mcschema/core"
|
||||
import { View } from "../views/View"
|
||||
|
||||
export abstract class Preview {
|
||||
state: any
|
||||
@@ -8,6 +9,10 @@ export abstract class Preview {
|
||||
return JSON.stringify(this.state) !== JSON.stringify(path.get())
|
||||
}
|
||||
|
||||
menu(view: View, redraw: () => void): string {
|
||||
return ''
|
||||
}
|
||||
|
||||
abstract getName(): string
|
||||
abstract active(path: ModelPath): boolean
|
||||
abstract draw(model: DataModel, img: ImageData): void
|
||||
|
||||
Reference in New Issue
Block a user