From b81c1d824bbdcf190fb62263438acd115d9e55d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B6=9B?= Date: Thu, 28 May 2020 19:24:55 +0800 Subject: [PATCH] android:update textnode shadow prop --- .../src/main/java/pub/doric/shader/TextNode.java | 11 +++++++++++ doric-demo/src/TextDemo.ts | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java b/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java index 8ebc9fb5..479f980d 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java @@ -223,6 +223,17 @@ public class TextNode extends ViewNode { } } break; + case "shadow": + if (prop.isObject()) { + mView.setAlpha((prop.asObject().getProperty("opacity").asNumber().toFloat())); + mView.setShadowLayer( + prop.asObject().getProperty("radius").asNumber().toFloat(), + DoricUtils.dp2px(prop.asObject().getProperty("offsetX").asNumber().toFloat()), + DoricUtils.dp2px(prop.asObject().getProperty("offsetY").asNumber().toFloat()), + prop.asObject().getProperty("color").asNumber().toInt() + ); + } + break; default: super.blend(view, name, prop); break; diff --git a/doric-demo/src/TextDemo.ts b/doric-demo/src/TextDemo.ts index fa63029d..f3d73525 100644 --- a/doric-demo/src/TextDemo.ts +++ b/doric-demo/src/TextDemo.ts @@ -11,8 +11,15 @@ class TextDemo extends Panel { text: "This is normal text", }), text({ - text: "This is normal text", + text: "This is normal text with shadow ", textSize: 20, + shadow: { + color: Color.parse("#1DD6DE"), + offsetX: 0, + offsetY: 1, + opacity: 0.8, + radius: 3.0 + } }), text({ text: "This is normal text",