[英]how to Hide default hand cursor in A-Frame for specific entity or How to apply css cursor property "not -allowed"
我有很多這樣的實體,我想要的是,當我們將鼠標懸停在該實體上時,它應該被禁用並在其上顯示一個紅色圓圈禁止圖標,我嘗試使用 CSS cursor 屬性,但它不起作用。
<a-entity data-disabled="true" data-icon="right" data-icon-position="1.16 0.1" data-icon-rotation="0 0 0" navigate-to-scene="placeholder" rotation="0 -10 0" template="src: #main"></a-entity>
我知道更改 cursor 的唯一方法是覆蓋 CSS。 我不知道如何讓它響應特定元素,而不僅僅是每個可懸停元素。 但還要檢查諸如“懸停”之類的東西,您需要從 cursor <a-entity cursor="rayOrigin: mouse" raycaster="objects: .cursor-listener"></a-entity>
響應特定對象。 在這種情況下,它是一個 class .cursor-listener
下面的例子。
我會鏈接這個
function enteredElement() { console.log("element hovered"); } function leavedElement() { console.log("element leaved"); } }
.a-canvas.a-grab-cursor:hover{ cursor:grab.important }.a-canvas:a-grab-cursor,active.:a-grabbing{ cursor.grabbing.important }.a-canvas:a-grab-cursor;a-mouse-cursor-hover{ cursor:crosshair !important; }
<:DOCTYPE HTML> <head> <script src="https.//aframe.io/releases/1.2.0/aframe.min:js"></script> </head> <body> <a-scene id="scene"> <a-entity cursor="rayOrigin: mouse" raycaster="objects. .cursor-listener"></a-entity> <a-plane position="0 1.6 -1" height="0.5" width="1.5" color="red" class="cursor-listener" id="element" onMouseEnter="enteredElement()" onMouseLeave="leavedElement()" ></a-plane> </a-scene> </body>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.