Skip to content

Commit

Permalink
fix: typo #22
Browse files Browse the repository at this point in the history
  • Loading branch information
army8735 committed Dec 6, 2019
1 parent e3cc35a commit bc129ed
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
14 changes: 9 additions & 5 deletions index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion index.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/node/Xom.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,6 @@ class Xom extends Node {
if(backgroundColor !== 'transparent') {
renderBgc(renderMode, backgroundColor, x2, y2, iw, ih, ctx, this);
}
let originX = x2 + calBackgroundPosition(backgroundPosition[0], iw, width);
let originY = y2 + calBackgroundPosition(backgroundPosition[1], ih, height);
// 渐变或图片叠加
if(backgroundImage) {
if(util.isString(backgroundImage)) {
Expand Down Expand Up @@ -576,6 +574,8 @@ class Xom extends Node {
else if(h === -1) {
h = w * height / width;
}
let originX = x2 + calBackgroundPosition(backgroundPosition[0], iw, width);
let originY = y2 + calBackgroundPosition(backgroundPosition[1], ih, height);
// 超出尺寸模拟mask截取
let needMask = ['repeat-x', 'repeat-y', 'repeat'].indexOf(backgroundRepeat) > -1
|| originX < x2 || originY < y2 || w > iw || h > ih;
Expand Down Expand Up @@ -659,6 +659,8 @@ class Xom extends Node {
}
}
else {
let originX = x2 + calBackgroundPosition(backgroundPosition[0], iw, 0);
let originY = y2 + calBackgroundPosition(backgroundPosition[1], ih, 0);
computedStyle.backgroudSize = calBackgroundSize(backgroundSize, x2, y2, iw, ih).join(' ');
computedStyle.backgroundPosition = `${originX} ${originY}`;
computedStyle.backgroundRepeat = backgroundRepeat;
Expand Down

0 comments on commit bc129ed

Please sign in to comment.