jointjs

Creating a ToolElement for every object JointJS

為{幸葍}努か 提交于 2019-12-06 10:11:51
I am trying to create a sort of a Tool menu for every object - when you click or hover over an element, it shows several actions that could be done: delete, rotate, enlarge, link, etc. I have used this question as the guideline - and was able to add and extend the ToolElement itself, with the help of the JFiddle . However, after that I got stuck on the functionality of linking. What I want to do is the green arrow. And when I click and drag the green arrow, I want the link to start dragging from the object, just like a port, only from the object itself. I tried reading the documentation, but

How to make jointjs paper responsive?

試著忘記壹切 提交于 2019-12-06 03:25:15
问题 I just discover javascript library JointJs and I implemented a graph with paper and rects. But I can't make it responsive when I reduce the browser size my graph doesn't display correctly. How can I make my paper responsive with jointjs ? 回答1: You can initially set the paper to be the same dimensions as it's containing element, but that's only calculated initially when the paper is created. If you want to paper to change size as you resize your browser, you'll need to react to resize events.

jointjs: prevent adding vertex by clicking on link

我们两清 提交于 2019-12-05 23:29:34
问题 I would like to add a label to a link by doing a doubleclick on the link. So this is my attempt: paper.on({ 'cell:pointerdblclick': function(cellView, event, x, y){ if (cellView.model.isLink()) { cellView.model.label(0, { position: .5, attrs: { rect: { fill: 'white' }, text: { text: 'my label' } } }); } }, }); The problem is, that by doing a doubleclick there is also a vertex beeing created at the same time. How can I prevent that? Or what would be another simple way to let users add a label

Why are my embedded JointJS elements overlapping?

故事扮演 提交于 2019-12-05 12:00:31
I am working on a JointJS graph, using DirectedGraph to take care of the layout and I am trying to achieve something similar to the image below. I need the nodes (A, B, C, D, E, F, G, H, I, J) to be "outlined" or enclosed in a separate node (Foo, Bar, Hmm). When I add all of the elements to the graph, everything is on top of each other. However, if I do not add the vertices between the regions, all the elements are laid out correctly, but without the vertices connecting the regions. Based on the code below, what am I doing wrong? Do the nodes (A, B, C, D, E, F, G, H, I, J) cause an error

style specific port in jointjs

时光总嘲笑我的痴心妄想 提交于 2019-12-04 21:53:08
1) I'm using JointJS diagramming lib. I want to change the css of a particular inPort when using joint.shapes.devs . For linking sourcePort to the target I'm using source: { id: source.id, selector: source.getPortSelector(sourcePort)} It's giving me accurate source port, but how to apply css on this particular port after knowing it as my source connector? Is there a way? 2) Can we fit/wrap the label automatically inside the element if its width is longer than the element-width? I'm using joint.shapes.devs.Atomic element(s). I came across foreignobject but don't know how to use it? Can anyone

How can I use JointJS with an application built with Angular CLI?

陌路散爱 提交于 2019-12-04 14:35:38
问题 I have installed jointjs via npm and also installed typings and code compiles/builds fine. Code import { Component } from '@angular/core'; import * as joint from '../../node_modules/jointjs/dist/joint.min'; export class AppComponent { title = 'app works!'; constructor( ) { // console.log(joint)// private jint: joint, } ngOnInit() { var graph = new joint.dia.Graph; } } Error shows up on the browser: Failed to compile. /home/vinay/angularapps/jjs/src/app/app.component.ts (17,31): Property

How to interactively create links in JointJS

一世执手 提交于 2019-12-04 07:15:49
I want to interactively add links to my JointJS based graph. My idea is to create a small temporary node on pointerdown with a link from the original node to this temporary node, drag it on top of another node and on pointerup create the real link removing the temporary link and node. Unfortunately I don't know how to convince the pointer to move the temporary element and not the node on which the pointerdown event happened. Any idea? Thanks! var tmp_obj; paper.on('cell:pointerdown', function(cellView, evt, x, y) { if(evt.button == 1) { // Freeze the selected node so it does not move paper

jointjs: prevent adding vertex by clicking on link

天大地大妈咪最大 提交于 2019-12-04 03:45:51
I would like to add a label to a link by doing a doubleclick on the link. So this is my attempt: paper.on({ 'cell:pointerdblclick': function(cellView, event, x, y){ if (cellView.model.isLink()) { cellView.model.label(0, { position: .5, attrs: { rect: { fill: 'white' }, text: { text: 'my label' } } }); } }, }); The problem is, that by doing a doubleclick there is also a vertex beeing created at the same time. How can I prevent that? Or what would be another simple way to let users add a label for a link? As shown in the docs ( http://jointjs.com/api#joint.dia.LinkView:addVertex ) just add this

JointJS Element with ports and tool items (delete, settings etc.)

与世无争的帅哥 提交于 2019-12-03 22:01:00
问题 I managed to enhance my SVG-shape with ports via: joint.shapes.devs.Element = joint.shapes.basic.Generic.extend(_.extend({}, joint.shapes.basic.PortsModelInterface, { // SVG markup with ports }); With this I get the output: I want to enhance this shape with a delete button. For that I have: joint.shapes.devs.toolElement = joint.shapes.basic.Generic.extend({ // markup for delete button }); based on Mike Goodwin´s solution in How to give JointJS elements a remove tool? My question: How can I

How can I keep jointjs cells from overflowing the paper?

强颜欢笑 提交于 2019-12-03 20:44:38
问题 I'm using jointjs to make diagrams which will be user-editable. The user may drag them around and relocate each cell. However, when a cell is dragged to the edge, it overflows and becomes cut off. I want to prevent this from happening, instead the cell to stop before it gets to the edge of the paper and not be allowed to cross the edge, thus always staying completely within the paper. The behavior can be seen in jointjs' very own demos here: http://www.jointjs.com/tutorial/ports Try dragging