diff --git a/src/components/block-button.js b/src/components/block-button.js new file mode 100644 index 0000000000000000000000000000000000000000..5ea1b9fb34eebdc540da6a1343af64ba964eb004 --- /dev/null +++ b/src/components/block-button.js @@ -0,0 +1,18 @@ +AFRAME.registerComponent("block-button", { + init() { + this.el.addEventListener("click", this.onClick); + const owner = (function getOwner(el) { + if (el.firstUpdateData) { + return el.firstUpdateData.owner; + } + if (el.parentEl) { + return getOwner(el.parentEl); + } + return null; + })(this.el); + + this.onClick = () => { + console.log("blockUser " + owner); + }; + } +}); diff --git a/src/hub.js b/src/hub.js index 9728c6217877071021544431fa0134697329a93d..5625673757ce051f569c55ac0498b8fd632a423a 100644 --- a/src/hub.js +++ b/src/hub.js @@ -53,6 +53,7 @@ import "./components/hud-controller"; import "./components/freeze-controller"; import "./components/icon-button"; import "./components/text-button"; +import "./components/block-button"; import "./components/visible-while-frozen"; import "./components/stats-plus";