diff --git a/demo/index.html b/demo/index.html index 31e1efb..6f5d4d2 100644 --- a/demo/index.html +++ b/demo/index.html @@ -44,8 +44,7 @@
let valign = new MultiStyleText("You can use <code>valign</code> to control the <top>vertical</top> <middle>alignment</middle> of <bottom>text</bottom>.",
+let valign = new MultiStyleText("You can use <code>valign</code> <top>to</top> <middle>control</middle> <baseline>the</baseline> <bottom>vertical</bottom> <custom1>alignment</custom1> <custom2>of</custom2> <custom3>text</custom3>.",
{
"default": {
fontFamily: "Arial",
fontSize: "24px",
fill: "#cccccc"
},
- "code": { fontFamily: "Inconsolata", fill: "#ff8888", valign: "bottom" },
+ "code": {
+ fontFamily: "Inconsolata",
+ fontSize: "36px",
+ fill: "#ff8888"
+ },
"top": { fontSize: "14px", valign: "top" },
"middle": { fontSize: "14px", valign: "middle" },
- "bottom": { fontSize: "14px", valign: "bottom" }
+ "bottom": { fontSize: "14px", valign: "bottom" },
+ "baseline": { fontSize: "14px", valign: "baseline" },
+ "custom1": { fontSize: "14px", valign: 5 },
+ "custom2": { fontSize: "14px", valign: -70 },
+ "custom3": { fontSize: "14px", valign: 25 }
});
Wrapping and Alignment
@@ -84,7 +91,10 @@ Wrapping and Alignment
});
let wrapping2 = new MultiStyleText("全局设置的<blue>对齐</blue>属性由「默认」来<big>控制</big>。而且不能被<blue>别的样式</blue>所<red>覆盖</red>。",
+// breakWords allows newlines to be inserted anywhere - not just at whitespaces.
+// This is useful for some languages like Chinese.
+
+let wrapping2 = new MultiStyleText("全局设置的<blue>对齐</blue>属性由「默认」来<big>控制</big>。而且不能被<blue>别的样式</blue>所<red>覆盖</red>。",
{
"default": {
fontFamily: "Arial",
@@ -99,6 +109,29 @@ Wrapping and Alignment II
"big": { fill: 0x88ff88, stroke: 0x44cc44, fontSize: "36px" }
});
+Debug Mode
+MultiStyleText.debugOptions.spans.enabled = true;
+MultiStyleText.debugOptions.objects.enabled = true;
+
+let debug = new MultiStyleText("You can use <code>debug mode</code> to help you figure out what your text is doing. You can use <blue>global, </blue><red>static</red> settings or <no-debug>override those with the <code>debug</code> style option.</no-debug>",
+{
+ "default": {
+ fontFamily: "Arial",
+ fontSize: "24px",
+ fill: "#cccccc",
+ wordWrap: true,
+ wordWrapWidth: 500,
+ },
+ "code": {
+ fontFamily: "Inconsolata",
+ fontSize: "36px",
+ fill: "#ff8888"
+ },
+ "blue": { fill: 0x4488ff, stroke: 0x2244cc },
+ "red": { fill: 0xff8888, stroke: 0xcc4444 },
+ "no-debug": { debug: false }
+});
+
Have Fun
let funStyles = {
"default": {
@@ -132,7 +165,7 @@ Have Fun