Skip to content

Commit

Permalink
enable to export elMirror on hover layer for extra style setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
100pah committed Jun 14, 2018
1 parent e771a9b commit 3b94328
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/Painter.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,17 @@ Painter.prototype = {
}
var elMirror = new el.constructor({
style: el.style,
shape: el.shape
shape: el.shape,
z: el.z,
z2: el.z2,
silent: el.silent
});
elMirror.__from = el;
el.__hoverMir = elMirror;
elMirror.setStyle(hoverStyle);
hoverStyle && elMirror.setStyle(hoverStyle);
this._hoverElements.push(elMirror);

return elMirror;
},

removeHover: function (el) {
Expand Down Expand Up @@ -355,6 +360,7 @@ Painter.prototype = {
this._doPaintEl(el, hoverLayer, true, scope);
}
}

hoverLayer.ctx.restore();
},

Expand Down
3 changes: 2 additions & 1 deletion src/zrender.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@ ZRender.prototype = {
*/
addHover: function (el, style) {
if (this.painter.addHover) {
this.painter.addHover(el, style);
var elMirror = this.painter.addHover(el, style);
this.refreshHover();
return elMirror;
}
},

Expand Down

0 comments on commit 3b94328

Please sign in to comment.