瀏覽代碼

Add Text Colors (#67)

* Add ability to choose a color when creating text elements

* use strokeColor instead of adding a new field
Faustino Kialungila 5 年之前
父節點
當前提交
f2386eb131
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/index.tsx

+ 3 - 0
src/index.tsx

@@ -345,11 +345,14 @@ function generateDraw(element: ExcaliburElement) {
     element.draw = (rc, context) => {
       const font = context.font;
       context.font = element.font;
+      const fillStyle = context.fillStyle;
+      context.fillStyle = element.strokeColor;
       context.fillText(
         element.text,
         element.x,
         element.y + element.actualBoundingBoxAscent
       );
+      context.fillStyle = fillStyle;
       context.font = font;
     };
   } else {