addObjectImage
Displays an image on the pad. The image can optionally be clickable, in which case it generates click events when tapped with the pen.
wizCtl.addObjectImage(id, x, y, image, options)
| Parameter | Description |
|---|---|
| id | String that identifies the image.
Supports the same reserved values as button objects: |
| x, y | Position of the top-left corner of the object on the pad display.
|
| image | Image to display, for example a loaded HTMLImageElement. |
| options | Object with the dimensions used to draw the image. (Optional)
|
| Return values |
|---|
| The added image object. Throws an exception if an error occurs. |
The returned object has the following properties:
| Property | Description |
|---|---|
rect | The displayed area, with upperLeftXpixel, upperLeftYpixel, lowerRightXpixel and lowerRightYpixel. |
onClick | Function called when the image is tapped. It receives the object as a parameter and returns a boolean. Return true to stop capturing pen input, or false to continue. |
The following example uses an image as a clickable button:
const acceptObj = wizCtl.addObjectImage("next", "right", "bottom", acceptImage, {width: 80, height: 40});
acceptObj.onClick = async function() {
await showNextStep();
return true;
}