Customizing an Ink Overlay

Description

The Ink Overlay is defined using an html template. As a result it is easy to add new buttons to an overlay and then define new actions to execute when these custom buttons are used..

For a visual explanation on how to customize and ink overlay watch this video or follow the guide below.

Set the Project Style 

Not all project styles have the css classes necessary to run an ink overlay. Use either the iOS7, Android, or Alpha style in the 'Style name' property.

  1. In the UX Builder open the UX Properties page. In the 'UX Properties' section click the [...] button next to the 'Style name' property.

    images/ci2.png
  2. In the 'Location' menu select the 'System' option. Select the iOS7, AndroidLight, AndroidDark, or Alpha style in the style list. Click OK.

    images/ci3.png

Create an Ink Control with an Overlay 

  1. In the UX Builder on the UX Controls page open the 'Data Controls' menu. Click on the [Ink] option to add an ink control to the component.

    images/ci4.png
  2. Highlight the ink control in the controls tree. In the properties list on the right, scroll down to the 'Ink Properties' section. Click the [...] button next to the 'Ink properties' property.

    images/ci5.png
  3. In the 'Ink Control' dialog click the big 'Ink Control Genie...' button at the top of the dialog.

    images/ci6.png
  4. On the 'Layout' tab menu select the 'Note taking - default' option on the right. Click OK and OK again.

    images/ci7.png
  5. Run the component in 'Live Preview'. The Overlay should be visible.

    images/ci8.png

Add a Button to the Overlay 

  1. Return to the UX Controls pag, highlight the ink control in the controls tree, and click the [...] button next to the 'Ink properties' property to open the ink properties dialog again.

    images/ci9.png
  2. Scroll down to the 'Ink Editor' properties section. The 'Has overlay' property should already be checked. Click the [...] button next to the 'Overlay' property.

    images/ci10.png
  3. The 'Editor Overlay' dialog should appear. Open the 'Overlay' tab. This tab contains the html for the overlay that was generated when we used the ink genie. Add the following <div> to the overlay under the existing button definitions. Click OK.

    <div style="position: absolute; left: 60px;">button</div>
    images/ci11.png
  4. Run the component in Live Preview. The new button should now appear in the Ink Overlay. However, it is only labeled as 'button' and doesn't' actually do anything.

    images/ci12.png

Add an Action to the Button 

  1. Highlight the ink control in the controls tree a click on the 'Ink properties' property to reopen the Ink Control dialog.

    images/ci13.png
  2. Click the [...] button next to the 'Overlay' property to open the 'Editor Overlay' dialog again.

    images/ci14.png
  3. On the 'Overlay' tab locate the <div> that contains the button you defined. Inside the <div> tag assign the button to an a5-item named 'button1': a5-item = "button1". Like this:

    <div style="position: absolute; left: 60px;" a5-item = "button1">button</div>
    images/ci15.png
  4. Click on the 'Editor Overlay' dialog's 'Items' tab to open it.

    images/ci16.png
  5. Click the 'Add' button on the items tab.

    images/ci17.png
  6. Next to the new item's 'Name' property type 'button1'.

    images/ci18.png
  7. Click the [...] button next to the 'onClick' property.

    images/ci19.png
  8. Define the following onClick event definition. Click OK, OK, and OK again.

    alert('New overlay tool');
    images/ci20.png
  9. Run the component in Live Preview. When you click on the custom button now you should see the javascript alert fire.

    images/ci21.png

Use an Icon for the Button 

  1. Open the UX Properties page. Scroll down to the 'CSS/SCG' section. Click the [...] button next to the 'Local SVG definitions' property.

    images/ci22.png
  2. Click the 'Import SVG definition' hyperlink at the bottom of the 'SVG Text' dialog.

    images/ci23.png
  3. Click the 'Insert sample' hyperlink and give the sample the icon name 'svg_'. Click OK and OK again.

    images/ci24.png
  4. On the UX Controls page open the 'Other Controls' menu. Click on the [Image] option to add an image to the component.

    images/ci25.png
  5. Highlight the image in the controls tree. In the properties list on the right click the [...] button next to the 'Image name' property in the 'Image Properties' section.

    images/ci26.png
  6. Select the 'SVG Icon' radio button option in the Specify Image dialog and click 'Select'.

    images/ci27.png
  7. The sample SVG icon that was generated from the 'Local SVG definitions' property should appear under the 'Local SVG Icons' heading. Highlight the icon.

    images/ci28.png
  8. Click the up arrow on the 'Fill color' control in the top right corner of the 'SVG Icon' dialog. Pick a color from the color picker to change the color of the icon.

    images/ci29.png
    The fill color control will change the color of all of the icons in the dialog. This should not change the appearance of icons in your project that are defined elsewhere. Changing the color here only impacts the current instance of the selected icon.
  9. Click OK once. In the 'Specify Image' dialog copy the generated path for your icon that appears next to the 'Image name' control, then click OK.

    svgIcon=#svg_:24{ fill: #3589ce;}
    images/ci30.png
  10. Highlight the [Image] control in the controls tree and click the red 'X' icon in the Controls page toolbar to delete the image control.

    images/ci31.png
  11. Highlight the ink control in the controls tree.

    images/ci32.png
  12. In the properties list click on the 'Ink properties' property to open the Ink Control dialog.

    images/ci33.png
  13. Click the [...] button next to the 'Overlay' property in the Ink Editor section.

    images/ci34.png
  14. Find the button that was defined previously and replace the text definition with the svg icon that you copied from the 'Image name' property. The svg icon should be placed inside an <img> tag as its source 'src'. The resulting image tag should look like this:

    <img src="svgIcon=#svg_:24{ fill: #3589ce;}">
    images/ci35.png
  15. Click OK and OK again. Run the component in Live Preview. The custom button that was added to the overlay should now appear as an icon.

    images/ci36.png

See Also