informatics-isi-edu / openseadragon-viewer

2D viewer with openseadragon
Apache License 2.0
5 stars 2 forks source link

Refactor svg read write #39

Closed rastogi-bhavya closed 4 years ago

rastogi-bhavya commented 4 years ago

Changes in accordance to #38

  1. Added default color (red): This is done to make sure that in case there is an SVG uploaded by the user which does not have stroke defined, then at least software will be able to show the SVG components.

  2. Read Corrections: Changes were made to how the software read an SVG.

    • When the object is created, the set of attributes are initialized by their default value.
    • When the SVG object is read this._attrs is updated with the new values.
    • For style, the individual properties are also added as separate values, to make updates easier. (the style is also added to this._attrs)
  3. Displaying an SVG: When displaying the SVG, now the style attribute is no longer used, as all of its properties are already in 'this._attrs

  4. Write Corrections: When writing attributes back, a simple which is made to see if that attribute is present in style, if yes then that property in style is updated, else the attribute is written back. The style is added at the end, after all other attributes have been written.

Added an annotation-utils file for re-usability of code.

rastogi-bhavya commented 4 years ago
  1. Made the names consistent
  2. Fixed the code regarding _addedAttrs
  3. Added both the test cases.
  4. Did the regression testing. All worked fine.