Giter Club home page Giter Club logo

cytoscape.js-grid-guide's People

Contributors

gregroyal avatar hasanbalci avatar kinimesi avatar lukethacoder avatar metincansiper avatar mrsfy avatar msalihaltun avatar nasimsaleh avatar royludo avatar ugurdogrusoz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cytoscape.js-grid-guide's Issues

Test performance for big graphs

We should test the performance of linear time guideline and alignment operations for large graphs (e.g. a few hundred nodes and a few hundred edges) to see if the performance is good enough for interactive use on such graphs.

Guidelines and tolerance

  • When the guidelinesTolerance option is zero (0), I still expect to see the guidelines when there is perfect alignment but I don't!
  • When the tolerance is non-zero (e.g. 2), guidelines should still be drawn horizontal or vertical to show where there would be perfect alignment.

Snap to guidelines

There should be a way to snap to guidelines (similar to snapping to grid). We should choose the closest guideline for this.

Compound nodes positioned off grid

With default options, a compound node's children will all nicely align with the grid and the compound node margins will also be modified to nicely align with the grid. See here:

before

And when you drag child nodes of the compound, they keep nicely aligning with the grid. However, when you drag the compound, sometimes, the compound gets positioned off the grid (resulting in children not properly aligning with the grid). See below:

after

Grid isn't drawn in latest Firefox

Although i think the issue is related to the latest Firefox version i'd like to point out that the grid isn't drawn in Firefx 59.0.1
Older versions, before Firefox Quantum, seems to work fine.

Show only points

How could we make it show only one point at each intersection in the grid?

Parent Nodes undraggable

Dragging via parent nodes is not possible. Need to modify applyToCyTarget on events_controller module.

Support change background

Hello! I want to upgrade your wonderful library so that it allows you to change the background. just pass the background setting (color)(change naming, this color is GridLinesColor):

gridColor: '#dedede', // Color of grid lines

Change as:

gridColor: '#fff', // Color of grid background
gridLinesColor: '#dedede' // Color of grid lines

, and after need add in svg rendering

<rect width="100%" height="100%" fill="url(#horizontalLines)" transform="translate('+ 0 + ', ' + initialValueY + ')" />\n\
<rect width="100%" height="100%" fill="url(#verticalLines)" transform="translate('+ initialValueX + ', ' + 0 + ')" />\n\

following code:

<svg width="'+ canvasWidth + '" height="'+ canvasHeight + '" xmlns="http://www.w3.org/2000/svg">\n\
            <defs>\n\
                <pattern id="horizontalLines" width="' + increment + '" height="' + increment + '" patternUnits="userSpaceOnUse">\n\
                    <path d="M ' + increment + ' 0 L 0 0 0 ' + 0 + '" fill="none" stroke="' + options.gridLinesColor + '" stroke-width="' + options.lineWidth + '" />\n\
                </pattern>\n\
                <pattern id="verticalLines" width="' + increment + '" height="' + increment + '" patternUnits="userSpaceOnUse">\n\
                    <path d="M ' + 0 + ' 0 L 0 0 0 ' + increment + '" fill="none" stroke="' + options.gridLinesColor + '" stroke-width="' + options.lineWidth + '" />\n\
                </pattern>\n\
            </defs>\n\
<rect width="100%" height="100%"  fill="' + options.gridColor + '" />\n\
<rect width="100%" height="100%" fill="url(#horizontalLines)" transform="translate('+ 0 + ', ' + initialValueY + ')" />\n\
<rect width="100%" height="100%" fill="url(#verticalLines)" transform="translate('+ initialValueX + ', ' + 0 + ')" />\n\

This result i showed on attached image:
image

Issue with cytoscape-edgehandles , wrong handlePositions

Dear Devs,
I am using cytoscape-grid-guide && cytoscape-edgehandles together.
Even though I have set handlePosition: "middle top", in cy.edgehandles but
handles are displayed at wrong position on hover, node selected.

  1. If i disable cy.gridGuide() , cy.edgehandles seem to work fine
  2. Node size and grid spacing seem to effect this behaviour too. Node size width,height 80,80 and grid spacing 100 would yield different handle position
  3. For very first time when i hover on node, handlePosition, appears at node center while i set it as handlePosition: "middle top", in cy.edgehandles

Code Pen Demo:
https://codepen.io/mafar/pen/JjYqvVp?editors=0010

ISSUE (Animated GIF):
See how handlePosition, offsets
bug
**ISSUE , First Hover node , handlePosition, appears at node center **

sss

Initialization pattern if used together with cytoscape.js-context-menus

While trying to use grid-guide and context-menus together I ran into the issue that the order of initialization of these extensions is crucial. To be more concrete:

  • First initializing context-menus and then grid-guide results in "TypeError: e is null" in cytoscape.js.
  • Initializing grid-guide first does not throw that error.

I suspect this is not intentional? :-)

Guidelines to initial mouse location

Initial mouse location (the location where we clicked on the node to be dragged) should also be remembered and taken into consideration during drag. So the user knows how the drag is proceeding w.r.t. initial mouse position.

Typescript / Angular 14 support

