mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
fix: fill-box component
This commit is contained in:
parent
0c6eadaed3
commit
80bf0ef688
2 changed files with 5 additions and 4 deletions
|
|
@ -112,7 +112,7 @@
|
||||||
<script src="/libs/jquery-3.1.1.min.js"></script>
|
<script src="/libs/jquery-3.1.1.min.js"></script>
|
||||||
<script defer src="/libs/jquery-ui.min.js"></script>
|
<script defer src="/libs/jquery-ui.min.js"></script>
|
||||||
<script defer src="/libs/jquery.ui.touch-punch.min.js"></script>
|
<script defer src="/libs/jquery.ui.touch-punch.min.js"></script>
|
||||||
<link href="/libs/jquery-ui.css" as="style" />
|
<link href="/libs/jquery-ui.css" rel="stylesheet" />
|
||||||
<script src="/libs/define-globals.js"></script>
|
<script src="/libs/define-globals.js"></script>
|
||||||
|
|
||||||
<!-- styles -->
|
<!-- styles -->
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {tip} from "../scripts/tooltips";
|
import {tip} from "scripts/tooltips";
|
||||||
|
|
||||||
const template = document.createElement("template");
|
const template = document.createElement("template");
|
||||||
template.innerHTML = /* html */ `
|
template.innerHTML = /* html */ `
|
||||||
|
|
@ -29,6 +29,9 @@ class FillBox extends HTMLElement {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.tooltip = this.dataset.tip || "Fill style. Click to change";
|
this.tooltip = this.dataset.tip || "Fill style. Click to change";
|
||||||
|
|
||||||
|
// cannot use Shadow DOM here as need an access to svg hatches
|
||||||
|
this.appendChild(template.content.cloneNode(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private showTip() {
|
private showTip() {
|
||||||
|
|
@ -36,8 +39,6 @@ class FillBox extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
// cannot use Shadow DOM here as need an access to svg hatches
|
|
||||||
this.appendChild(template.content.cloneNode(true));
|
|
||||||
this.querySelector("rect")?.setAttribute("fill", this.fill);
|
this.querySelector("rect")?.setAttribute("fill", this.fill);
|
||||||
this.querySelector("svg")?.setAttribute("width", this.size);
|
this.querySelector("svg")?.setAttribute("width", this.size);
|
||||||
this.querySelector("svg")?.setAttribute("height", this.size);
|
this.querySelector("svg")?.setAttribute("height", this.size);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue