element_cursor.erl 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. -module(element_cursor).
  2. -author('Konstantin Zakablukovsky').
  3. -include("svg.hrl").
  4. -compile(export_all).
  5. render_element(Record) ->
  6. wf_tags:emit_tag(<<"cursor">>, nitro:render(Record#cursor.body),
  7. lists:append([
  8. [
  9. {<<"id">>, Record#cursor.id},
  10. {<<"class">>, Record#cursor.class},
  11. {<<"style">>, Record#cursor.style},
  12. {<<"x">>, Record#cursor.x},
  13. {<<"y">>, Record#cursor.y},
  14. {<<"externalResourcesRequired">>, Record#cursor.externalResourcesRequired}
  15. ],
  16. svg_conditional_processing(Record),
  17. svg_core(Record),
  18. svg_xlink(Record),
  19. Record#cursor.data_fields,
  20. Record#cursor.aria_states
  21. ])).
  22. %% Common SVG attributes
  23. svg_conditional_processing(Record)-> [
  24. {<<"requiredExtensions">>, Record#cursor.requiredExtensions},
  25. {<<"requiredFeatures">>, Record#cursor.requiredFeatures},
  26. {<<"systemLanguage">>, Record#cursor.systemLanguage}
  27. ].
  28. svg_core(Record)-> [
  29. {<<"xml:base">>, Record#cursor.xmlbase},
  30. {<<"xml:lang">>, Record#cursor.xmllang},
  31. {<<"xml:space">>, Record#cursor.xmlspace}
  32. ].
  33. svg_xlink(Record)-> [
  34. {<<"xlink:href">>, Record#cursor.xlinkhref},
  35. {<<"xlink:type">>, Record#cursor.xlinktype},
  36. {<<"xlink:role">>, Record#cursor.xlinkrole},
  37. {<<"xlink:arcrole">>, Record#cursor.xlinkarcrole},
  38. {<<"xlink:title">>, Record#cursor.xlinktitle},
  39. {<<"xlink:show">>, Record#cursor.xlinkshow},
  40. {<<"xlink:actuate">>, Record#cursor.xlinkactuate}
  41. ].