File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 472
472
}
473
473
}
474
474
475
- return serialized ;
475
+ return serialized ;
476
476
} ;
477
477
478
478
504
504
ctx . prototype . restore = function ( ) {
505
505
var element = this . __groupStack . pop ( ) ;
506
506
var state = this . __stack . pop ( ) ;
507
+
508
+ /** Prune empty group created when running save/restore without any content **/
509
+ var node = this . __currentElement
510
+ if ( node . nodeName === 'g' && ! node . childNodes . length ) {
511
+ node . remove ( )
512
+ }
513
+
507
514
this . __currentElementsToStyle = null ;
508
515
this . __currentElement = element || this . __root . childNodes [ 1 ] ;
509
516
this . __applyStyleState ( state ) ;
1163
1170
* Generates a ClipPath from the clip command.
1164
1171
*/
1165
1172
ctx . prototype . clip = function ( ) {
1173
+ console . log ( this . __currentPath )
1174
+ if ( ! this . __currentPath ) {
1175
+ return ;
1176
+ }
1177
+
1166
1178
applyCurrentDefaultPath . call ( this , false ) ;
1167
1179
1168
1180
var group = this . __closestGroupOrSvg ( ) ,
1169
1181
clipPath = this . __createElement ( "clipPath" ) ,
1170
1182
id = randomString ( this . __ids ) ,
1171
1183
newGroup = this . __createElement ( "g" ) ;
1172
1184
1173
- this . __currentElement . remove ( ) ;
1174
-
1175
1185
clipPath . setAttribute ( "id" , id ) ;
1176
1186
clipPath . appendChild ( this . __currentElement ) ;
1177
1187
You can’t perform that action at this time.
0 commit comments