Skip to content

Commit

Permalink
Fixed error with reverse danmaku in CSS mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jabbany committed Apr 14, 2017
1 parent e3ab70b commit 9974831
Show file tree
Hide file tree
Showing 9 changed files with 557 additions and 527 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 Jim Chen
Copyright (c) 2017 Jim Chen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
Expand Down
18 changes: 11 additions & 7 deletions dist/CommentCoreLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,21 +655,24 @@ var CssScrollComment = (function (_super) {
return (this.ttl / this.dur) * (this.parent.width + this.width) - this.width;
},
set: function (x) {
if (typeof this._x === "number") {
if (this._x !== null && typeof this._x === "number") {
var dx = x - this._x;
this._x = x;
CssCompatLayer.transform(this.dom, "translateX(" + dx + "px)");
CssCompatLayer.transform(this.dom, "translateX(" +
(this.axis % 2 === 0 ? dx : -dx) + "px)");
}
else {
this._x = x;
if (!this.absolute) {
this._x *= this.parent.width;
}
if (this.align % 2 === 0) {
this.dom.style.left = this._x + "px";
if (this.axis % 2 === 0) {
this.dom.style.left =
(this._x + (this.align % 2 === 0 ? 0 : -this.width)) + 'px';
}
else {
this.dom.style.right = this._x + "px";
this.dom.style.right =
(this._x + (this.align % 2 === 0 ? -this.width : 0)) + 'px';
}
}
},
Expand All @@ -688,10 +691,11 @@ var CssScrollComment = (function (_super) {
this._dirtyCSS = true;
};
CssScrollComment.prototype.stop = function () {
this.dom.style.transition = "";
_super.prototype.stop.call(this);
this.dom.style.transition = '';
this.x = this._x;
this._x = null;
this.x = (this.ttl / this.dur) * (this.parent.width + this.width) - this.width;
this.x = this.x;
this._dirtyCSS = true;
};
return CssScrollComment;
Expand Down
4 changes: 2 additions & 2 deletions dist/CommentCoreLibrary.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/CommentObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Alignment: 对齐锚点(方形四角)。此数的高位表示上下,低位
设定后x,y坐标的锚点将变成对应的方形角。不过,在右和下的对齐时,读取 x,y 坐标不一定准确,而且因为
效率低所以不推荐。比如 top right 模式下,读 x 坐标效率比较低,但是读 y 就要好很多。

注意:`>4`的模式未必在所有状态下都支持!
注意:`>=4`的模式未必在所有状态下都支持!

### absolute <Bool> = true
Absolute Coordinates: 是否使用绝对坐标。当 `absolute === false` 时,x,y坐标将会表示相对
Expand Down
Loading

0 comments on commit 9974831

Please sign in to comment.