Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Cannot make DrawLabel item display as an underlined hyperlink.

    Tried adding a style, but this throws an exception. Using SmartGWT 6.0. Is there an easy way to add the test-decoration:underline to a DrawLabel drawing item. I need to show and add hyperlinks within my 2D drawing. Thanks.

    #2
    Sorry for the delay on this, we were discussing several possible approaches for you.

    With the default DrawPane.drawingType, which uses the native <canvas> element, there is no support for applying something like text-decoration underline - you'd literally have to draw the line under the text yourself.

    In the alternative SVG drawingType, CSS support is available with caveats, but existing APIs don't give you a clean way to apply text-decoration. You would need to use an unsupported hack like smuggling it into the CSS for font-weight like so:

    fontWeight: "bold' text-decoration='underline"

    We've already started on adding a few more APIs to make this cleaner for 6.1. In the meantime, the hack above is one approach, another is to float actual Label components (as in the subclass of Canvas) over the DrawPane. This may or may not be difficult depending on whether you need to do scaling and panning.

    Comment


      #3
      Please note that we've added some new features in SGWT 6.1d for DrawPanes configured for SVG:
      • you can set DrawLabel.styleName to apply an CSS class to the SVG element representing a DrawLabel
      • you can set DrawLabel.escapeContents to false to insert raw SVG into the SVG <text> element representing a DrawLabel

      If a CSS class is applied with styleName, you must explicitly set any font attributes for the DarwLabel, such as DrawLabel.fontSize to 0 or null in order to have the CSS default picked up. Note also that auto-sizing/auto-centering doesn't work for the raw SVG.
      Last edited by Isomorphic; 2 Feb 2017, 10:51.

      Comment

      Working...
      X