diff --git a/Android/app/src/main/java/pub/doric/demo/DemoActivity.java b/Android/app/src/main/java/pub/doric/demo/DemoActivity.java index 8aa99201..ca7e91f4 100644 --- a/Android/app/src/main/java/pub/doric/demo/DemoActivity.java +++ b/Android/app/src/main/java/pub/doric/demo/DemoActivity.java @@ -53,7 +53,7 @@ public class DemoActivity extends AppCompatActivity { FrameLayout frameLayout = new FrameLayout(this); addContentView(frameLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); - doricContext = DoricContext.create(this, DoricUtils.readAssetFile("demo/" + source), "test"); + doricContext = DoricContext.create(this, DoricUtils.readAssetFile("demo/" + source), source); doricContext.init(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); doricContext.getRootNode().setRootView(frameLayout); } diff --git a/Android/app/src/main/java/pub/doric/demo/MainActivity.java b/Android/app/src/main/java/pub/doric/demo/MainActivity.java index e2fa9ace..17db4e70 100644 --- a/Android/app/src/main/java/pub/doric/demo/MainActivity.java +++ b/Android/app/src/main/java/pub/doric/demo/MainActivity.java @@ -28,15 +28,24 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.function.Predicate; +import pub.doric.DoricDriver; +import pub.doric.dev.DevPanel; +import pub.doric.dev.event.EnterDebugEvent; +import pub.doric.dev.event.QuitDebugEvent; +import pub.doric.engine.ChangeEngineCallback; import pub.doric.utils.DoricUtils; public class MainActivity extends AppCompatActivity { - + private DevPanel devPanel = new DevPanel(); @Override protected void onCreate(Bundle savedInstanceState) { @@ -48,6 +57,7 @@ public class MainActivity extends AppCompatActivity { try { String[] demos = getAssets().list("demo"); List ret = new ArrayList<>(); + ret.add("Debug Kit"); for (String str : demos) { if (str.endsWith("js")) { ret.add(str); @@ -59,7 +69,38 @@ public class MainActivity extends AppCompatActivity { } } - public static class MyAdapter extends RecyclerView.Adapter { + @Override + public void onAttachedToWindow() { + super.onAttachedToWindow(); + + EventBus.getDefault().register(this); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + EventBus.getDefault().unregister(this); + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onEnterDebugEvent(EnterDebugEvent enterDebugEvent) { + DoricDriver.getInstance().changeJSEngine(false, new ChangeEngineCallback() { + @Override + public void changed() { + } + }); + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onQuitDebugEvent(QuitDebugEvent quitDebugEvent) { + DoricDriver.getInstance().changeJSEngine(true, new ChangeEngineCallback() { + @Override + public void changed() { + } + }); + } + + public class MyAdapter extends RecyclerView.Adapter { private final String[] data; @@ -91,6 +132,10 @@ public class MainActivity extends AppCompatActivity { tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + if (position == 0) { + devPanel.show(getSupportFragmentManager(), "DevPanel"); + return; + } Intent intent = new Intent(tv.getContext(), DemoActivity.class); intent.putExtra("source", data[position]); tv.getContext().startActivity(intent); diff --git a/demo/index.ts b/demo/index.ts index 158cd4e3..ef40e3af 100644 --- a/demo/index.ts +++ b/demo/index.ts @@ -4,4 +4,5 @@ export default [ 'src/ListDemo', 'src/ScrollerDemo', 'src/SliderDemo', + 'src/LayoutDemo', ] \ No newline at end of file diff --git a/demo/src/LayoutDemo.ts b/demo/src/LayoutDemo.ts new file mode 100644 index 00000000..4ff2e8a1 --- /dev/null +++ b/demo/src/LayoutDemo.ts @@ -0,0 +1,464 @@ + +import { Group, Panel, Text, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, slider, slideItem, scroller, IVLayout, IHLayout } from "doric"; +import { O_TRUNC } from "constants"; + +const colors = [ + "#f0932b", + "#eb4d4b", + "#6ab04c", + "#e056fd", + "#686de0", + "#30336b", +] + +function box(idx = 0) { + return (new Stack).also(it => { + it.width = it.height = 20 + it.bgColor = Color.parse(colors[idx || 0]) + }) +} +function boxStr(str: string, idx = 0) { + return (new Text).also(it => { + it.width = it.height = 20 + it.text = str + it.textColor = Color.parse('#ffffff') + it.bgColor = Color.parse(colors[idx || 0]) + }) +} +function label(str: string) { + return text({ + text: str, + textSize: 16, + }) +} +@Entry +class LayoutDemo extends Panel { + build(rootView: Group) { + scroller( + hlayout([ + vlayout([ + label("Horizontal Layout(Align to Top)"), + hlayout([ + box().apply({ + height: 20 + }), + box().apply({ + height: 40 + }), + box().apply({ + height: 60 + }), + box().apply({ + height: 40 + }), + box().apply({ + height: 20 + }), + ]).also(it => { + it.space = 20 + }), + label("Horizontal Layout(Align to Bottom)"), + hlayout([ + box().apply({ + height: 20 + }), + box().apply({ + height: 40 + }), + box().apply({ + height: 60 + }), + box().apply({ + height: 40 + }), + box().apply({ + height: 20 + }), + ]).also(it => { + it.space = 20 + it.gravity = gravity().bottom() + }), + label("Horizontal Layout(Align to Center)"), + hlayout([ + box().apply({ + height: 20 + }), + box().apply({ + height: 40 + }), + box().apply({ + height: 60 + }), + box().apply({ + height: 40 + }), + box().apply({ + height: 20 + }), + ]).also(it => { + it.space = 20 + it.gravity = gravity().center() + }), + label("Horizontal Layout(Weight)"), + hlayout([ + boxStr('weight=1', 3).apply({ + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + box(2), + box(4), + ]).apply({ + width: 200, + height: 30, + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + }, + bgColor: Color.parse('#eeeeee'), + gravity: gravity().center(), + } as IHLayout), + hlayout([ + box(3), + boxStr('weight=1', 2).apply({ + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + box(4), + ]).apply({ + width: 200, + height: 30, + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + }, + bgColor: Color.parse('#eeeeee'), + gravity: gravity().center(), + } as IHLayout), + hlayout([ + box(3), + box(2), + boxStr('weight=1', 4).apply({ + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + ]).apply({ + width: 200, + height: 30, + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + }, + bgColor: Color.parse('#eeeeee'), + gravity: gravity().center(), + } as IHLayout), + hlayout([ + boxStr('weight=1', 3).apply({ + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + boxStr('weight=1', 2).apply({ + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + box(4), + ]).apply({ + width: 200, + height: 30, + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + }, + bgColor: Color.parse('#eeeeee'), + gravity: gravity().center(), + } as IHLayout), + hlayout([ + boxStr('weight=1', 3).apply({ + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + boxStr('weight=1', 2).apply({ + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + boxStr('weight=1', 4).apply({ + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + ]).apply({ + width: 200, + height: 30, + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + }, + bgColor: Color.parse('#eeeeee'), + gravity: gravity().center(), + } as IHLayout), + ]).also(it => { + it.space = 20 + it.gravity = gravity().center() + }), + vlayout([ + label("Vertical Layout(Algin to Left)"), + vlayout([ + box(1).apply({ + width: 20 + }), + box(1).apply({ + width: 40 + }), + box(1).apply({ + width: 60 + }), + box(1).apply({ + width: 40 + }), + box(1).apply({ + width: 20 + }), + ]).apply({ + space: 20 + } as IVLayout), + label("Vertical Layout(Algin to Right)"), + vlayout([ + box(1).apply({ + width: 20 + }), + box(1).apply({ + width: 40 + }), + box(1).apply({ + width: 60 + }), + box(1).apply({ + width: 40 + }), + box(1).apply({ + width: 20 + }), + ]).apply({ + space: 20, + gravity: gravity().right(), + } as IVLayout), + label("Vertical Layout(Algin to Center)"), + vlayout([ + box(1).apply({ + width: 20 + }), + box(1).apply({ + width: 40 + }), + box(1).apply({ + width: 60 + }), + box(1).apply({ + width: 40 + }), + box(1).apply({ + width: 20 + }), + ]).apply({ + space: 20, + gravity: gravity().center(), + } as IVLayout), + label("Vertical Layout(Weight)"), + hlayout([ + + vlayout([ + boxStr('weight=1', 3).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + }, + }), + box(2).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + } + }), + box(4).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + } + }), + ]).apply({ + width: 100, + height: 200, + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + }, + bgColor: Color.parse('#eeeeee'), + gravity: gravity().center(), + } as IVLayout), + vlayout([ + box(3).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + }, + }), + boxStr('weight=1', 2).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + box(4).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + } + }), + ]).apply({ + width: 100, + height: 200, + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + }, + bgColor: Color.parse('#eeeeee'), + gravity: gravity().center(), + } as IVLayout), + vlayout([ + box(3).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + }, + }), + box(2).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + }, + }), + boxStr('weight=1', 4).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + ]).apply({ + width: 100, + height: 200, + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + }, + bgColor: Color.parse('#eeeeee'), + gravity: gravity().center(), + } as IVLayout), + vlayout([ + boxStr('weight=1', 3).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + }, + }), + boxStr('weight=1', 2).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + box(4).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + } + }), + ]).apply({ + width: 100, + height: 200, + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + }, + bgColor: Color.parse('#eeeeee'), + gravity: gravity().center(), + } as IVLayout), + vlayout([ + boxStr('weight=1', 3).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + }, + }), + boxStr('weight=1', 2).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + boxStr('weight=1', 4).apply({ + layoutConfig: { + widthSpec: LayoutSpec.AT_MOST, + heightSpec: LayoutSpec.EXACTLY, + weight: 1, + } + }), + ]).apply({ + width: 100, + height: 200, + layoutConfig: { + widthSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.EXACTLY, + }, + bgColor: Color.parse('#eeeeee'), + gravity: gravity().center(), + } as IVLayout), + ]).also(it => { + it.space = 20 + }), + + ]).also(it => { + it.space = 20 + it.gravity = gravity().left() + }) + ]).also(it => { + it.space = 20 + }), + ).also(it => { + it.layoutConfig = { + widthSpec: LayoutSpec.WRAP_CONTENT, + heightSpec: LayoutSpec.WRAP_CONTENT, + alignment: gravity().centerX(), + } + }) + .in(rootView) + } +} \ No newline at end of file diff --git a/demo/src/ListDemo.ts b/demo/src/ListDemo.ts index 49d692a5..c4572d97 100644 --- a/demo/src/ListDemo.ts +++ b/demo/src/ListDemo.ts @@ -1,4 +1,4 @@ -import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout } from "doric"; +import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text } from "doric"; const colors = [ "#f0932b", "#eb4d4b", @@ -10,7 +10,7 @@ const colors = [ @Entry class ListPanel extends Panel { build(rootView: Group): void { - rootView.addChild(vlayout([ + vlayout([ text({ text: "ListDemo", layoutConfig: { @@ -26,6 +26,7 @@ class ListPanel extends Panel { list({ itemCount: 1000, renderItem: (idx: number) => { + let counter!: Text return listItem( hlayout([ text({ @@ -39,43 +40,40 @@ class ListPanel extends Panel { textColor: Color.parse("#ffffff"), textSize: 20, height: 50, - bgColor: Color.parse('#00ff00'), }), text({ - layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, - alignment: gravity().center(), - weight: 1, - }, - text: `Right`, - textAlignment: gravity().right(), textColor: Color.parse("#ffffff"), textSize: 20, - height: 50, - bgColor: Color.parse('#00ffff'), }).also(it => { - let start = 0 - it.onClick = () => { - log(`clicked text:${start}`) - it.text = `${start++}` + counter = it + it.layoutConfig = { + widthSpec: LayoutSpec.WRAP_CONTENT, + heightSpec: LayoutSpec.WRAP_CONTENT, + margin: { + left: 10, + } } - }), + }) ]).also(it => { it.layoutConfig = { widthSpec: LayoutSpec.AT_MOST, heightSpec: LayoutSpec.WRAP_CONTENT, - alignment: gravity().center(), + margin: { + bottom: 2, + } + } + it.gravity = gravity().center() + it.bgColor = Color.parse(colors[idx % colors.length]) + let clicked = 0 + it.onClick = () => { + counter.text = `Item Clicked ${++clicked}` } - it.bgColor = Color.parse('#ffffff') }) ).also(it => { - it.bgColor = Color.parse(colors[idx % colors.length]) it.layoutConfig = { widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + heightSpec: LayoutSpec.WRAP_CONTENT, } - it.height = 100 it.onClick = () => { log(`Click item at ${idx}`) it.height += 10 @@ -99,6 +97,7 @@ class ListPanel extends Panel { widthSpec: LayoutSpec.AT_MOST, heightSpec: LayoutSpec.AT_MOST, } - })) + it.bgColor = Color.WHITE + }).in(rootView) } } \ No newline at end of file diff --git a/iOS/Example/Example.xcodeproj/project.pbxproj b/iOS/Example/Example.xcodeproj/project.pbxproj index 2b1ea696..13db7cbe 100644 --- a/iOS/Example/Example.xcodeproj/project.pbxproj +++ b/iOS/Example/Example.xcodeproj/project.pbxproj @@ -51,7 +51,7 @@ C043B7BA79339ABA1CF46881 /* libPods-Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; D751D19E97EF4EDD7588FEBE /* DemoVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoVC.m; sourceTree = ""; }; D751DDEC114E037231257E64 /* DemoVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoVC.h; sourceTree = ""; }; - E2334AEB22E9D2060098A085 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E2334AEB22E9D2060098A085 /* Doric Playground.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Doric Playground.app"; sourceTree = BUILT_PRODUCTS_DIR; }; E2334AEE22E9D2060098A085 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; E2334AEF22E9D2060098A085 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; E2334AF122E9D2060098A085 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; @@ -136,7 +136,7 @@ E2334AEC22E9D2060098A085 /* Products */ = { isa = PBXGroup; children = ( - E2334AEB22E9D2060098A085 /* Example.app */, + E2334AEB22E9D2060098A085 /* Doric Playground.app */, E2334B0322E9D2070098A085 /* ExampleTests.xctest */, E2334B0E22E9D2070098A085 /* ExampleUITests.xctest */, ); @@ -200,7 +200,7 @@ ); name = Example; productName = Example; - productReference = E2334AEB22E9D2060098A085 /* Example.app */; + productReference = E2334AEB22E9D2060098A085 /* Doric Playground.app */; productType = "com.apple.product-type.application"; }; E2334B0222E9D2070098A085 /* ExampleTests */ = { @@ -603,7 +603,7 @@ "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = pub.doric.Example; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_NAME = "Doric Playground"; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -621,7 +621,7 @@ "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = pub.doric.Example; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_NAME = "Doric Playground"; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/iOS/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/iOS/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index bbb277e8..fb23330f 100644 --- a/iOS/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/iOS/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -15,7 +15,7 @@ @@ -27,6 +27,15 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -49,17 +58,6 @@ - - - - - - - - diff --git a/js-framework/src/ui/view.ts b/js-framework/src/ui/view.ts index f473c9fd..893bf4dc 100644 --- a/js-framework/src/ui/view.ts +++ b/js-framework/src/ui/view.ts @@ -252,8 +252,16 @@ export abstract class View implements Modeling, IView { return this } + apply(config: IView) { + for (let key in config) { + Reflect.set(this, key, Reflect.get(config, key, config), this) + } + return this + } + in(group: Group) { group.addChild(this) + return this } nativeChannel(context: any, name: string) { diff --git a/js-framework/src/util/candies.ts b/js-framework/src/util/candies.ts index 65068507..528228c6 100644 --- a/js-framework/src/util/candies.ts +++ b/js-framework/src/util/candies.ts @@ -13,37 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -// import { View, Stack, VLayout, HLayout } from "../ui/view" - -// export type ViewBlock = () => View - -// export function stack(blocks: ViewBlock[]) { -// return takeAlso(new Stack)( -// it => { -// for (let block of blocks) { -// it.addChild(block()) -// } -// }) -// } - -// export function vlayout(blocks: ViewBlock[]) { -// return takeAlso(new VLayout)( -// it => { -// for (let block of blocks) { -// it.addChild(block()) -// } -// }) -// } - -// export function hlayout(blocks: ViewBlock[]) { -// return takeAlso(new HLayout)( -// it => { -// for (let block of blocks) { -// it.addChild(block()) -// } -// }) -// } - export function take(target: T) { return (block: (p: T) => void) => { block(target) diff --git a/js-framework/src/util/color.ts b/js-framework/src/util/color.ts index c16e4456..a703fa9a 100644 --- a/js-framework/src/util/color.ts +++ b/js-framework/src/util/color.ts @@ -35,7 +35,7 @@ export class Color implements Modeling { _value: number = 0 constructor(v: number) { - this._value = v + this._value = v | 0x0 } static parse(str: string) {