add shadow effects
This commit is contained in:
parent
adf0077759
commit
0ac97353f2
14
dist/index.js
vendored
14
dist/index.js
vendored
@ -3856,6 +3856,20 @@ return __module.exports;
|
|||||||
this.view.style.borderRadius = toPixelString(prop);
|
this.view.style.borderRadius = toPixelString(prop);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'shadow':
|
||||||
|
const opacity = prop.opacity || 0;
|
||||||
|
if (opacity > 0) {
|
||||||
|
const offsetX = prop.offsetX || 0;
|
||||||
|
const offsetY = prop.offsetY || 0;
|
||||||
|
const shadowColor = prop.color || 0xff000000;
|
||||||
|
const shadowRadius = prop.radius;
|
||||||
|
const alpha = opacity * 255;
|
||||||
|
this.view.style.boxShadow = `${toPixelString(offsetX)} ${toPixelString(offsetY)} ${toPixelString(shadowRadius)} ${toRGBAString((shadowColor & 0xffffff) | ((alpha & 0xff) << 24))} `;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.view.style.boxShadow = "";
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set backgroundColor(v) {
|
set backgroundColor(v) {
|
||||||
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@ -259,6 +259,19 @@ export abstract class DoricViewNode {
|
|||||||
this.view.style.borderRadius = toPixelString(prop)
|
this.view.style.borderRadius = toPixelString(prop)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case 'shadow':
|
||||||
|
const opacity = prop.opacity || 0
|
||||||
|
if (opacity > 0) {
|
||||||
|
const offsetX = prop.offsetX || 0
|
||||||
|
const offsetY = prop.offsetY || 0
|
||||||
|
const shadowColor = prop.color || 0xff000000
|
||||||
|
const shadowRadius = prop.radius
|
||||||
|
const alpha = opacity * 255
|
||||||
|
this.view.style.boxShadow = `${toPixelString(offsetX)} ${toPixelString(offsetY)} ${toPixelString(shadowRadius)} ${toRGBAString((shadowColor & 0xffffff) | ((alpha & 0xff) << 24))} `
|
||||||
|
} else {
|
||||||
|
this.view.style.boxShadow = ""
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user