mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-26 03:24:18 +00:00
fix container after inheritance change (#859)
* fix container after inheritance change * fix missing method test
This commit is contained in:
parent
7744404dc2
commit
11441c306c
3 changed files with 22 additions and 5 deletions
|
|
@ -28,8 +28,8 @@ function handleMouseEventDispatch(node, event, eventName) {
|
|||
);
|
||||
const clientX = event.clientX;
|
||||
const clientY = event.clientY;
|
||||
const x = clientX - container.getleft();
|
||||
const y = clientY - container.gettop();
|
||||
const x = clientX - (Number(container.attributes.x) || 0);
|
||||
const y = clientY - (Number(container.attributes.y) || 0);
|
||||
node.js_trigger(eventName, x, y);
|
||||
|
||||
if (event.nativeEvent.type === "mousemove") {
|
||||
|
|
@ -468,7 +468,10 @@ function XmlNode({ node }) {
|
|||
const Component = NODE_NAME_TO_COMPONENT[name];
|
||||
const childNodes = node.children || [];
|
||||
const children = childNodes.map(
|
||||
(childNode, i) => childNode.visible && <XmlNode key={i} node={childNode} />
|
||||
(childNode, i) =>
|
||||
(childNode.visible || childNode.visible === undefined) && (
|
||||
<XmlNode key={i} node={childNode} />
|
||||
)
|
||||
);
|
||||
if (Component == null) {
|
||||
console.warn("Unknown node type", name);
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ Array [
|
|||
"Container.enumlayout",
|
||||
"Container.getcurlayout",
|
||||
"Container.getnumlayouts",
|
||||
"Container.hide",
|
||||
"Container.isdynamic",
|
||||
"Container.onbeforeswitchtolayout",
|
||||
"Container.onhidelayout",
|
||||
|
|
@ -146,7 +145,6 @@ Array [
|
|||
"Container.onswitchtolayout",
|
||||
"Container.setname",
|
||||
"Container.setxmlparam",
|
||||
"Container.show",
|
||||
"Container.switchtolayout",
|
||||
"Container.toggle",
|
||||
"DropDownList.additem",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,12 @@ import MakiObject from "./MakiObject";
|
|||
import { findDescendantByTypeAndId } from "../utils";
|
||||
|
||||
class Container extends MakiObject {
|
||||
constructor(node, parent) {
|
||||
super(node, parent);
|
||||
|
||||
this.visible = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* getclassname()
|
||||
*
|
||||
|
|
@ -12,6 +18,16 @@ class Container extends MakiObject {
|
|||
return "Container";
|
||||
}
|
||||
|
||||
show() {
|
||||
this.visible = true;
|
||||
this.parent.js_trigger("js_update");
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.visible = false;
|
||||
this.parent.js_trigger("js_update");
|
||||
}
|
||||
|
||||
getlayout(id) {
|
||||
return findDescendantByTypeAndId(this, "layout", id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue