Code Monkey home page Code Monkey logo

Comments (3)

anvaka avatar anvaka commented on July 28, 2024

Interesting. Have you tried setting clearColor and clearColorValue in webgl graphics?

 var graphics = Viva.Graph.View.webglGraphics({
    clearColor: true,
    clearColorValue: { r: 0, g: 0, b: 0, a: 1 }
  });

These values are used here and from what you picture looks like I'm guessing the webgl renderer needs to clear the surface.

PS: Is this Safari for iOS?

from vivagraphjs.

jexp avatar jexp commented on July 28, 2024

Yes safari for iOS.

Thanks a lot, that worked :) Interesting that it doesn't need that on the desktop (Chrome or Safari).
Do you have any experience with using touch-events with vivagraph.js?

Cheers

from vivagraphjs.

anvaka avatar anvaka commented on July 28, 2024

Glad to hear it fixed the problem!

I tried to implement touch events once, but something stopped me, don't remember what. If you'd like to try, here is how input works.

The renderer class is responsible for input processing. It's lame, and I should have made it into a separate input processing system, but when I just started the library it didn't sound as a bad idea. Anyways, the renderer differentiates when user drags a node and drags a canvas (container with nodes). Handling container events is simple. The container is always a DOM element, and the renderer leverages browser's input events via the dragndrop class. But handling nodes events is different - in case of WebGL there is no help from the browser at all, thus I made a new abstraction in the library, called inputmanager. The input manager is provided by specific graphics object (CSS, SVG or WebGL) and serves as an interface, to let renderer handle nodes events. In case of CSS and SVG graphics, I'm reusing mentioned above dragndrop class. In WebGL I manually track mouse events from entire canvas, translate their coordinates into the graph space, and then perform a node lookup (which is now implemented as a linear search function, but this was never a performance bottleneck of the library).

To summarize. If you want to implement touch events you would need to update dragndrop class and webglInputEvents class.

Cheers,
Andrei

from vivagraphjs.

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.