Skip to content

Commit

Permalink
positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
theripper93 committed Jul 13, 2021
1 parent 44a50ef commit 707a64e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
3 changes: 2 additions & 1 deletion languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"bossbar.settings.position.opt0":"Top (default)",
"bossbar.settings.position.opt1":"Bottom (above webcams)",
"bossbar.settings.position.opt2":"Bottom (below webcams)",
"bossbar.settings.position.opt3":"In player List"
"bossbar.settings.position.opt3":"In player List",
"bossbar.settings.position.opt4":"Bottom (above hotbar)"
}
31 changes: 23 additions & 8 deletions scripts/BossBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class BossBar {

draw(h) {
if ($("body").find(`div[id="bossBar-${this.id}"]`).length > 0) return; //#navigation
const bossBarHtml = `<div style="flex-basis: 100%;height: 0px;" id="bossBarSpacer-${
let bossBarContainer = `<div id="bossBarContainer"></div>`;
let bossBarHtml = `<div style="flex-basis: 100%;height: 0px;" id="bossBarSpacer-${
this.id
}"></div><div id="bossBar-${this.id}" class="bossBar">
<a class="bossBarName" style="font-size: ${this.textSize}px;">${
Expand All @@ -57,12 +58,12 @@ class BossBar {
this.id
}" class="bossBarTemp" style="background-color:${
this.tempBarColor
};height:${h}px"></div>
};height:${h}px;width:${this.hpPercent}%"></div>
<div id="bossBarCurrent-${
this.id
}" class="bossBarCurrent" style="background-image:url('${
this.fgPath
}');height:${h}px"></div>
}');height:${h}px;width:${this.hpPercent}%"></div>
</div>
</div>
<div style="flex-basis: 100%;height: ${
Expand All @@ -82,6 +83,21 @@ class BossBar {
case 3:
$("#players").prepend(bossBarHtml);
break;
case 4:
if ($("body").find(`div[id="bossBarContainer"]`).length == 0) {
$("body").append(bossBarContainer);
}
$("#bossBarContainer").append(bossBarHtml);
$("#bossBarContainer").css({
position: "fixed",
bottom:
$("#hotbar").outerHeight(true) +
$(".bossBar").outerHeight(true) +
10,
width: "calc(100% - 330px)",
left: 15,
});
break;
}
this.update();
}
Expand All @@ -107,11 +123,10 @@ class BossBar {
}
}

static remove() {
canvas.scene.unsetFlag("bossbar", "bossBarActive").then(() => {
canvas.scene._bossBars = {};
this.clearAll();
});
static async remove() {
await canvas.scene.unsetFlag("bossbar", "bossBarActive");
canvas.scene._bossBars = {};
this.clearAll();
}

static addBossBar(bossBar) {
Expand Down
3 changes: 2 additions & 1 deletion scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ Hooks.once("ready", function () {
0: game.i18n.localize("bossbar.settings.position.opt0"),
1: game.i18n.localize("bossbar.settings.position.opt1"),
2: game.i18n.localize("bossbar.settings.position.opt2"),
3: game.i18n.localize("bossbar.settings.position.opt3")
3: game.i18n.localize("bossbar.settings.position.opt3"),
4: game.i18n.localize("bossbar.settings.position.opt4")
},
default: 0,
});
Expand Down
1 change: 1 addition & 0 deletions styles/module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.bossBarName {
text-align: left;
font-size: 10px;
color: white;
filter: drop-shadow(0 0 0.2rem black);
font-family:'Times New Roman', Times, serif;
padding: 3px;
Expand Down

0 comments on commit 707a64e

Please sign in to comment.