@@ -52,17 +52,17 @@ var Labelimg = (function () {
5252 img . onload = function ( ) {
5353 var svg = document . querySelector ( '.lbi-svg' ) ;
5454 // 保存图片原始尺寸,当图片放大或缩小后,需要与原始尺寸对比,计算比例系数
55- _self . imgWidth = img . clientWidth ;
55+ _self . imgWidth = img . naturalWidth ;
5656 _self . imgHeight = img . clientHeight ;
5757 svg . setAttribute ( 'viewBox' , '0, 0, ' + _self . imgWidth + ', ' + _self . imgHeight ) ;
5858
5959 // 初始化图片大小,让图片和父元素一样宽,提高体验
60- img . style . width = img . clientWidth > img . parentNode . clientWidth ?
60+ img . style . width = img . naturalWidth > img . parentNode . clientWidth ?
6161 img . parentNode . clientWidth + 'px' :
62- img . clientWidth + 'px' ;
62+ img . naturalWidth + 'px' ;
6363 syncSize ( img , svg )
64+ tool . clean ( )
6465 }
65- // clean(svg)
6666 } ,
6767 output : function ( ) {
6868 var _svg = document . getElementById ( 'lbi-svg' ) ;
@@ -338,6 +338,7 @@ var Labelimg = (function () {
338338 svg . innerHTML = ''
339339 _self . polygonConfig . points = [ ]
340340 _self . polygonConfig . stack = [ ] ;
341+ document . querySelector ( '.lbi-mask' ) . style . display = 'none'
341342 }
342343 // 同步标注图片和 svg 大小,使两者保持一致
343344 function syncSize ( img , svg ) {
@@ -494,10 +495,10 @@ var Labelimg = (function () {
494495 function createPoint ( attrs ) {
495496 var circle = makeElementNS ( 'circle' , attrs )
496497 circle . addEventListener ( 'mouseover' , function ( e ) {
497- e . target . setAttribute ( 'r' , 10 )
498+ e . target . style . strokeWidth = 10
498499 } )
499500 circle . addEventListener ( 'mouseout' , function ( e ) {
500- e . target . setAttribute ( 'r' , attrs . r )
501+ e . target . style . strokeWidth = 1
501502 } )
502503
503504 return circle ;
0 commit comments