haxeui / haxeui-openfl

The OpenFL backend of the HaxeUI framework -
http://haxeui.org
MIT License
42 stars 14 forks source link

HaxeUI error when using SVG library #51

Closed devezas closed 3 years ago

devezas commented 4 years ago

Hi,

HaxeUI gives me an error if I use simultaneously HaxeUI lib and SVG lib. The error is as following:

C:/HaxeToolkit/haxe/lib/haxeui-openfl/1,1,0/haxe/ui/backend/AssetsImpl.hx:34: characters 27-30 : format.SVG should be haxe.ui.backend.ImageData C:/HaxeToolkit/haxe/lib/haxeui-openfl/1,1,0/haxe/ui/backend/AssetsImpl.hx:62: characters 23-26 : format.SVG should be haxe.ui.backend.ImageData

If I don't use the SVG library it compiles fine.

To reproduce this is easy, one only needs to use the sample code from "create openfl" and add the SVG library do the XML (after installing the SVG library first, of course!).

I'm using vscode with lime plugin in windows 10 pro enviroment, and my haxelib list is as following:

actuate: [1.8.9] advanced-layout: [0.9.1] akifox-transform: [2.2.1] box2d: [1.2.3] format: [3.5.0] hscript: [2.4.0] hxcpp-debug-server: 1.2.4 [dev:c:\Users\devmain.vscode\extensions\vshaxe.hxcpp-debugger-1.2.4\hxcpp-debug-server] hxcpp: 4.1.1 [4.1.15] hxnodejs: [12.1.0] layout: [1.2.1] lime-samples: [7.0.0] lime: 7.7.0 [7.8.0] openfl-samples: [8.7.0] openfl: 8.9.6 [8.9.7] starling: 2.5.1 [git] svg: [1.1.3] vscode-debugadapter: 1.40.0 [1.41.0] vscode: 1.45.0 1.46.0 [1.47.0]

Can you figure out what is wrong in this case, it only happens when I add the SVG lib to the project.

By the way, great job with the haxeUI!

Regards

ianharrigan commented 4 years ago

Hi!

Thanks for this, oversight on my part, pretty sure i know exactly what it is. Ill fix soon.

Cheers, Ian

tsmithf commented 3 years ago

Any update on the fix?

Thanks

ianharrigan commented 3 years ago

Oh, whoops... i completely forgot about this... Will update soon (maybe tonight)...

Sorry for the delay :)

Cheers, Ian

ianharrigan commented 3 years ago

OK, looking at this now (sorry for the delay again!) - just testing out my fix then will update - you'll need git version of haxeui-openfl

ianharrigan commented 3 years ago

Ok, so that should be working again now - i had to do it slightly differently than the way i wanted to do it because of how ImageData is abstracted inside haxeui-core, but it should work now.

Cheers, Ian

EDIT: you'll need git versions of haxeui-core and haxeui-openfl. If thats working can you close this issue?

tsmithf commented 3 years ago

Yep, that seems to work now, Thanks

The only error I'm getting now is "haxe.ui.styles.Style does not have a constructor" on var tmpStyle:Style = new Style();

But I'm guessing that's related to the changes you've made to Styles?

ianharrigan commented 3 years ago

Thats because the style has @structInit (https://code.haxe.org/category/beginner/declare-classes-with-structinit.html).

So you could do something like:

var s:Style = {
    left: 100,
    top: 100
}

s.color = 0xFF0000;
tsmithf commented 3 years ago

Yep, just getting there myself when I spotted the comment out // public function new() {} when I moved from 1.0.25