-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfov_slider.js
54 lines (54 loc) · 1.57 KB
/
fov_slider.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(() => {
let panel, styles
Plugin.register("fov_slider", {
title: "FOV Slider",
icon: "vrpano",
author: "Ewan Howell",
description: "Add an FOV slider panel to the Blockbench interface",
tags: ["FOV", "Utility"],
version: "1.0.0",
min_version: "4.6.5",
variant: "both",
onload() {
new Setting("hide_fov_slider", {
value: false,
category: "interface",
name: "Hide FOV slider",
description: "Hide the FOV slider panel"
})
styles = Blockbench.addCSS(`
#fov_slider_container {
padding: 10px 0 10px 20px;
}
`)
panel = new Panel("fov_slider_panel", {
name: "FOV Slider",
condition: () => Format.id !== "image" && !settings.hide_fov_slider.value,
default_position: {
folded: true,
slot: "right_bar"
},
component: {
data: {
fov: settings.fov.value
},
methods: {
change: e => settings.fov.set(limitNumber(parseInt(e.target.value), 1, 120))
},
template: `
<div id="fov_slider_container">
<div class="bar slider_input_combo">
<input type="range" class="tool disp_range" v-model.number="fov" min="1" max="120" step="1" value="{{ fov }}" @input="change">
<input type="number" class="tool disp_text" v-model.number="fov" step="1" @input="change">
</div>
</div>
`
}
})
},
onunload() {
panel.delete()
styles.delete()
}
})
})()