Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Error with path when render Shape as svg #101

Open

Description

@rosskhanas

I try to render svg but have an error when rendering Shape.

js/app.js:2271 Error: <path> attribute d: Expected moveto path command ('M' or 'm'), "[object Object]".

I've made a fork of one project to show the issue:
https://github.com/rtkhanas/hex-demo

All I did is - I added a single line to render on svg instead of canvas in src/js/index.js:

require('art/modes/current').setCurrent(require('art/modes/svg'));

I suspect that the problem is not with react-art but with art project, but not sure yet.

Activity

  1. AnneBai commented on Oct 8, 2018

    @AnneBai

    I've met the same problem as yours, I found the 'path' don't work when I want it to draw in svg mode. Here's What I do to solve(Omitted common details):

    import ReactART from 'react-art';
    // In svg mode
    import 'art/modes/svg'; 
    import SVGPath from 'art/modes/svg/path';
    
    // instead of 'const path = new ReactART.Path()...'
    const path= new SVGPath().move(200, 20)...
    

    OK, it works and the Error never come. Maybe the key is that in svg mode, we need apply the 'art/modes/svg/path' instead of 'ReactART.Path' as the Path constructor function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions