Code Monkey home page Code Monkey logo

diagram-js-minimap's Introduction

diagram-js Minimap

Build Status

A minimap for diagram-js.

Minimap

Features

  • See the whole diagram in the minimap
  • Highlight current viewport
  • Click/drag/scroll the minimap to navigate the diagram

Usage

Extend your diagram-js application with the minimap module. We'll use bpmn-js as an example:

import BpmnModeler from 'bpmn-js/lib/Modeler';

import minimapModule from 'diagram-js-minimap';

var bpmnModeler = new BpmnModeler({
  additionalModules: [
    minimapModule
  ]
});

For proper styling integrate the embedded style sheet:

<link rel="stylesheet" href="diagram-js-minimap/assets/diagram-js-minimap.css" />

Please see this example for a more detailed instruction.

License

MIT

diagram-js-minimap's People

Contributors

adroste avatar anhaltfelix avatar barmac avatar bigianb avatar marstamm avatar nikku avatar philippfromme avatar renovate[bot] avatar rexxara avatar sayakmukhopadhyay 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

diagram-js-minimap's Issues

Minimap does not take element ordering into account

The minimap will regularly move parent elements in front of its children, whenever the parent is changed. Instead, it should take element ordering into account. That ordering can be read from the SVG document which maps to the models parent child hierarchy.

Steps to Reproduce

  • Add parent
  • Add child
  • Resize parent
  • Parent in minimap hides child

Expected

  • Minimap respects parent / child layering

Minimap crashes when opening

Describe the Bug

With the current release, the Minimap crashes when opening and interacting

Aug-07-2019 08-29-30

Additionally, you can see following error popping up

Minimap.js:725 Uncaught TypeError: Cannot read property 'width' of undefined
    at fitAspectRatio (Minimap.js:725)
    at mapMousePositionToDiagramPoint (Minimap.js:697)
    at setViewboxCenteredAroundClickEvent (Minimap.js:73)
    at SVGSVGElement.onMousedown (Minimap.js:101)

Steps to Reproduce

Steps to reproduce the behavior:

  1. Open Minimap
  2. Move a little around the minimap box

Expected Behavior

Should not crash and simply work.

Environment

Please complete the following information:

  • Browser: Chrome 76
  • OS: macOS 10.14.5
  • Library version: 2.0.0

Elements are duplicated after type has changed

Steps to reproduce

  1. Create task
  2. Change task type using the replace menu
  3. Move the task

Problem

A duplicate of the new task is permanently visible in the mini map

selection_089

Expected Behavior

No duplicates are visible

Angular: Minimap content does not show up immediately between different tabs

Describe the Bug

Kindly check this demo link

https://stackblitz.com/edit/bpmn-js-minimap-issue?file=src%2Fapp%2Fapp.component.html

The main issue is: in the first tab(Xml1) the minimap working good, but when we open the second tab (Xml2), the map is not displayed well (instead of displaying the graph in a yellow border, it is displayed a yellow point)

image

Steps to Reproduce

  1. Open the demo
  2. Open the second tab
  3. See the minimap does not provide the content of the tab diagram

After moving around on the canvas, the minimap appears again and works as expected.

image

Expected Behavior

The minimap shows up correctly immediately.

Environment

  • Host (Chrome/Node version : v14.18.0), if applicable: [e.g. MS Edge 18, Chrome 69, Node 10 LTS]
  • OS: [e.g. Windows 11]

Initial position in config

If used with properties panel, minimap is hidden.
How to set/change position in config ?

I see that code exist to manage position (MINIMAP_POSITION) but I don't see how to set an other value.

Children of collapsed shape are still displayed on minimap

Describe the Bug

When I collapse a shape, its children are still displayed on minimap.

Steps to Reproduce

See codesandbox: https://codesandbox.io/s/fervent-waterfall-n7ci0x?file=/src/index.js

Reported via https://forum.bpmn.io/t/mini-map-shows-inner-objects-when-outer-one-is-collapsed/8984

Expected Behavior

Children should be hidden.

Environment

  • Host (Browser/Node version), if applicable: [e.g. MS Edge 18, Chrome 69, Node 10 LTS]
  • OS: [e.g. Windows 7]
  • Library version: [e.g. 2.0.0]

Not unbinding event listeners

Current Behavior

  • We register a couple of event listeners (global ones on document, too!) and don't deregister them

Expected Behavior

  • Hook into the diagram.destroy event and cleanup registered event listeners
  • Alternative: Register global event listener only when drag operation started; clean it up once drag is finished / canceled

Make close indicator always clickable

Right now the minimap close indicator may be overlapped by the viewport indicator, making it unclickable:

bug

Expected Behavior

  • The close indicator can always be clicked

It would be even better if this mod works on mobile phone

Now bpmnjs supports the touch event on the mobile side, but the small map does not support it

