You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: programming/features/ui-customization-js.md
+9-17Lines changed: 9 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,39 +10,31 @@ noTitleIndex: true
10
10
11
11
# Customize the UI
12
12
13
-
When you want to customize the UI, we can leverage the extensive customization features provided by Dynamsoft Camera Enhancer (DCE) to achieve this.
14
-
15
13
## Use the built-in UI
16
14
17
-
DCE includes several pre-defined UIs in the `DCE-LIB-PACKAGE/dist/xxxx.ui.html` (or `node_modules/dynamsoft-camera-enhancer/dist/xxxx.ui.html`).
18
-
If you are using a CDN, please find [`dce.ui.html`](https://cdn.jsdelivr.net/npm/dynamsoft-camera-enhancer@latest/dist/dce.ui.html) and [`dce.mobile-native.ui.html`](https://cdn.jsdelivr.net/npm/dynamsoft-camera-enhancer@latest/dist/dce.mobile-native.ui.html).
19
-
20
-
*`dce.ui.html`: The default UI used by CameraView.createInstance() for simple use cases.
21
-
*`dce.mobile-native.ui.html`: A mobile-inspired UI with auto flash, suitable for most websites. Activate it with `CameraView.createInstance('@engineResourcePath/dce.mobile-native.ui.html')`.
22
-
23
-
When `cameraEnhancer.open()` is called, the UI elements are dynamically bound to functions based on their class names, such as `dce-xxxx`.
15
+
The pre-defined UI provided by Dynamsoft Barcode Reader can be found at [`dce.ui.xml`](https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@latest/dist/ui/dce.ui.xml). The main UI elements in this file are prefixed with `dce-` and they are dynamically bound to functions when the application initiates.
24
16
25
17
## Modify the UI dynamically
26
18
27
-
To customize the UI, call `view.getUIElement()` to access the HTMLElement containing all UI elements. Before `cameraEnhancer.open()`, you can modify the UI by editing CSS, adding/removing elements, or restructuring the HTML. This usually works without issues, though testing is recommended.
19
+
To customize the UI, call `cameraView.getUIElement()` to access the `HTMLElement` that contains all UI components. Before calling `cameraEnhancer.open()`, you can modify the UI by editing CSS, adding or removing elements, or restructuring the HTML.
28
20
29
-
After `cameraEnhancer.open()`, UI adjustments are possible via JavaScript, but handle elements with `dce-`prefixed class names carefully, as they may be linked to specific logic.
21
+
After `cameraEnhancer.open()`, UI adjustments are still possible via JavaScript. However, handle elements with class names prefixed with `dce-` carefully, as they may be tied to specific internal logic.
30
22
31
23
## Define the UI in a separate HTML
32
24
33
-
For less dynamic but more structured customization, create a copy of the desired `xxxx.ui.html`, modify it as needed, and store it in your project's `public` folder. Use this customized UI with `CameraView.createInstance('PATH-TO/xxxx.ui.html')`.
25
+
For less dynamic but more structured customization, create a copy of `dce.ui.xml`, modify it as needed, and store it in your project. Use this customized UI with `Dynamsoft.DCE.CameraView.createInstance('PATH-TO/xxxx.ui.xml')`.
34
26
35
27
## Integrate HTML into Your Project
36
28
37
29
Alternatively, `CameraView.createInstance()` accepts an `HTMLElement` directly. This allows you to build and manage the UI within your webpage. For example, set the UI using `CameraView.createInstance(document.getElementById('my-custom-ui'))`.
38
30
39
-
Let's see the following example.
31
+
Let's look at the following example.
40
32
41
-
**Practise: customize base on `dce.ui.html`**
33
+
**Practice: Customize Based on `dce.ui.xml`**
42
34
43
-
Start by opening dce.ui.html in your editor to review its content. You can copy several elements from this file.
35
+
Start by opening `dce.ui.xml` in your editor to review its contents. You can copy several elements from this file as needed.
44
36
45
-
Next, create a new HTML page, beginning by embedding only the video:
37
+
Next, create a new HTML page, starting by embedding only the video:
@@ -94,4 +86,4 @@ Next, add the camera and resolution list. If the classes match the default ones
94
86
</select>
95
87
```
96
88
97
-
> Ensure the selected resolution is supported by the camera. If not, the closest supported resolution will be used. The `dce-opt-gotResolution` class shows the **actual resolution**.
89
+
> Ensure the selected resolution is supported by the camera. If not, the closest supported resolution will be used. The `dce-opt-gotResolution` class shows the **actual resolution**.
0 commit comments