I have trouble to import the grud guide module to my angular project.

I get the following error:

Could not find a declaration file for module 'cytoscape-grid-guide'. '/home/user/xxx/node_modules/cytoscape-grid-guide/src/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/cytoscape-grid-guideif it exists or add a new declaration (.d.ts) file containingdeclare module 'cytoscape-grid-guide';``

Is there a typescript type definition that i can use?
Maybe you can create one for npm?

TypeError: cy.gridGuide is not a function

After #33 there is now the above issue on initialization. After minimizing our project it turns out that the following line called in another external library causes the issue:

if (window.jQuery) { jQuery.noConflict(); }

Since other plugins, like edgehandles etc., don't have the above issue I wonder if initialization of all plugins should not follow the same pattern, preferably that of plugins without the above issue?!

However, since the hack in #33 still works well for us, this is more a question of general curiosity for now :-)

Uninitialized cy variable

Hi guys,

I'm getting an error, while trying to include this plugin, registered with "Plain JS" method.

The problem is at line 1025 (probably somewhere else as well). 6fe4bfe

Uncaught ReferenceError: cy is not defined

I've added a temporary fix by assigning window.cy to an instance of cytoscape, but I'd say it has to be changed inside the plugin itself, as not everyone is assigning cytoscape to a window object directly.

Thanks

Snap during drag

Current we snap on mouse release. Can we (optionally if not complicated) make it snap during drag?

How to force a grid resize/rerender

I'm using this library with ReactJS and my page has the cytoscape graph in the mainview, and a sliding panel on the right. When the panel is closed, I would like the grid to re-calculate the size and update. Is there a way to force the grid to resize?

Meet UglifyJs error while building my web code

Have you ever made some uglifyjs related plugins config in your code?

I tried to compile my web code, but met the error:

ERROR in static/js/vendor.c2fa7ee7f34202a87f40.js from UglifyJs
Unexpected token name «of», expected punc «;» [./node_modules/cytoscape-grid-guide/src/guidelines.js:248,0][static/js/vendor.c2fa7ee7f34202a87f40.js:74852,13]

Build failed with errors.

npm ERR! code ELIFECYCLE

bug with geometric align on drag

When using the following options
geometricGuideline: true,
snapToAlignmentLocationDuringDrag: true,
If I select multiple nodes and move them together, they lose their alignment with one another.

ezgif com-video-to-gif (5)

Automove Support?

i'm trying to use the automove extension together with grid-guide. while the grabbed nodes are correctly aligned to the grid, it seems the nodes automatically moved by automove are not. the effect can be seen if you move the upper node in this fiddle.

please let me know if i missed something obvious! :-)

Canvas isn't resized on browser resizing

Hello,

grid-guide creates two additional canvas elements above of the cytoscape.js canvas elements. One of the both elements doesn't have any attributes, the other got an absolute position, top, left and z-index attributes. So far, no problem.
When the browser is resized and due to the layout, several HTML elements wrap, top and left attributes aren't updated like they were on other canvas elements from other cytoscape plugins.
This results in a problematically layout where you may drag and drop the canvas outside of the borders of the desired area. Additionally node's touchpoints are postponed.

Before resizing:
before

After resizing:
after

Improving guideline usability

I think the guidelines would be more usable (better user experience) if

  • a node is not aligned (no guidelines are drawn for) with a node which overlaps this one (e.g. two nodes whose bounds are are currently overlapping or a child node with its parent node)
  • a node is not aligned with a node which is too far from it (more than 5 times the ideal edge length or default average node size?)

Guidelines messed up when window resized

To reproduce (on Windows 10 with latest Chrome):

  • Start ChiSE with a full screen window,
  • Then resize the window to be smaller. Now the guidelines seem to be messed up (displayed in incorrect locations).

TypeError $ is not a function

Initialization of the plugin does not work in my setting due to the above error. In order to make it work I had to adjust the plugin as given below, maybe someone finds this helpful.

},{"functional-red-black-tree":1}],7:[function(require,module,exports){
;(function($){ 'use strict';
// registers the extension on a cytoscape lib ref
[ ... ]
})(jQuery);

Why was Cytoscape.js dependency updated?

I realized that Cytoscape.js dependency was updated to 3.3.0 4d36ff8 As far as I know, we have maintained backward compatibility pretty well and it should work with all versions >=1.6.0

If backward compatibility will be removed, then it should be removed from the source code as well. There are a couple of checks and conditions that we use to provide backward compatibility.

Guidelines performance

Performance on drag is in state of concern due to guidelines espesically in bigger graphs.

Not enough room for guidelines

When there is not enough room for guidelines, it's probably not worth drawing guidelines. See example below (where there isn't enough room for vertical distribution guidelines):
not-enough-room-for-guideline
So, below a certain length (not long enough to accommodate a line with arrows), they shouldn't be drawn at all (would be best to let the user define this as an extension option).

Be compliant with JS strict mode

I'm using a framework enforcing the JS strict mode and I encountering some errors due to some uninitialized variables like

  • calculateOffset in guideline.js
  • padding in parentPadding.js

Is it possible to ensure the respect of the strict mode ?

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.