Compose.jl icon indicating copy to clipboard operation
Compose.jl copied to clipboard

Error displaying in Blink Window

Open zsunberg opened this issue 5 years ago • 3 comments

using Blink
using Compose # master branch on Julia 1.0

c = compose(context(), rectangle())
body!(Window(), c)

causes the following javascript error in the electron window:

VM164:59 Uncaught TypeError: Cannot read property 'on' of undefined
    at eval (eval at <anonymous> (blink.js:74), <anonymous>:59:166)
    at eval (eval at <anonymous> (blink.js:74), <anonymous>:64:445)
    at eval (eval at <anonymous> (blink.js:74), <anonymous>:8:109)
    at eval (eval at <anonymous> (blink.js:74), <anonymous>:8:121)
    at eval (<anonymous>)
    at blink.js:74
    at NodeList.forEach (<anonymous>)
    at evalscripts (blink.js:73)
    at fillnofade (blink.js:120)
    at blink.js:112

However,

open("/tmp/test.html", "w") do f
    show(f, MIME("text/html"), c)
end
run(`firefox /tmp/test.html`)

works fine. Is this a problem with Blink or Compose? I also filed https://github.com/JunoLab/Blink.jl/issues/152 .

Probably isn't too urgent to fix this - a workaround is to render it as an SVG and show that instead:

c = compose(context(), rectangle())
win = Window()
x, y = size(win)
s = SVG(0.98*x*px, 0.98*7*px)
draw(s, c)
body!(win, s)

zsunberg avatar Sep 18 '18 22:09 zsunberg

I suspect this is an issue with Blink.jl. Not sure TBH.

using Compose #master
using Gadfly #master

c = compose(context(), rectangle())

renders just fine in my hands.

tlnagy avatar Sep 19 '18 19:09 tlnagy

@tlnagy do you mean it renders fine in a Blink window, or in a browser?

zsunberg avatar Sep 19 '18 20:09 zsunberg

Sorry I wasn't specific. In a browser window. That approach uses Gadfly's rendering to display the Compose context.

tlnagy avatar Sep 19 '18 20:09 tlnagy