Skip to content

Commit 164b9a1

Browse files
committed
🚧 Update Icons
1 parent f8badb6 commit 164b9a1

File tree

5 files changed

+52
-2
lines changed

5 files changed

+52
-2
lines changed

src/components/icon.svelte

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<script lang="ts" context="module">
2+
import { onDestroy } from 'svelte'
3+
import AnimatedJavaIcon from '../assets/animated_java_icon.svg'
4+
</script>
5+
6+
<script lang="ts">
7+
let selected = false
8+
9+
const parent = document.querySelector('[format=animated_java_blueprint]')!
10+
const interval = setInterval(() => {
11+
selected = parent.classList.contains('selected')
12+
}, 16)
13+
14+
onDestroy(() => {
15+
clearInterval(interval)
16+
})
17+
</script>
18+
19+
<span class="icon_wrapper f_left">
20+
<img src={AnimatedJavaIcon} alt="" />
21+
</span>
22+
23+
<style>
24+
img {
25+
border-radius: 4px;
26+
width: 24px;
27+
height: 24px;
28+
margin-left: 0.5px;
29+
margin-top: 2px;
30+
box-shadow: 1px 1px 1px #000000aa;
31+
}
32+
</style>

src/components/projectTitle.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
height: 20px;
2121
margin-top: 2px;
2222
margin-right: 2px;
23-
border-radius: 10px;
23+
border-radius: 2px;
24+
box-shadow: 1px 1px 1px #000000aa;
2425
}
2526
</style>

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import './mods/variantPreviewCubeFaceMod'
4545
import './mods/showDefaultPoseMod'
4646
import './mods/addLocatorActionMod'
4747
import './mods/blockbenchReadMod'
48+
import './mods/formatIconMod'
4849
// Outliner
4950
import './outliner/textDisplay'
5051
import './outliner/vanillaItemDisplay'

src/interface/animatedJavaBarItem.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ function createIconImg() {
1818
Object.assign(IMG.style, {
1919
position: 'relative',
2020
top: '2px',
21-
borderRadius: '8px',
21+
borderRadius: '2px',
2222
marginRight: '6px',
23+
boxShadow: '1px 1px 1px #000000aa',
2324
})
2425
return IMG
2526
}
@@ -37,6 +38,9 @@ BLOCKBENCH_MENU_BAR.appendChild(MENU.label)
3738
events.SELECT_PROJECT.subscribe(project => {
3839
MENU.label.style.display = project.format === BLUEPRINT_FORMAT ? 'inline-block' : 'none'
3940
})
41+
events.UNSELECT_AJ_PROJECT.subscribe(() => {
42+
MENU.label.style.display = 'none'
43+
})
4044

4145
MenuBar.addAction(
4246
createAction(`${PACKAGE.name}:about`, {

src/mods/formatIconMod.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Icon from '../components/icon.svelte'
2+
import { injectSvelteCompomponent } from '../util/injectSvelte'
3+
4+
void injectSvelteCompomponent({
5+
elementSelector: () => document.querySelector('[format=animated_java_blueprint]'),
6+
svelteComponent: Icon,
7+
svelteComponentProperties: {},
8+
prepend: true,
9+
postMount: () => {
10+
document.querySelector('[format=animated_java_blueprint] span i')?.parentElement?.remove()
11+
},
12+
})

0 commit comments

Comments
 (0)