---
title: viewer2d.dblclick
slug: viewer-2d/events/dblclick
docTags: 
createdAt: 2024-02-21T17:17:42.342Z
---

Invoked when the user double clicks inside the viewer.

## Example

::codepen{url="https://codepen.io/Catenda/embed/MWMBgeJ"}

## Usage

:::CodeblockTabs
```javascript
const onDoubleClick = function (event) {
  const { intersects } = event;
  console.log("viewer2d.dblclick", "intersects:", intersects);
};

viewer2d.addEventListener("viewer2d.dblclick", onDoubleClick);
```

jQuery

```javascript
const onDoubleClick = function (event, location, objectId) {
  console.log("viewer2d.dblclick", "location:", location, "objectId:", objectId);
};

$("#viewer-2d").on("viewer2d.dblclick", onDoubleClick);
```
:::

## Parameters

### onDoubleClick

::::Tabs
:::Tab{title="JS"}
Function called when the user double clicks inside the viewer.

| **Type**                  |
| ------------------------- |
| `(event: Object) => Void` |

**event**

| **Name**     | **Type** | **Description**                              |
| ------------ | -------- | -------------------------------------------- |
| `intersects` | Object   | Object below the cursor, `undefined` if none |
| `srcEvent`   | Object   | Original DOM event                           |

**intersects**

| **Name**   | **Type**                                | **Description**                         |
| ---------- | --------------------------------------- | --------------------------------------- |
| `objectId` | String                                  | Id of the object                        |
| `point`    | [Vector3](docId\:gQdK6kHl9IuzRieGxVDD0) | Intersection point of the object        |
| `normal`   | [Vector3](docId\:gQdK6kHl9IuzRieGxVDD0) | Normal vector at the intersection point |
:::

:::Tab{title="jQuery"}
Function called when the user double clicks inside the viewer.

| **Type**                                                               |
| ---------------------------------------------------------------------- |
| `(event: Object, location: Object, objectId: String?) => Boolean/Void` |

**event**

[jQuery.Event](https://api.jquery.com/category/events/event-object/)

**location**

Coordinates of the position clicked.

| **Name** | **Type** | **Description**                            |
| -------- | -------- | ------------------------------------------ |
| `x`      | Number   | X coordinate of position clicked in pixels |
| `y`      | Number   | Y coordinate of position clicked in pixels |
| `z`      | Number   | Height of the last storey shown in meters  |

**objectId**

Id of the object clicked, `undefined` if no object under cursor.
:::
::::

