diff --git a/cypress/integration/ui/__snapshots__/scenario1.js.snap b/cypress/integration/ui/__snapshots__/scenario1.js.snap index a91e1f5b..da852965 100644 --- a/cypress/integration/ui/__snapshots__/scenario1.js.snap +++ b/cypress/integration/ui/__snapshots__/scenario1.js.snap @@ -28,8 +28,7 @@ exports[`use all parts of svg-edit > check tool_shape #0`] = ` fill="#FF0000" id="svg_1" stroke="#000000" - stroke-width="5" - transform="rotate(43.2545 208.997 209.008)" + transform="rotate(48.8014 208.997 209.008)" > @@ -52,8 +51,7 @@ exports[`use all parts of svg-edit > check tool_image #0`] = ` fill="#FF0000" id="svg_1" stroke="#000000" - stroke-width="5" - transform="rotate(43.2545 208.997 209.008)" + transform="rotate(48.8014 208.997 209.008)" > check tool_circle #0`] = ` opacity="0.5" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_fhellipse #0`] = ` id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_fhellipse #0`] = ` rx="60" ry="50" stroke="#000000" - stroke-width="5" > check tool_ellipse #0`] = ` id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_ellipse #0`] = ` rx="60" ry="50" stroke="#000000" - stroke-width="5" > check tool_ellipse #0`] = ` rx="55" ry="25" stroke="#000000" - stroke-width="5" > check tool_circle_change_fill_color #0`] = id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_circle_change_fill_color #0`] = rx="60" ry="50" stroke="#000000" - stroke-width="5" > check tool_circle_change_fill_color #0`] = rx="55" ry="25" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" > @@ -204,7 +195,6 @@ exports[`use all parts of svg-edit > check tool_circle_change_opacity #0`] = ` id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_circle_change_opacity #0`] = ` rx="60" ry="50" stroke="#000000" - stroke-width="5" > check tool_circle_change_opacity #0`] = ` rx="55" ry="25" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" > @@ -250,7 +238,6 @@ exports[`use all parts of svg-edit > check tool_ellipse_change_rotation #0`] = ` id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_ellipse_change_rotation #0`] = ` rx="60" ry="50" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" > check tool_ellipse_change_rotation #0`] = ` rx="55" ry="25" stroke="#000000" - stroke-width="5" transform="rotate(25 114 189)" > @@ -297,7 +282,6 @@ exports[`use all parts of svg-edit > check tool_ellipse_change_blur #0`] = ` id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_ellipse_change_blur #0`] = ` rx="60" ry="50" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" > check tool_ellipse_change_blur #0`] = ` rx="55" ry="25" stroke="#000000" - stroke-width="5" transform="rotate(25 114 189)" > @@ -350,7 +332,6 @@ exports[`use all parts of svg-edit > check tool_ellipse_change_cx_cy_coordinate id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_ellipse_change_cx_cy_coordinate rx="60" ry="50" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" > check tool_ellipse_change_cx_cy_coordinate rx="55" ry="25" stroke="#000000" - stroke-width="5" transform="rotate(25 139 214)" > @@ -403,7 +382,6 @@ exports[`use all parts of svg-edit > check tool_ellipse_change_rx_ry_radius #0`] id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_ellipse_change_rx_ry_radius #0`] rx="60" ry="50" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" > check tool_ellipse_change_rx_ry_radius #0`] rx="80" ry="50" stroke="#000000" - stroke-width="5" transform="rotate(25 139 214)" > @@ -458,7 +434,6 @@ exports[`use all parts of svg-edit > check tool_ellipse_bring_to_back #0`] = ` rx="60" ry="50" stroke="#000000" - stroke-width="5" > check tool_ellipse_bring_to_back #0`] = ` id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_ellipse_bring_to_back #0`] = ` rx="80" ry="50" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0) rotate(25 139 214)" > @@ -508,7 +481,6 @@ exports[`use all parts of svg-edit > check tool_ellipse_bring_to_front #0`] = ` id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_ellipse_bring_to_front #0`] = ` rx="80" ry="50" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0) rotate(25 139 214)" > check tool_ellipse_bring_to_front #0`] = ` rx="60" ry="50" stroke="#000000" - stroke-width="5" > @@ -560,7 +530,6 @@ exports[`use all parts of svg-edit > check tool_ellipse_clone #0`] = ` id="svg_1" r="111.8034" stroke="#000000" - stroke-width="5" > check tool_ellipse_clone #0`] = ` rx="80" ry="50" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0) rotate(25 139 214)" > check tool_ellipse_clone #0`] = ` rx="60" ry="50" stroke="#000000" - stroke-width="5" > check tool_ellipse_clone #0`] = ` rx="60" ry="50" stroke="#000000" - stroke-width="5" > diff --git a/cypress/integration/ui/__snapshots__/scenario3.js.snap b/cypress/integration/ui/__snapshots__/scenario3.js.snap index 9727d948..8a996817 100644 --- a/cypress/integration/ui/__snapshots__/scenario3.js.snap +++ b/cypress/integration/ui/__snapshots__/scenario3.js.snap @@ -29,7 +29,6 @@ exports[`use all parts of svg-edit > check tool_path #0`] = ` id="svg_1" opacity="0.5" stroke="#000000" - stroke-width="5" > check tool_path_change_node_xy #0`] = ` fill="#FF0000" id="svg_1" stroke="#000000" - stroke-width="5" > @@ -81,7 +79,6 @@ exports[`use all parts of svg-edit > check tool_path_change_seg_type #0`] = ` fill="#FF0000" id="svg_1" stroke="#000000" - stroke-width="5" > @@ -103,7 +100,6 @@ exports[`use all parts of svg-edit > check tool_path_change_clone_node #0`] = ` fill="#FF0000" id="svg_1" stroke="#000000" - stroke-width="5" > @@ -125,7 +121,6 @@ exports[`use all parts of svg-edit > check tool_path_openclose #0`] = ` fill="#FF0000" id="svg_1" stroke="#000000" - stroke-width="5" > diff --git a/cypress/integration/ui/__snapshots__/scenario4.js.snap b/cypress/integration/ui/__snapshots__/scenario4.js.snap index 324271c3..10a5d733 100644 --- a/cypress/integration/ui/__snapshots__/scenario4.js.snap +++ b/cypress/integration/ui/__snapshots__/scenario4.js.snap @@ -29,7 +29,6 @@ exports[`use all parts of svg-edit > check tool_rect #0`] = ` id="svg_1" opacity="0.5" stroke="#000000" - stroke-width="5" width="100" x="150" y="150" @@ -62,7 +61,6 @@ exports[`use all parts of svg-edit > check tool_fhrect #0`] = ` height="50" id="svg_1" stroke="#000000" - stroke-width="5" width="100" x="150" y="150" @@ -73,7 +71,6 @@ exports[`use all parts of svg-edit > check tool_fhrect #0`] = ` id="svg_2" opacity="0.5" stroke="#000000" - stroke-width="5" width="120" x="350" y="230" @@ -106,7 +103,6 @@ exports[`use all parts of svg-edit > check tool_square #0`] = ` height="50" id="svg_1" stroke="#000000" - stroke-width="5" width="100" x="150" y="150" @@ -116,7 +112,6 @@ exports[`use all parts of svg-edit > check tool_square #0`] = ` height="100" id="svg_2" stroke="#000000" - stroke-width="5" width="120" x="350" y="230" @@ -127,7 +122,6 @@ exports[`use all parts of svg-edit > check tool_square #0`] = ` id="svg_3" opacity="0.5" stroke="#000000" - stroke-width="5" width="50" x="225" y="300" @@ -160,7 +154,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_fill_color #0`] = ` height="50" id="svg_1" stroke="#000000" - stroke-width="5" width="100" x="150" y="150" @@ -170,7 +163,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_fill_color #0`] = ` height="100" id="svg_2" stroke="#000000" - stroke-width="5" width="120" x="350" y="230" @@ -180,7 +172,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_fill_color #0`] = ` height="50" id="svg_3" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="225" @@ -206,7 +197,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_rotation #0`] = ` height="50" id="svg_1" stroke="#000000" - stroke-width="5" transform="rotate(25 200 175)" width="100" x="150" @@ -217,7 +207,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_rotation #0`] = ` height="100" id="svg_2" stroke="#000000" - stroke-width="5" width="120" x="350" y="230" @@ -227,7 +216,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_rotation #0`] = ` height="50" id="svg_3" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="225" @@ -254,7 +242,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_blur #0`] = ` height="50" id="svg_1" stroke="#000000" - stroke-width="5" transform="rotate(25 200 175)" width="100" x="150" @@ -265,7 +252,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_blur #0`] = ` height="100" id="svg_2" stroke="#000000" - stroke-width="5" width="120" x="350" y="230" @@ -275,7 +261,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_blur #0`] = ` height="50" id="svg_3" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="225" @@ -308,7 +293,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_opacity #0`] = ` id="svg_1" opacity="0.5" stroke="#000000" - stroke-width="5" transform="rotate(25 200 175)" width="100" x="150" @@ -319,7 +303,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_opacity #0`] = ` height="100" id="svg_2" stroke="#000000" - stroke-width="5" width="120" x="350" y="230" @@ -329,7 +312,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_opacity #0`] = ` height="50" id="svg_3" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="225" @@ -362,7 +344,6 @@ exports[`use all parts of svg-edit > check tool_fhrect_change_x_y_coordinate #0` id="svg_1" opacity="0.5" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0) rotate(25 200 175)" width="100" x="150" @@ -373,7 +354,6 @@ exports[`use all parts of svg-edit > check tool_fhrect_change_x_y_coordinate #0` height="100" id="svg_2" stroke="#000000" - stroke-width="5" width="120" x="375" y="255" @@ -383,7 +363,6 @@ exports[`use all parts of svg-edit > check tool_fhrect_change_x_y_coordinate #0` height="50" id="svg_3" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="225" @@ -416,7 +395,6 @@ exports[`use all parts of svg-edit > check tool_fhrect_change_width_height #0`] id="svg_1" opacity="0.5" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0) rotate(25 200 175)" width="100" x="150" @@ -427,7 +405,6 @@ exports[`use all parts of svg-edit > check tool_fhrect_change_width_height #0`] height="125" id="svg_2" stroke="#000000" - stroke-width="5" width="145" x="375" y="255" @@ -437,7 +414,6 @@ exports[`use all parts of svg-edit > check tool_fhrect_change_width_height #0`] height="50" id="svg_3" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="225" @@ -470,7 +446,6 @@ exports[`use all parts of svg-edit > check tool_square_clone #0`] = ` id="svg_1" opacity="0.5" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0) rotate(25 200 175)" width="100" x="150" @@ -481,7 +456,6 @@ exports[`use all parts of svg-edit > check tool_square_clone #0`] = ` height="125" id="svg_2" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="145" x="375" @@ -492,7 +466,6 @@ exports[`use all parts of svg-edit > check tool_square_clone #0`] = ` height="50" id="svg_3" stroke="#000000" - stroke-width="5" width="50" x="225" y="300" @@ -502,7 +475,6 @@ exports[`use all parts of svg-edit > check tool_square_clone #0`] = ` height="50" id="svg_4" stroke="#000000" - stroke-width="5" width="50" x="245" y="320" @@ -532,7 +504,6 @@ exports[`use all parts of svg-edit > check tool_square_bring_to_back #0`] = ` height="50" id="svg_3" stroke="#000000" - stroke-width="5" width="50" x="225" y="300" @@ -544,7 +515,6 @@ exports[`use all parts of svg-edit > check tool_square_bring_to_back #0`] = ` id="svg_1" opacity="0.5" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0) rotate(25 200 175)" width="100" x="150" @@ -555,7 +525,6 @@ exports[`use all parts of svg-edit > check tool_square_bring_to_back #0`] = ` height="125" id="svg_2" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="145" x="375" @@ -566,7 +535,6 @@ exports[`use all parts of svg-edit > check tool_square_bring_to_back #0`] = ` height="50" id="svg_4" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="245" @@ -599,7 +567,6 @@ exports[`use all parts of svg-edit > check tool_square_bring_to_front #0`] = ` id="svg_1" opacity="0.5" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0) rotate(25 200 175)" width="100" x="150" @@ -610,7 +577,6 @@ exports[`use all parts of svg-edit > check tool_square_bring_to_front #0`] = ` height="125" id="svg_2" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="145" x="375" @@ -621,7 +587,6 @@ exports[`use all parts of svg-edit > check tool_square_bring_to_front #0`] = ` height="50" id="svg_4" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="245" @@ -632,7 +597,6 @@ exports[`use all parts of svg-edit > check tool_square_bring_to_front #0`] = ` height="50" id="svg_3" stroke="#000000" - stroke-width="5" width="50" x="225" y="300" @@ -664,7 +628,6 @@ exports[`use all parts of svg-edit > check tool_square_change_corner_radius #0`] id="svg_1" opacity="0.5" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0) rotate(25 200 175)" width="100" x="150" @@ -675,7 +638,6 @@ exports[`use all parts of svg-edit > check tool_square_change_corner_radius #0`] height="125" id="svg_2" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="145" x="375" @@ -688,7 +650,6 @@ exports[`use all parts of svg-edit > check tool_square_change_corner_radius #0`] rx="25" ry="25" stroke="#000000" - stroke-width="5" width="50" x="245" y="320" @@ -698,7 +659,6 @@ exports[`use all parts of svg-edit > check tool_square_change_corner_radius #0`] height="50" id="svg_3" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="225" @@ -731,7 +691,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_to_path #0`] = ` id="svg_1" opacity="0.5" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0) rotate(25 200 175)" width="100" x="150" @@ -743,7 +702,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_to_path #0`] = ` id="svg_2" opacity="0.5" stroke="#000000" - stroke-width="5" > check tool_rect_change_to_path #0`] = ` rx="25" ry="25" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="245" @@ -763,7 +720,6 @@ exports[`use all parts of svg-edit > check tool_rect_change_to_path #0`] = ` height="50" id="svg_3" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="225" @@ -795,7 +751,6 @@ exports[`use all parts of svg-edit > check tool_rect_delete #0`] = ` id="svg_2" opacity="0.5" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" > check tool_rect_delete #0`] = ` rx="25" ry="25" stroke="#000000" - stroke-width="5" transform="matrix(1 0 0 1 0 0)" width="50" x="245" diff --git a/cypress/integration/ui/__snapshots__/scenario6.js.snap b/cypress/integration/ui/__snapshots__/scenario6.js.snap index c07a8dcf..df433e92 100644 --- a/cypress/integration/ui/__snapshots__/scenario6.js.snap +++ b/cypress/integration/ui/__snapshots__/scenario6.js.snap @@ -35,8 +35,6 @@ exports[`use all parts of svg-edit > check tool_polygon #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_polygon_clone #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_polygon_clone #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > @@ -118,8 +112,6 @@ exports[`use all parts of svg-edit > check tool_polygon_change_rotation #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_polygon_change_rotation #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" transform="rotate(25 350.145 270)" > @@ -165,8 +155,6 @@ exports[`use all parts of svg-edit > check tool_polygon_change_blur #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_polygon_change_blur #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" transform="rotate(25 350.145 270)" > @@ -218,8 +204,6 @@ exports[`use all parts of svg-edit > check tool_polygon_change_opacity #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_polygon_change_opacity #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" transform="rotate(25 350.145 270)" > @@ -275,8 +257,6 @@ exports[`use all parts of svg-edit > check tool_polygon_bring_to_back #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" transform="rotate(25 350.145 270)" > check tool_polygon_bring_to_back #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > @@ -326,8 +304,6 @@ exports[`use all parts of svg-edit > check tool_polygon_bring_to_front #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_polygon_bring_to_front #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" transform="rotate(25 350.145 270)" > @@ -380,8 +354,6 @@ exports[`use all parts of svg-edit > check tool_polygon_delete #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > @@ -410,8 +382,6 @@ exports[`use all parts of svg-edit > check tool_polygon_align_to_page #0`] = ` sides="5" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > @@ -440,8 +410,6 @@ exports[`use all parts of svg-edit > check tool_polygon_change_stroke_width #0`] sides="5" stroke="#000000" stroke-width="15" - strokewidth="5" - strokecolor="#000000" > @@ -470,8 +438,6 @@ exports[`use all parts of svg-edit > check tool_polygon_change_stoke_fill_color sides="5" stroke="#0000bf" stroke-width="15" - strokewidth="5" - strokecolor="#000000" > @@ -500,8 +466,6 @@ exports[`use all parts of svg-edit > check tool_polygon_change_sides #0`] = ` sides="6" stroke="#0000bf" stroke-width="15" - strokewidth="5" - strokecolor="#000000" > diff --git a/cypress/integration/ui/__snapshots__/scenario7.js.snap b/cypress/integration/ui/__snapshots__/scenario7.js.snap index 8a8c87dd..07217ad4 100644 --- a/cypress/integration/ui/__snapshots__/scenario7.js.snap +++ b/cypress/integration/ui/__snapshots__/scenario7.js.snap @@ -38,8 +38,6 @@ exports[`use all parts of svg-edit > check tool_star #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_star_clone #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_star_clone #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > @@ -130,8 +124,6 @@ exports[`use all parts of svg-edit > check tool_star_change_rotation #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_star_change_rotation #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" transform="rotate(25 320 163.634)" > @@ -183,8 +173,6 @@ exports[`use all parts of svg-edit > check tool_star_change_blur #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_star_change_blur #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" transform="rotate(25 320 163.634)" > @@ -242,8 +228,6 @@ exports[`use all parts of svg-edit > check tool_star_change_opacity #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_star_change_opacity #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" transform="rotate(25 320 163.634)" > @@ -305,8 +287,6 @@ exports[`use all parts of svg-edit > check tool_star_bring_to_back #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" transform="rotate(25 320 163.634)" > check tool_star_bring_to_back #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > @@ -362,8 +340,6 @@ exports[`use all parts of svg-edit > check tool_star_bring_to_front #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > check tool_star_bring_to_front #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" transform="rotate(25 320 163.634)" > @@ -422,8 +396,6 @@ exports[`use all parts of svg-edit > check tool_star_delete #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > @@ -455,8 +427,6 @@ exports[`use all parts of svg-edit > check tool_star_align_to_page #0`] = ` starradiusmultiplier="3" stroke="#000000" stroke-width="5" - strokewidth="5" - strokecolor="#000000" > @@ -488,8 +458,6 @@ exports[`use all parts of svg-edit > check tool_star_change_stroke_width #0`] = starradiusmultiplier="3" stroke="#000000" stroke-width="15" - strokewidth="5" - strokecolor="#000000" > @@ -521,8 +489,6 @@ exports[`use all parts of svg-edit > check tool_star_change_stoke_fill_color #0` starradiusmultiplier="3" stroke="#0000bf" stroke-width="15" - strokewidth="5" - strokecolor="#000000" > @@ -554,8 +520,6 @@ exports[`use all parts of svg-edit > check tool_star_change_sides #0`] = ` starradiusmultiplier="3" stroke="#0000bf" stroke-width="15" - strokewidth="5" - strokecolor="#000000" > diff --git a/src/editor/extensions/ext-polystar/ext-polystar.js b/src/editor/extensions/ext-polystar/ext-polystar.js index e0c992b4..1d7dcadb 100644 --- a/src/editor/extensions/ext-polystar/ext-polystar.js +++ b/src/editor/extensions/ext-polystar/ext-polystar.js @@ -240,9 +240,9 @@ export default { }, mouseDown (opts) { if (svgCanvas.getMode() === 'star') { - const rgb = svgCanvas.getColor('fill') - const sRgb = svgCanvas.getColor('stroke') - const sWidth = svgCanvas.getStrokeWidth() + const fill = svgCanvas.getColor('fill') + const stroke = svgCanvas.getColor('stroke') + const strokeWidth = svgCanvas.getStrokeWidth() started = true newFO = svgCanvas.addSVGElementsFromJson({ element: 'polygon', @@ -256,9 +256,9 @@ export default { radialshift: $id('radialShift').value, r2: 0, orient: 'point', - fill: rgb, - strokecolor: sRgb, - strokeWidth: sWidth + fill, + stroke, + 'stroke-width': strokeWidth } }) return { @@ -266,12 +266,9 @@ export default { } } if (svgCanvas.getMode() === 'polygon') { - // const e = opts.event; - const rgb = svgCanvas.getColor('fill') - // const ccRgbEl = rgb.substring(1, rgb.length); - const sRgb = svgCanvas.getColor('stroke') - // ccSRgbEl = sRgb.substring(1, rgb.length); - const sWidth = svgCanvas.getStrokeWidth() + const fill = svgCanvas.getColor('fill') + const stroke = svgCanvas.getColor('stroke') + const strokeWidth = svgCanvas.getStrokeWidth() started = true newFO = svgCanvas.addSVGElementsFromJson({ element: 'polygon', @@ -283,9 +280,9 @@ export default { sides: $id('polySides').value, orient: 'x', edge: 0, - fill: rgb, - strokecolor: sRgb, - strokeWidth: sWidth + fill, + stroke, + 'stroke-width': strokeWidth } }) @@ -305,8 +302,8 @@ export default { const point = Number(newFO.getAttribute('point')) const orient = newFO.getAttribute('orient') const fill = newFO.getAttribute('fill') - const strokecolor = newFO.getAttribute('strokecolor') - const strokeWidth = Number(newFO.getAttribute('strokeWidth')) + const stroke = newFO.getAttribute('stroke') + const strokeWidth = Number(newFO.getAttribute('stroke-width')) const radialshift = Number(newFO.getAttribute('radialshift')) let x = opts.mouse_x @@ -352,7 +349,7 @@ export default { } newFO.setAttribute('points', polyPoints) newFO.setAttribute('fill', fill) - newFO.setAttribute('stroke', strokecolor) + newFO.setAttribute('stroke', stroke) newFO.setAttribute('stroke-width', strokeWidth) /* const shape = */ newFO.getAttribute('shape') @@ -366,8 +363,8 @@ export default { const sides = Number(newFO.getAttribute('sides')) // const orient = newFO.getAttribute('orient'); const fill = newFO.getAttribute('fill') - const strokecolor = newFO.getAttribute('strokecolor') - const strokeWidth = Number(newFO.getAttribute('strokeWidth')) + const stroke = newFO.getAttribute('stroke') + const strokeWidth = Number(newFO.getAttribute('stroke-width')) let x = opts.mouse_x let y = opts.mouse_y @@ -390,7 +387,7 @@ export default { // const poly = newFO.createElementNS(NS.SVG, 'polygon'); newFO.setAttribute('points', points) newFO.setAttribute('fill', fill) - newFO.setAttribute('stroke', strokecolor) + newFO.setAttribute('stroke', stroke) newFO.setAttribute('stroke-width', strokeWidth) return { started: true diff --git a/src/svgcanvas/elem-get-set.js b/src/svgcanvas/elem-get-set.js index d098ceaa..2d237a53 100644 --- a/src/svgcanvas/elem-get-set.js +++ b/src/svgcanvas/elem-get-set.js @@ -8,7 +8,7 @@ import { jGraduate } from '../editor/components/jgraduate/jQuery.jGraduate.js' import { NS } from './namespaces.js' import { getVisibleElements, getStrokedBBoxDefaultVisible, findDefs, - walkTree, isNullish, getHref, setHref, getElement + walkTree, getHref, setHref, getElement } from './utilities.js' import { convertToNum @@ -30,7 +30,7 @@ export const init = (canvas) => { * @function module:elem-get-set.SvgCanvas#getResolution * @returns {DimensionsAndZoom} The current dimensions and zoom level in an object */ -export const getResolutionMethod = function () { +export const getResolutionMethod = () => { const zoom = svgCanvas.getZoom() const w = svgCanvas.getSvgContent().getAttribute('width') / zoom const h = svgCanvas.getSvgContent().getAttribute('height') / zoom @@ -48,7 +48,7 @@ export const getResolutionMethod = function () { * @returns {string|void} the current group/SVG's title contents or * `undefined` if no element is passed nd there are no selected elements. */ -export const getTitleMethod = function (elem) { +export const getTitleMethod = (elem) => { const selectedElements = svgCanvas.getSelectedElements() const dataStorage = svgCanvas.getDataStorage() elem = elem || selectedElements[0] @@ -74,7 +74,7 @@ export const getTitleMethod = function (elem) { * @todo Combine this with `setDocumentTitle` * @returns {void} */ -export const setGroupTitleMethod = function (val) { +export const setGroupTitleMethod = (val) => { const { InsertElementCommand, RemoveElementCommand, ChangeElementCommand, BatchCommand @@ -119,7 +119,7 @@ export const setGroupTitleMethod = function (val) { * @param {string} newTitle - String with the new title * @returns {void} */ -export const setDocumentTitleMethod = function (newTitle) { +export const setDocumentTitleMethod = (newTitle) => { const { ChangeElementCommand, BatchCommand } = svgCanvas.history const childs = svgCanvas.getSvgContent().childNodes let docTitle = false; let oldTitle = '' @@ -159,7 +159,7 @@ export const setDocumentTitleMethod = function (newTitle) { * @returns {boolean} Indicates if resolution change was successful. * It will fail on "fit to content" option with no content to fit to. */ -export const setResolutionMethod = function (x, y) { +export const setResolutionMethod = (x, y) => { const { ChangeElementCommand, BatchCommand } = svgCanvas.history const zoom = svgCanvas.getZoom() const res = svgCanvas.getResolution() @@ -201,8 +201,8 @@ export const setResolutionMethod = function (x, y) { svgCanvas.getSvgContent().setAttribute('width', x) svgCanvas.getSvgContent().setAttribute('height', y) - this.contentW = x - this.contentH = y + svgCanvas.contentW = x + svgCanvas.contentH = y batchCmd.addSubCommand(new ChangeElementCommand(svgCanvas.getSvgContent(), { width: w, height: h })) svgCanvas.getSvgContent().setAttribute('viewBox', [0, 0, x / zoom, y / zoom].join(' ')) @@ -220,7 +220,7 @@ export const setResolutionMethod = function (x, y) { * @param {boolean} [add] - Indicates whether or not to add the namespace value * @returns {string} The editor's namespace URL */ -export const getEditorNSMethod = function (add) { +export const getEditorNSMethod = (add) => { if (add) { svgCanvas.getSvgContent().setAttribute('xmlns:se', NS.SE) } @@ -240,7 +240,7 @@ export const getEditorNSMethod = function (add) { * @param {Integer} editorH - The editor's workarea box's height * @returns {module:elem-get-set.ZoomAndBBox|void} */ -export const setBBoxZoomMethod = function (val, editorW, editorH) { +export const setBBoxZoomMethod = (val, editorW, editorH) => { const zoom = svgCanvas.getZoom() const selectedElements = svgCanvas.getSelectedElements() let spacer = 0.85 @@ -299,7 +299,7 @@ export const setBBoxZoomMethod = function (val, editorW, editorH) { * @fires module:elem-get-set.SvgCanvas#event:ext_zoomChanged * @returns {void} */ -export const setZoomMethod = function (zoomLevel) { +export const setZoomMethod = (zoomLevel) => { const selectedElements = svgCanvas.getSelectedElements() const res = svgCanvas.getResolution() svgCanvas.getSvgContent().setAttribute('viewBox', '0 0 ' + res.w / zoomLevel + ' ' + res.h / zoomLevel) @@ -331,7 +331,7 @@ export const setColorMethod = function (type, val, preventUndo) { * @param {Element} e * @returns {void} */ - function addNonG (e) { + const addNonG = (e) => { if (e.nodeName !== 'g') { elems.push(e) } @@ -367,7 +367,7 @@ export const setColorMethod = function (type, val, preventUndo) { * @param {"fill"|"stroke"} type - String indicating "fill" or "stroke" to apply to an element * @returns {void} */ -export const setGradientMethod = function (type) { +export const setGradientMethod = (type) => { if (!svgCanvas.getCurProperties(type + '_paint') || svgCanvas.getCurProperties(type + '_paint').type === 'solidColor') { return } const canvas = svgCanvas @@ -394,7 +394,7 @@ export const setGradientMethod = function (type) { * @param {SVGGradientElement} grad - The gradient DOM element to compare to others * @returns {SVGGradientElement} The existing gradient if found, `null` if not */ -export const findDuplicateGradient = function (grad) { +export const findDuplicateGradient = (grad) => { const defs = findDefs() const existingGrads = defs.querySelectorAll('linearGradient, radialGradient') let i = existingGrads.length @@ -468,16 +468,16 @@ export const findDuplicateGradient = function (grad) { * @param {module:jGraduate.jGraduatePaintOptions} paint - The jGraduate paint object to apply * @returns {void} */ -export const setPaintMethod = function (type, paint) { +export const setPaintMethod = (type, paint) => { // make a copy const p = new jGraduate.Paint(paint) - this.setPaintOpacity(type, p.alpha / 100, true) + svgCanvas.setPaintOpacity(type, p.alpha / 100, true) // now set the current paint object svgCanvas.setCurProperties(type + '_paint', p) switch (p.type) { case 'solidColor': - this.setColor(type, p.solidColor !== 'none' ? '#' + p.solidColor : 'none') + svgCanvas.setColor(type, p.solidColor !== 'none' ? '#' + p.solidColor : 'none') break case 'linearGradient': case 'radialGradient': @@ -494,7 +494,7 @@ export const setPaintMethod = function (type, paint) { * @fires module:elem-get-set.SvgCanvas#event:changed * @returns {void} */ -export const setStrokeWidthMethod = function (val) { +export const setStrokeWidthMethod = (val) => { const selectedElements = svgCanvas.getSelectedElements() if (val === 0 && ['line', 'path'].includes(svgCanvas.getMode())) { svgCanvas.setStrokeWidth(1) @@ -508,7 +508,7 @@ export const setStrokeWidthMethod = function (val) { * @param {Element} e * @returns {void} */ - function addNonG (e) { + const addNonG = (e) => { if (e.nodeName !== 'g') { elems.push(e) } @@ -538,7 +538,7 @@ export const setStrokeWidthMethod = function (val) { * @fires module:elem-get-set.SvgCanvas#event:changed * @returns {void} */ -export const setStrokeAttrMethod = function (attr, val) { +export const setStrokeAttrMethod = (attr, val) => { const selectedElements = svgCanvas.getSelectedElements() svgCanvas.setCurShape(attr.replace('-', '_'), val) const elems = [] @@ -564,12 +564,12 @@ export const setStrokeAttrMethod = function (attr, val) { * @function module:svgcanvas.SvgCanvas#getBold * @returns {boolean} Indicates whether or not element is bold */ -export const getBoldMethod = function () { +export const getBoldMethod = () => { const selectedElements = svgCanvas.getSelectedElements() // should only have one element selected const selected = selectedElements[0] - if (!isNullish(selected) && selected.tagName === 'text' && - isNullish(selectedElements[1])) { + if (selected?.tagName === 'text' && + !selectedElements[1]) { return (selected.getAttribute('font-weight') === 'bold') } return false @@ -581,11 +581,11 @@ export const getBoldMethod = function () { * @param {boolean} b - Indicates bold (`true`) or normal (`false`) * @returns {void} */ -export const setBoldMethod = function (b) { +export const setBoldMethod = (b) => { const selectedElements = svgCanvas.getSelectedElements() const selected = selectedElements[0] - if (!isNullish(selected) && selected.tagName === 'text' && - isNullish(selectedElements[1])) { + if (selected?.tagName === 'text' && + !selectedElements[1]) { svgCanvas.changeSelectedAttribute('font-weight', b ? 'bold' : 'normal') } if (!selectedElements[0].textContent) { @@ -597,11 +597,11 @@ export const setBoldMethod = function (b) { * Check whether selected element has the given text decoration value or not. * @returns {boolean} Indicates whether or not element has the text decoration value */ -export const hasTextDecorationMethod = function (value) { +export const hasTextDecorationMethod = (value) => { const selectedElements = svgCanvas.getSelectedElements() const selected = selectedElements[0] - if (!isNullish(selected) && selected.tagName === 'text' && isNullish(selectedElements[1])) { + if (selected?.tagName === 'text' && !selectedElements[1]) { const attribute = selected.getAttribute('text-decoration') || '' return attribute.includes(value) } @@ -614,10 +614,10 @@ export const hasTextDecorationMethod = function (value) { * @param value The text decoration value * @returns {void} */ -export const addTextDecorationMethod = function (value) { +export const addTextDecorationMethod = (value) => { const selectedElements = svgCanvas.getSelectedElements() const selected = selectedElements[0] - if (!isNullish(selected) && selected.tagName === 'text' && isNullish(selectedElements[1])) { + if (selected?.tagName === 'text' && !selectedElements[1]) { const oldValue = selected.getAttribute('text-decoration') || '' svgCanvas.changeSelectedAttribute('text-decoration', (oldValue + ' ' + value).trim()) } @@ -631,10 +631,10 @@ export const addTextDecorationMethod = function (value) { * @param value The text decoration value * @returns {void} */ -export const removeTextDecorationMethod = function (value) { +export const removeTextDecorationMethod = (value) => { const selectedElements = svgCanvas.getSelectedElements() const selected = selectedElements[0] - if (!isNullish(selected) && selected.tagName === 'text' && isNullish(selectedElements[1])) { + if (selected?.tagName === 'text' && !selectedElements[1]) { const actualValues = selected.getAttribute('text-decoration') || '' svgCanvas.changeSelectedAttribute('text-decoration', actualValues.replace(value, '').trim()) } @@ -648,11 +648,10 @@ export const removeTextDecorationMethod = function (value) { * @function module:svgcanvas.SvgCanvas#getItalic * @returns {boolean} Indicates whether or not element is italic */ -export const getItalicMethod = function () { +export const getItalicMethod = () => { const selectedElements = svgCanvas.getSelectedElements() const selected = selectedElements[0] - if (!isNullish(selected) && selected.tagName === 'text' && - isNullish(selectedElements[1])) { + if (selected?.tagName === 'text' && !selectedElements[1]) { return (selected.getAttribute('font-style') === 'italic') } return false @@ -664,11 +663,10 @@ export const getItalicMethod = function () { * @param {boolean} i - Indicates italic (`true`) or normal (`false`) * @returns {void} */ -export const setItalicMethod = function (i) { +export const setItalicMethod = (i) => { const selectedElements = svgCanvas.getSelectedElements() const selected = selectedElements[0] - if (!isNullish(selected) && selected.tagName === 'text' && - isNullish(selectedElements[1])) { + if (selected?.tagName === 'text' && !selectedElements[1]) { svgCanvas.changeSelectedAttribute('font-style', i ? 'italic' : 'normal') } if (!selectedElements[0].textContent) { @@ -681,11 +679,10 @@ export const setItalicMethod = function (i) { * @param {string} value - The text anchor value (start, middle or end) * @returns {void} */ -export const setTextAnchorMethod = function (value) { +export const setTextAnchorMethod = (value) => { const selectedElements = svgCanvas.getSelectedElements() const selected = selectedElements[0] - if (!isNullish(selected) && selected.tagName === 'text' && - isNullish(selectedElements[1])) { + if (selected?.tagName === 'text' && !selectedElements[1]) { svgCanvas.changeSelectedAttribute('text-anchor', value) } if (selectedElements.length > 0 && !selectedElements[0].textContent) { @@ -697,7 +694,7 @@ export const setTextAnchorMethod = function (value) { * @function module:svgcanvas.SvgCanvas#getFontFamily * @returns {string} The current font family */ -export const getFontFamilyMethod = function () { +export const getFontFamilyMethod = () => { return svgCanvas.getCurText('font_family') } @@ -707,7 +704,7 @@ export const getFontFamilyMethod = function () { * @param {string} val - String with the new font family * @returns {void} */ -export const setFontFamilyMethod = function (val) { +export const setFontFamilyMethod = (val) => { const selectedElements = svgCanvas.getSelectedElements() svgCanvas.setCurText('font_family', val) svgCanvas.changeSelectedAttribute('font-family', val) @@ -722,7 +719,7 @@ export const setFontFamilyMethod = function (val) { * @param {string} val - String with the new font color * @returns {void} */ -export const setFontColorMethod = function (val) { +export const setFontColorMethod = (val) => { svgCanvas.setCurText('fill', val) svgCanvas.changeSelectedAttribute('fill', val) } @@ -731,7 +728,7 @@ export const setFontColorMethod = function (val) { * @function module:svgcanvas.SvgCanvas#getFontColor * @returns {string} The current font color */ -export const getFontColorMethod = function () { +export const getFontColorMethod = () => { return svgCanvas.getCurText('fill') } @@ -739,7 +736,7 @@ export const getFontColorMethod = function () { * @function module:svgcanvas.SvgCanvas#getFontSize * @returns {Float} The current font size */ -export const getFontSizeMethod = function () { +export const getFontSizeMethod = () => { return svgCanvas.getCurText('font_size') } @@ -749,7 +746,7 @@ export const getFontSizeMethod = function () { * @param {Float} val - Float with the new font size * @returns {void} */ -export const setFontSizeMethod = function (val) { +export const setFontSizeMethod = (val) => { const selectedElements = svgCanvas.getSelectedElements() svgCanvas.setCurText('font_size', val) svgCanvas.changeSelectedAttribute('font-size', val) @@ -762,10 +759,10 @@ export const setFontSizeMethod = function (val) { * @function module:svgcanvas.SvgCanvas#getText * @returns {string} The current text (`textContent`) of the selected element */ -export const getTextMethod = function () { +export const getTextMethod = () => { const selectedElements = svgCanvas.getSelectedElements() const selected = selectedElements[0] - if (isNullish(selected)) { return '' } + if (!selected) { return '' } return (selected) ? selected.textContent : '' } @@ -775,7 +772,7 @@ export const getTextMethod = function () { * @param {string} val - String with the new text * @returns {void} */ -export const setTextContentMethod = function (val) { +export const setTextContentMethod = (val) => { svgCanvas.changeSelectedAttribute('#text', val) svgCanvas.textActions.init(val) svgCanvas.textActions.setCursor() @@ -789,7 +786,7 @@ export const setTextContentMethod = function (val) { * @fires module:svgcanvas.SvgCanvas#event:changed * @returns {void} */ -export const setImageURLMethod = function (val) { +export const setImageURLMethod = (val) => { const { ChangeElementCommand, BatchCommand } = svgCanvas.history const selectedElements = svgCanvas.getSelectedElements() const elem = selectedElements[0] @@ -838,7 +835,7 @@ export const setImageURLMethod = function (val) { * @param {string} val - String with the link URL/path * @returns {void} */ -export const setLinkURLMethod = function (val) { +export const setLinkURLMethod = (val) => { const { ChangeElementCommand, BatchCommand } = svgCanvas.history const selectedElements = svgCanvas.getSelectedElements() let elem = selectedElements[0] @@ -875,11 +872,11 @@ export const setLinkURLMethod = function (val) { * @fires module:svgcanvas.SvgCanvas#event:changed * @returns {void} */ -export const setRectRadiusMethod = function (val) { +export const setRectRadiusMethod = (val) => { const { ChangeElementCommand } = svgCanvas.history const selectedElements = svgCanvas.getSelectedElements() const selected = selectedElements[0] - if (!isNullish(selected) && selected.tagName === 'rect') { + if (selected?.tagName === 'rect') { const r = Number(selected.getAttribute('rx')) if (r !== val) { selected.setAttribute('rx', val) @@ -896,7 +893,7 @@ export const setRectRadiusMethod = function (val) { * @param {string} url * @returns {void} */ -export const makeHyperlinkMethod = function (url) { +export const makeHyperlinkMethod = (url) => { svgCanvas.groupSelectedElements('a', url) // TODO: If element is a single "g", convert to "a" @@ -907,7 +904,7 @@ export const makeHyperlinkMethod = function (url) { * @function module:svgcanvas.SvgCanvas#removeHyperlink * @returns {void} */ -export const removeHyperlinkMethod = function () { +export const removeHyperlinkMethod = () => { svgCanvas.ungroupSelectedElement() } @@ -932,7 +929,7 @@ export const setSegTypeMethod = function (newType) { * @param {string} url - URL or path to image to use * @returns {void} */ -export const setBackgroundMethod = function (color, url) { +export const setBackgroundMethod = (color, url) => { const bg = getElement('canvasBackground') const border = bg.querySelector('rect') let bgImg = getElement('background_image') diff --git a/src/svgcanvas/json.js b/src/svgcanvas/json.js index 3537c9cf..80be6896 100644 --- a/src/svgcanvas/json.js +++ b/src/svgcanvas/json.js @@ -64,7 +64,7 @@ export const getJsonFromSvgElements = (data) => { * @type {module:utilities.EditorContext#addSVGElementsFromJson|module:path.EditorContext#addSVGElementsFromJson} */ -export const addSVGElementsFromJson = function (data) { +export const addSVGElementsFromJson = (data) => { if (typeof data === 'string') return svgdoc_.createTextNode(data) let shape = getElement(data.attr.id) @@ -86,7 +86,7 @@ export const addSVGElementsFromJson = function (data) { assignAttributes(shape, { fill: curShape.fill, stroke: curShape.stroke, - 'stroke-width': curShape.stroke_width, + 'stroke-width': curShape.strokeWidth, 'stroke-dasharray': curShape.stroke_dasharray, 'stroke-linejoin': curShape.stroke_linejoin, 'stroke-linecap': curShape.stroke_linecap, diff --git a/src/svgcanvas/sanitize.js b/src/svgcanvas/sanitize.js index 09d3cd6d..7b9951d2 100644 --- a/src/svgcanvas/sanitize.js +++ b/src/svgcanvas/sanitize.js @@ -47,7 +47,7 @@ const svgWhiteList_ = { metadata: [], path: ['clip-path', 'clip-rule', 'd', 'enable-background', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage'], pattern: ['height', 'patternContentUnits', 'patternTransform', 'patternUnits', 'requiredFeatures', 'systemLanguage', 'viewBox', 'width', 'x', 'xlink:href', 'y'], - polygon: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'points', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'sides', 'shape', 'edge', 'point', 'starRadiusMultiplier', 'r', 'radialshift'], + polygon: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'points', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'sides', 'shape', 'edge', 'point', 'starRadiusMultiplier', 'r', 'radialshift', 'r2', 'orient', 'cx', 'cy'], polyline: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'points', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'se:connector'], radialGradient: ['cx', 'cy', 'fx', 'fy', 'gradientTransform', 'gradientUnits', 'r', 'requiredFeatures', 'spreadMethod', 'systemLanguage', 'xlink:href'], rect: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'height', 'mask', 'opacity', 'requiredFeatures', 'rx', 'ry', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'width', 'x', 'y'], @@ -104,7 +104,7 @@ Object.keys(svgWhiteList_).forEach((element) => { svgWhiteList_[element] = [...s const svgWhiteListNS_ = {} Object.entries(svgWhiteList_).forEach(([elt, atts]) => { const attNS = {} - Object.entries(atts).forEach(function ([_i, att]) { + Object.entries(atts).forEach(([_i, att]) => { if (att.includes(':')) { const v = att.split(':') attNS[v[1]] = NS[(v[0]).toUpperCase()] @@ -122,7 +122,7 @@ Object.entries(svgWhiteList_).forEach(([elt, atts]) => { * @param {Text|Element} node - The DOM element to be checked (we'll also check its children) or text node to be cleaned up * @returns {void} */ -export const sanitizeSvg = function (node) { +export const sanitizeSvg = (node) => { // Cleanup text nodes if (node.nodeType === 3) { // 3 === TEXT_NODE // Trim whitespace @@ -216,7 +216,7 @@ export const sanitizeSvg = function (node) { } // if the element has attributes pointing to a non-local reference, // need to remove the attribute - Object.values(['clip-path', 'fill', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'stroke'], function (attr) { + Object.values(['clip-path', 'fill', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'stroke'], (attr) => { let val = node.getAttribute(attr) if (val) { val = getUrlFromAttr(val) diff --git a/src/svgcanvas/svgcanvas.js b/src/svgcanvas/svgcanvas.js index 97312a21..d9fc81d5 100644 --- a/src/svgcanvas/svgcanvas.js +++ b/src/svgcanvas/svgcanvas.js @@ -237,7 +237,7 @@ class SvgCanvas { elemGetSet.init(this) // prevent links from being followed in the canvas - const handleLinkInCanvas = function (e) { + const handleLinkInCanvas = (e) => { e.preventDefault() return false } @@ -396,7 +396,6 @@ class SvgCanvas { setbSpline (value) { this.bSpline = value } setNextPos (value) { this.nextPos = value } setNextParameter (value) { this.nextParameter = value } - setCurProperties (key, value) { this.curProperties[key] = value } setCurText (key, value) { this.curText[key] = value } setFreehand (key, value) { this.freehand[key] = value } setCurBBoxes (value) { this.curBBoxes = value } @@ -424,6 +423,7 @@ class SvgCanvas { getrefAttrs () { return refAttrs } getcanvg () { return canvg } setCanvas (key, value) { this[key] = value } + setCurProperties (key, value) { this.curProperties[key] = value } getCurProperties (key) { return this.curProperties[key] } setCurShape (key, value) { this.curShape[key] = value } gettingSelectorManager () { return this.selectorManager } @@ -508,7 +508,7 @@ class SvgCanvas { restoreRefElements (elem) { // Look for missing reference elements, restore any found const attrs = {} - refAttrs.forEach(function (item, _) { + refAttrs.forEach((item, _) => { attrs[item] = elem.getAttribute(item) }) Object.values(attrs).forEach((val) => { @@ -557,7 +557,7 @@ class SvgCanvas { flashStorage () { const data = sessionStorage.getItem(CLIPBOARD_ID) localStorage.setItem(CLIPBOARD_ID, data) - setTimeout(function () { + setTimeout(() => { localStorage.removeItem(CLIPBOARD_ID) }, 1) } @@ -581,7 +581,7 @@ class SvgCanvas { * @returns {void} */ removeFromSelection (elemsToRemove) { - if (isNullish(this.selectedElements[0])) { return } + if (!this.selectedElements[0]) { return } if (!elemsToRemove.length) { return } // find every element and remove it from our array copy