rcarcasses / vue-cytoscape

cytoscape.js now inside vue.js
https://rcarcasses.github.io/vue-cytoscape
MIT License
96 stars 34 forks source link

CyElement onPositionChange undefined #51

Closed PadreSVK closed 4 years ago

PadreSVK commented 4 years ago

Hi I have problem with onPositionChange method when parameter position have value undefined. I dont know from where could be this undefined value, because all my edges and nodes have property position (some of them with empty array). I use same cytoscape instance for more "graphs" and this issue appears when I change graph (nodes, edges and config).

<cytoscape
    ref="cy"
    :preConfig="preConfig"
    :afterCreated="afterCreated"
    :config="config"
    class="viewport-y-full"
>
    <cy-element
        v-for="node in nodes"
        :key="`${node.data.id}`"
        :definition="node"
        v-on:click="graphNodeClick($event)"
    />
    <cy-element v-for="edge in edges" :key="`${edge.data.id}`" :definition="edge" />
</cytoscape>

It is possible to add default value null for parameter position? null is friendly with JSON.parse 😊 https://github.com/rcarcasses/vue-cytoscape/blob/master/src/components/CyElement.ts#L96

rcarcasses commented 4 years ago

Hi @PadreSVK, looks fine to me, can you bump also package version in package.json in your pull request?

PadreSVK commented 4 years ago

sure 👍

PadreSVK commented 4 years ago

It is ok version in PR title or could be elsewhere?

rcarcasses commented 4 years ago

merged, update to version 1.0.8.