Skip to content

Commit 5f14fb2

Browse files
Merge pull request #814 from dynamsoft-docs/Tom-Dynamsoft-patch-fix-issue-withUIcustomization
Update ui-customization-js.md
2 parents b941bed + 6680df8 commit 5f14fb2

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

programming/features/ui-customization-js.md

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,31 @@ noTitleIndex: true
1010

1111
# Customize the UI
1212

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-
1513
## Use the built-in UI
1614

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.
2416

2517
## Modify the UI dynamically
2618

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.
2820

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.
3022

3123
## Define the UI in a separate HTML
3224

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')`.
3426

3527
## Integrate HTML into Your Project
3628

3729
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'))`.
3830

39-
Let's see the following example.
31+
Let's look at the following example.
4032

41-
**Practise: customize base on `dce.ui.html`**
33+
**Practice: Customize Based on `dce.ui.xml`**
4234

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.
4436

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:
4638

4739
```html
4840
<div id="enhancerUIContainer" style="width:1280px;height:720px;background:#ddd;" >
@@ -94,4 +86,4 @@ Next, add the camera and resolution list. If the classes match the default ones
9486
</select>
9587
```
9688

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

Comments
 (0)