Skip to content

Commit 8fea34e

Browse files
Merge pull request #73 from dynamsoft-docs/preview
update to internal commit 7bf8aae6
2 parents 9edf2c9 + a5ddac7 commit 8fea34e

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

programming/javascript/api-reference/index.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,15 @@ breadcrumbText: API Reference
104104

105105
### UI
106106

107-
| Name | Description |
108-
| ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
109-
| [convertToPageCoordinates](./ui.md#convertToPageCoordinates) | Converts coordinates from the video's coordinate system to coordinates relative to the whole page. |
110-
| [convertToClientCoordinates](./ui.md#convertToClientCoordinates) | Converts coordinates from the video's coordinate system to coordinates relative to the viewport. |
111-
| [setCameraView](./ui.md#setCameraView) | Sets the `CameraView` instance to be used with the `CameraEnhancer`. |
112-
| [getCameraView](./ui.md#getCameraView) | Retrieves the current `CameraView` instance associated with the `CameraEnhancer`. |
113-
| [getVideoEl](./ui.md#getVideoEl) | Retrieves the HTMLVideoElement used by the `CameraEnhancer` for displaying the camera feed. |
107+
| Name | Description |
108+
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
109+
| [convertToPageCoordinates](./ui.md#convertToPageCoordinates) | Converts coordinates from the video's coordinate system to coordinates relative to the whole page. |
110+
| [convertToClientCoordinates](./ui.md#convertToClientCoordinates) | Converts coordinates from the video's coordinate system to coordinates relative to the viewport. |
111+
| [convertToScanRegionCoordinates](./ui.md#convertToScanRegionCoordinates) | Converts coordinates from the video's coordinate system to coordinates relative to the scan region. |
112+
| [convertToContainCoordinates](./ui.md#convertToClientCoordinates) | Converts coordinates from the `fit: cover` to `fit: contain` mode. |
113+
| [setCameraView](./ui.md#setCameraView) | Sets the `CameraView` instance to be used with the `CameraEnhancer`. |
114+
| [getCameraView](./ui.md#getCameraView) | Retrieves the current `CameraView` instance associated with the `CameraEnhancer`. |
115+
| [getVideoEl](./ui.md#getVideoEl) | Retrieves the HTMLVideoElement used by the `CameraEnhancer` for displaying the camera feed. |
114116

115117
### Auxiliary
116118

programming/javascript/api-reference/ui.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ permalink: /programming/javascript/api-reference/ui.html
1717
| [convertToScanRegionCoordinates](#convertToScanRegionCoordinates) | Converts coordinates from the video's coordinate system to coordinates relative to the scan region. |
1818
| [convertToPageCoordinates](#convertToPageCoordinates) | Converts coordinates from the video's coordinate system to coordinates relative to the whole page. |
1919
| [convertToClientCoordinates](#convertToClientCoordinates) | Converts coordinates from the video's coordinate system to coordinates relative to the viewport. |
20+
| [convertToContainCoordinates](#convertToClientCoordinates) | Converts coordinates from the `fit: cover` to `fit: contain` mode. |
2021
| [setCameraView](#setCameraView) | Sets the `CameraView` instance to be used with the `CameraEnhancer`. |
2122
| [getCameraView](#getCameraView) | Retrieves the current `CameraView` instance associated with the `CameraEnhancer`. |
2223
| [getVideoEl](#getVideoEl) | Retrieves the HTMLVideoElement used by the `CameraEnhancer` for displaying the camera feed. |
@@ -101,6 +102,33 @@ cameraEnhancer.convertToClientCoordinates({x: 0, y: 0});
101102

102103
[Point](https://www.dynamsoft.com/capture-vision/docs/web/programming/javascript/api-reference/core/basic-structures/point.html)
103104

105+
## convertToContainCoordinates
106+
107+
Converts coordinates from the `fit: cover` to `fit: contain` mode.
108+
This is useful for positioning HTML elements in relation to the video element on the screen, regardless of page scrolling.
109+
110+
```typescript
111+
convertToContainCoordinates(point: Point): Point;
112+
```
113+
114+
**Parameters**
115+
116+
`point`: a `Point` object representing the x and y coordinates within the video's coordinate system.
117+
118+
**Return value**
119+
120+
A `Point` object representing the converted x and y coordinates relative to the viewport.
121+
122+
**Code Snippet**
123+
124+
```javascript
125+
cameraEnhancer.convertToContainCoordinates({x: 0, y: 0});
126+
```
127+
128+
**See also**
129+
130+
[Point](https://www.dynamsoft.com/capture-vision/docs/web/programming/javascript/api-reference/core/basic-structures/point.html)
131+
104132
## setCameraView
105133

106134
Sets the `CameraView` instance to be used with the `CameraEnhancer`.

0 commit comments

Comments
 (0)