From 0321d4a606d3613b5a075a2e91f71a8cdf471d07 Mon Sep 17 00:00:00 2001 From: Greg Fodor <gfodor@gmail.com> Date: Fri, 9 Nov 2018 22:31:51 +0000 Subject: [PATCH] Show different colors on pin vs unpin, fix issue with hovers not working because of custom shader --- src/components/pin-networked-object-button.js | 2 ++ src/hub.html | 4 ++-- src/utils/media-utils.js | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/pin-networked-object-button.js b/src/components/pin-networked-object-button.js index 8f70dee18..3b7ae88cc 100644 --- a/src/components/pin-networked-object-button.js +++ b/src/components/pin-networked-object-button.js @@ -61,6 +61,8 @@ AFRAME.registerComponent("pin-networked-object-button", { const isPinned = this.targetEl.getAttribute("pinnable") && this.targetEl.getAttribute("pinnable").pinned; this.labelEl.setAttribute("text", "value", isPinned ? "un-pin" : "pin"); + this.el.setAttribute("text-button", "backgroundColor", isPinned ? "#fff" : "#ff0520"); + this.el.setAttribute("text-button", "backgroundHoverColor", isPinned ? "#aaa" : "#cc0515"); this.el.parentNode.querySelectorAll(this.data.hideWhenPinnedSelector).forEach(hideEl => { hideEl.setAttribute("visible", !isPinned); diff --git a/src/hub.html b/src/hub.html index 9344cbe2c..9e63cb70f 100644 --- a/src/hub.html +++ b/src/hub.html @@ -257,8 +257,8 @@ haptic:#player-right-controller; textHoverColor: #fff; textColor: #fff; - backgroundHoverColor: #ff0434; - backgroundColor: #ff3464;" + backgroundHoverColor: #cc0515; + backgroundColor: #ff0520;" slice9=" width: 0.45; height: 0.2; diff --git a/src/utils/media-utils.js b/src/utils/media-utils.js index 7a05a2c72..bf84baa92 100644 --- a/src/utils/media-utils.js +++ b/src/utils/media-utils.js @@ -156,6 +156,7 @@ export function injectCustomShaderChunks(obj) { // hover/toggle state, so for now just skip these while we figure out a more correct // solution. if (object.el.classList.contains("ui")) return; + if (object.el.getAttribute("text-button")) return; object.material = object.material.clone(); object.material.onBeforeCompile = shader => { -- GitLab