Skip to content

Commit

Permalink
fix: use transform translate for nipple front (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
MCArth authored Oct 10, 2022
1 parent 3a2e495 commit 52e5bd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ Collection.prototype.processOnMove = function (evt) {
};

if (!opts.dataOnly) {
u.applyPosition(nipple.ui.front, nipple.frontPosition);
nipple.ui.front.style.transform = 'translate(' + xPosition + 'px,' + yPosition + 'px)';
}

// Prepare event's datas.
Expand Down
8 changes: 4 additions & 4 deletions src/nipple.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ Nipple.prototype.stylize = function () {
marginLeft: -this.options.size / 4 + 'px',
marginTop: -this.options.size / 4 + 'px',
background: this.options.color,
'opacity': '.5'
'opacity': '.5',
transform: 'translate(0px, 0px)'
};

u.extend(styles.el, transitStyle);
Expand Down Expand Up @@ -265,12 +266,11 @@ Nipple.prototype.setPosition = function (cb, position) {

var transitStyle = {};
transitStyle.front = u.getTransitionStyle('transition',
['top', 'left'], animTime);
['transform'], animTime);

var styles = {front: {}};
styles.front = {
left: self.frontPosition.x + 'px',
top: self.frontPosition.y + 'px'
transform: 'translate(' + self.frontPosition.x + 'px,' + self.frontPosition.y + 'px)'
};

self.applyStyles(transitStyle);
Expand Down

0 comments on commit 52e5bd2

Please sign in to comment.