I checked the code, the minimap only listens to the mousemove event, it may be a good way to add support for the touch event depending on the platform.

Minimap navigation breaks after resizing window

Describe the Bug

Clicking the minimap navigates to a different position after resizing the viewport. The larger the difference between the sizes before and after resizing is, the larger is the discrepency between where I want to navigate and to where the minimap actually navigates.
Dragging the box will still work, but cannot be used if the viewport is outside the diagram so clicking the minimap should work properly.

This is how it looks

Steps to Reproduce

  1. setup the environment, use one of these options
  2. zoom in to some element so you can see the effect more easily
  3. click the minimap once (everything should work as intended), if you skip step this then the resizing won't break the navigation
  4. resize the window eg. by snapping the browser window to one side or by resizing the dev-tools
  5. click the minimap again: now it navigates to a different position

Expected Behavior

The minimap should navigate to the position that was chosen on the minimap.

Environment

  • Host (Browser/Node version), if applicable: Chrome 92.0.4515.131
  • OS: Windows 10
  • Library version: 2.0.4

Click and wheel events on minimap broken?

With current version of diagram-js (0.27.2) the minimap and diagram show unexpected behavior.

When I click in the "white" area in the minimap (outside the dragging area) the "parent" diagram turns blank and the dragging area in the minimap disappears.
On one occasion I could get everything back by moving the diagram, so I guess the viewport is somewhere off.

When I use the mousewheel anywhere on the minimap the same happens.

I tried to disable the events on the svg in the dev console and then it's working ok.
My current workaround is to stop propagating the events in event capturing phase on the parent container (djs-minimap-map).

IMHO those events should be removed from the minimap anyway. The UX would be much more intuitiv. Especially now that the zooming in the diagram is done with CTRL+wheel.

Diagram preview should be aligned top-left to canvas origin, if it fits

image

Reproduce

  • open diagram with a single element only

Current Behavior

  • preview is centered (yellow X)

Expected Behavior

  • preview is aligned to the top-left (orange X)

Note

A positive side-effect of this change would be that the overall minimap noise caused by viewbox computation is minimized. Right now continuous re-layouting happens:

bug

Provide a pre-build version in CDN

Current implementation does not provide a pre-build distribution of the library that could be used in contexts that do not allow any build steps.

Would it be possible to provide those versions within a dist catalog (the way that bpmn-js itself does)?

Listen to events in minimap

Is your feature request related to a problem? Please describe.

Hello, I have integrated diagram-js-minimap4.0 in Camunda Bpmn, how do I listen to events in minimap through BpmnModeler?

[email protected] release issue

The release includes a ".git\hooks\README.sample" file.

This makes npm think its a git repo when its not which makes it rather unhappy:
npm install
npm ERR! path c:\Path\node_modules\diagram-js-minimap
npm ERR! code EISGIT
npm ERR! git c:\Path\node_modules\diagram-js-minimap: Appears to be a git repo or submodule.
npm ERR! git c:\Path\node_modules\diagram-js-minimap
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

Zoom out steps should smaller

Right now, when zooming out with zoom levels < 1 the zoom steps are huge, making it impossible zoom to an appropriate level in larger diagrams:

bug

Expected Behavior

  • Zooming in and out follows constant steps
  • Zooming has the same feel as the diagram-js ZoomScroll implementation

Minimap viewport indicator not shown initially

Reproduce

  • Bootstrap diagram-js with minimap initially closed (the default)
  • Open minimap

Current Behavior

  • Viewport indicator does not show

image

Expected Behavior

  • Viewport indicator shows after minimap open

Minimap is incompatible with diagram-js@7

Describe the Bug

I can not use the latest release with diagram-js@7

unhandled error in event listener TypeError: this._canvas.findRoot is not a function
    at Minimap._addElement (index.esm.js:588:1)
    at index.esm.js:273:1
    at bpmn-modeler.production.min.js:7:26123

Steps to Reproduce

  1. Include this lib with bpmn-js@8
  2. load a process
  3. it blows up

Expected Behavior

It works

Environment

  • Host (Browser/Node version), if applicable: [e.g. MS Edge 18, Chrome 69, Node 10 LTS]
  • OS: [e.g. Windows 7]
  • Library version: 2.1.0

Not working on Internet Explorer

Tested on IE 11 but I think later versions will have an issue too.
The problem is the recent change to use css. This line:
https://github.com/bpmn-io/diagram-js-minimap/blob/master/lib/Minimap.js#L374

var viewport = this._viewport = svgCreate('rect');
domClasses(viewport).add('viewport');

is the root cause because classList is not supported for svg elements in Internet Explorer. See the footnote on:
https://developer.mozilla.org/en-US/docs/Web/API/Element/classList

The solution is to set the attribute directly.

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.