Giter Club home page Giter Club logo

Comments (14)

alexislozano avatar alexislozano commented on August 26, 2024

Hey ! I never thought of having a canvas in neutrino, but that should be possible I think. I am not sure what is the problem in what you have. First, are the provided examples working ? Second, you can add .set_debug() to your window in order to get the right click and the code inspector.

from neutrino.

GuzTech avatar GuzTech commented on August 26, 2024

Well, if we have access to a canvas, then we can basically do anything. Yes, the examples work well (except for the contrast, because I use a dark theme but that's a separate thing).

I didn't know about .set_debug(), I'll try it and see what goes wrong.

from neutrino.

GuzTech avatar GuzTech commented on August 26, 2024

I have added .set_debug() to the hello_world demo and used the inspector. When I right click and select `Inspect Element' nothing happens the first time. The second time, I get this window:

Screenshot from 2019-09-25 21-02-43

Sometimes it will rerender the window, and I lose the right click menu. So unfortunately it doesn't help me. Btw, this also happens with my widget.

from neutrino.

alexislozano avatar alexislozano commented on August 26, 2024

Weird that it does not work with hello_world. I just tried it with set_debug() I get the right result :
5
Seems that your issue is that you have a tag mismatch... Could you try displaying the whole evaluated html ? Maybe you'll see where the issue is ?

from neutrino.

alexislozano avatar alexislozano commented on August 26, 2024

When I say "display" I mean using println! in the render() function of Window

from neutrino.

GuzTech avatar GuzTech commented on August 26, 2024

I added println!("{}", rendered); to the render() function of Window:

render("<div id=\"app\"><style type=\"text/css\"></style><canvas id=\"my_graph\" width=\"500\" height=\"500\"></canvas>
            <script>
            var canvas = document.getElementById('my_graph');
            var context = canvas.getContext('2d');
            context.beginPath();
            context.moveTo(100, 20);
            context.lineTo(200, 160);
            context.lineWidth = 5;
            context.strokeStyle = 'blue';
            context.stroke();
            </script></div>")

But like I said, I have very little experience with HTML, CSS, and other web related stuff, so maybe I'm doing something very wrong here.

from neutrino.

alexislozano avatar alexislozano commented on August 26, 2024

It seems okay to me :/ I'll try it tomorrow ;)

from neutrino.

GuzTech avatar GuzTech commented on August 26, 2024

Ah, I checked the console output and I see a looooot of output, and at the end an error:

output.txt

from neutrino.

alexislozano avatar alexislozano commented on August 26, 2024

Oh yes, it is because the render JavaScript function cannot take as an input a string containing line breaks. I need to work on this :/

from neutrino.

GuzTech avatar GuzTech commented on August 26, 2024

I see. So I changed the the html section to one string without line breaks, and I don't get that error anymore. It still doesn't work though, and the inspection gives the same error as in the picture I posted before.

Maybe it's related to the web-view crate.

from neutrino.

alexislozano avatar alexislozano commented on August 26, 2024

@GuzTech : I now have the same error as you with webkit... Are you using Archlinux ? Have you found how to solve it ?

from neutrino.

GuzTech avatar GuzTech commented on August 26, 2024

Sorry for the late reply. Yes I'm running Arch. I haven't looked into solving this issue, so unfortunately no :'(

from neutrino.

alexislozano avatar alexislozano commented on August 26, 2024

I just updated my packages, webkit2gtk is now 2.26.2-1, and the inspector seems to be working :D

from neutrino.

GuzTech avatar GuzTech commented on August 26, 2024

I can confirm that the inspector is working! However, the context menu after right-clicking appears only once, so if I misclick, then the menu does not appear anymore.

from neutrino.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.