[PLUGIN] Canvas

Post your completed addons to share with the community

Post » Thu Jun 13, 2013 11:35 pm

Yeh, I noticed too, that the C2 JS minify makes on HTML5 export the Canvas Plug-In buggy. What could it be - the Plug-In code or C2 itself?!
B
11
S
3
G
3
Posts: 79
Reputation: 3,343

Post » Mon Jun 17, 2013 8:36 pm

Hm, last time I thought that the problems are coming from JS minify option only, but unfortunately I was wrong. Also without minifing, the Canvas makes Chrome and Firefox stuck and crash. I'm sure, that the situation is connected to the continuously improvement of C2 and its newest versions, because I didn't observed problems before a month or two. And I like the Canvas Plug-In and I'm using it strongly in all my ideas.
B
11
S
3
G
3
Posts: 79
Reputation: 3,343

Post » Wed Jun 19, 2013 11:07 pm

Please R0J0hound, here some more detail from my observations... maybe you could find some time to take a look... ?!

Simple Project: just the Canvas Plug-In and a simple procedure to draw a line with every mouse movement.

Link to HTML5 uploaded: HTML5 Site

Link to C2 r132 CAPX: CAPX

You can try this at home: start moving the mouse over the Canvas Object and observe the memory amount needed for the browser application. I took two screenshots, one from Chrome (version 27.0.1453) operation and one from Mozilla (version 21.0). Both behave the same: crashing after memory full.

Links to both screenshots: Screenshot 1 Scrrenshot 2
B
11
S
3
G
3
Posts: 79
Reputation: 3,343

Post » Fri Jun 21, 2013 5:33 pm

I've used the Canvas plugin and haven't experienced any crashes.
Have you tried using another computer?
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Fri Jun 21, 2013 5:35 pm

Haven't tried a lot canvas with minify, but a normal, without minify, export, it works fine.
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Mon Jun 24, 2013 6:33 pm

@R0J0hound - if I make a family of Canvas objects, the project won't load on IE (loading progress bar stops at 70%). Any quick fix for that issue?

If I remove the Canvas family, the project loads.

Anyway, it's a great plugin, thank you for your work!

UPDATE: eliminated the families from the project, and now floodfill doesn't work on IE: it fills with white instead of the specified color.

The same code works perfect on FF or Chome. I hate IE.   mordskerl2013-06-26 10:38:49
B
6
S
1
Posts: 10
Reputation: 1,114

Post » Wed Jun 26, 2013 11:51 am

I have found the floodfill bug. If anyone interested:

In the plugins runtime.js, in the flood_fill funtcion the trick below doesn't work on IE:

var color = $('<div></div>').css('background-color', _color).css('background-color').slice(4,-1).split(",");

If you replace the line above with this, it will work fine:

var color = _color.substring(_color.indexOf("(")+1).split(",");

DRAWBACK: you can't pass nice colorname or HSL color parameters, it will work only with rgb(R,G,B) or rgba(R,G,B,A) format.

I admit not the nicest fix, but the floodfill will work in IE too.
B
6
S
1
Posts: 10
Reputation: 1,114

Post » Wed Jun 26, 2013 5:15 pm

[QUOTE=California] I've used the Canvas plugin and haven't experienced any crashes.
Have you tried using another computer? [/QUOTE]

Yeh, you are somehow right... on another computer the same page worked without memory overflow. Obviously the problem is with my graphic driver, or generally with my old and overwhelmed WinXP installation.
B
11
S
3
G
3
Posts: 79
Reputation: 3,343

Post » Wed Jul 03, 2013 11:34 pm

[QUOTE=mordskerl] I have found the floodfill bug. If anyone interested:

In the plugins runtime.js, in the flood_fill funtcion the trick below doesn't work on IE:

var color = $('<div></div>').css('background-color', _color).css('background-color').slice(4,-1).split(",");

If you replace the line above with this, it will work fine:

var color = _color.substring(_color.indexOf("(")+1).split(",");

DRAWBACK: you can't pass nice colorname or HSL color parameters, it will work only with rgb(R,G,B) or rgba(R,G,B,A) format.

I admit not the nicest fix, but the floodfill will work in IE too. [/QUOTE]

Thx for this tip! using RGB values fixed wrong color.
What about minify? Can you use it when you use canvas plugin in your projects? For me everytime it fails, js file with all the code is not minified.

Edit:

also what I noticed that any "full screen in browser" need to be set to off otherwise flood fill is not working.misiek35102013-07-04 09:32:32
B
5
Posts: 4
Reputation: 283

Post » Mon Jul 22, 2013 9:37 pm

Is it possible to read a pixel colour from a point on the canvas at all?
Lifelong Game Developer. Developer of The #AdLiberum Engine - Multiplayer Text Adventure Game Engine.
B
33
S
6
G
4
Posts: 133
Reputation: 3,719

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: Kev5454, Kyatric, Lordshiva1948 and 3 guests