mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-21 09:09:01 +00:00
fix ghost logic, add defaults and type conversion (#904)
This commit is contained in:
parent
7c26257381
commit
803b89d9e0
2 changed files with 24 additions and 1 deletions
|
|
@ -153,7 +153,7 @@ function GuiObjectEvents({ node, children }) {
|
|||
}}
|
||||
style={{
|
||||
opacity: alpha == null ? 1 : alpha / 255,
|
||||
pointerEvents: ghost === 1 ? "none" : null,
|
||||
pointerEvents: ghost ? "none" : null,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
|
@ -329,6 +329,7 @@ function Button({
|
|||
y,
|
||||
downImage,
|
||||
tooltip,
|
||||
ghost,
|
||||
node,
|
||||
}) {
|
||||
const [down, setDown] = React.useState(false);
|
||||
|
|
@ -373,6 +374,7 @@ function Button({
|
|||
width: Number(img.w),
|
||||
height: Number(img.h),
|
||||
backgroundImage: `url(${img.imgUrl})`,
|
||||
pointerEvents: ghost ? "none" : null,
|
||||
}}
|
||||
>
|
||||
<XmlChildren node={node} />
|
||||
|
|
|
|||
|
|
@ -11,10 +11,31 @@ class GuiObject extends MakiObject {
|
|||
constructor(node, parent, annotations, store) {
|
||||
super(node, parent, annotations, store);
|
||||
|
||||
this._setAttributeDefaults(this.attributes);
|
||||
this._convertAttributeTypes(this.attributes);
|
||||
|
||||
this.visible = true;
|
||||
this._selectorCache = new Map();
|
||||
}
|
||||
|
||||
_setAttributeDefaults(attributes) {
|
||||
if (attributes.alpha == null) {
|
||||
attributes.alpha = "255";
|
||||
}
|
||||
if (attributes.ghost == null) {
|
||||
attributes.ghost = "0";
|
||||
}
|
||||
}
|
||||
|
||||
_convertAttributeTypes(attributes) {
|
||||
if (attributes.alpha != null) {
|
||||
attributes.alpha = Number(attributes.alpha);
|
||||
}
|
||||
if (attributes.ghost != null) {
|
||||
attributes.ghost = !!Number(attributes.ghost);
|
||||
}
|
||||
}
|
||||
|
||||
_useUidSelector(selector) {
|
||||
// TODO: use memoize for this
|
||||
if (!this._selectorCache.has(selector)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue