Double click for an event (rather than pointerdown)

Hi, I’ve got the html working fine, and when I put my full model in there it’s great but I just need to change the single click code I have to double click. I plugged in two small buildings into the html I shared yesterday and it isn’t quite working as it should with them buildings in.

I almost got it sorted yesterday but it wasn’t quite there the popups were appearing but it will pulling in the wrong data from my website. I can’t really share my full code as it has my model data in it. Looking forward to sharing the final website and scene to the forum soon though when it’s live. It’s theblockcity.com if you’re interested. I just haven’t loaded the model to it yet.

EDIT: I’ve just got it working :slight_smile: :slight_smile:

scene.onPointerObservable.add((pointerInfo) => {
switch (pointerInfo.type) {
case BABYLON.PointerEventTypes.POINTERDOUBLETAP:
if (pointerInfo.pickInfo.hit) {
if (pointerInfo.event.button === 0) {
if (pointerInfo.pickInfo.hit) {
console.log("pointerInfo.pickInfo.hit: " + pointerInfo.pickInfo.pickedMesh.name);
if (meshContent[pointerInfo.pickInfo.pickedMesh.name]) {
console.log(“In the list”); // YES! Our mesh is in the list (ground is not there)

                    toggleModal(); // If there was no modal before, it will be shown; it there was modal already, it will be invisible

							  
                    console.log("Mesh: " + pointerInfo.pickInfo.pickedMesh.name + "; Content: " + meshContent[pointerInfo.pickInfo.pickedMesh.name]);

                       document.getElementById("modal-iframe").innerHTML = "<iframe src=\"https://"+meshContent[pointerInfo.pickInfo.pickedMesh.name] + "\" title=\"Modal\"frameborder=\"0\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:40px;left:0px;right:0px;bottom:0px\" height=\"100%\" width=\"100%\"></iframe>"

                    // You can also use iframe here to display any content. All you need is to bind iframe src value with mesh in our meshContent list
                    // and then change the code above to load the iframe src into the modal
                              
                            }
                            // Later it is possible to simplify this portion with some custom function
                        }
                    }
            }
        }});
1 Like