Skip to content

Commit 60793a3

Browse files
committed
fix ie getComputedStyle is none ant-design/ant-motion#178
1 parent 8d65067 commit 60793a3

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-tween-one",
3-
"version": "2.2.2",
3+
"version": "2.2.3",
44
"description": "tween-one anim component for react",
55
"keywords": [
66
"react",

src/Tween.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ p.getComputedStyle = function () {
185185
};
186186
p.getAnimStartData = function (item) {
187187
const start = {};
188-
this.computedStyle = this.computedStyle || this.getComputedStyle();
189188
Object.keys(item).forEach(_key => {
190189
if (_key in _plugin || (this.attr === 'attr' && (_key === 'd' || _key === 'points'))) {
190+
this.computedStyle = this.computedStyle || this.getComputedStyle();
191191
start[_key] = item[_key].getAnimStart(this.computedStyle, this.tween, this.isSvg);
192192
return;
193193
}

src/plugin/StylePlugin.jsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ p.getAnimStart = function (computedStyle, tween, isSvg) {
103103
const tweenStyle = tween.style || {};
104104
Object.keys(this.propsData.data).forEach(key => {
105105
const cssName = isConvert(key);
106-
let startData = computedStyle[cssName];
106+
let startData = tweenStyle[cssName] || computedStyle[cssName];
107107
const fixed = computedStyle.position === 'fixed';
108108
if (!startData || startData === 'none' || startData === 'auto') {
109109
startData = '';
@@ -131,10 +131,14 @@ p.getAnimStart = function (computedStyle, tween, isSvg) {
131131
}
132132
style.transform = transform;
133133
} else if (cssName === 'filter') {
134-
this.filterName = checkStyleName('filter') || 'filter';
135-
startData = computedStyle[this.filterName];
136-
this.filterObject = { ...this.filterObject, ...splitFilterToObject(startData) };
137-
startData = this.filterObject[key] || 0;
134+
if (tweenStyle[cssName]) {
135+
startData = tweenStyle[cssName];
136+
} else {
137+
this.filterName = checkStyleName('filter') || 'filter';
138+
startData = computedStyle[this.filterName];
139+
this.filterObject = { ...this.filterObject, ...splitFilterToObject(startData) };
140+
startData = this.filterObject[key] || 0;
141+
}
138142
startUnit = startData.toString().replace(/[^a-z|%]/g, '');
139143
endUnit = this.propsData.dataUnit[key];
140144
if (endUnit !== startUnit) {

0 commit comments

Comments
 (0)