GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — maxGraph/packages/js-example-selected-features at main · maxGraph/maxGraph

Expand file tree

/

js-example-selected-features

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

js-example-selected-features

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src
src
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
favicon.svg
favicon.svg
 
 
index.html
index.html
 
 
package.json
package.json
 
 
webpack.config.js
webpack.config.js
 
 

README.md

Outline

Integrate maxGraph in a vanilla JavaScript project built with Webpack - features selection

This example only loads the features and configuration required by the application for an efficient tree-shaking.

So, it demonstrates how to only register Shapes, Perimeters, EdgeMarkers and EdgeStyles used by the application.

It also uses the following set of features:

  • Cells selection by mouse click or with Rubberband
  • Management of selected cells
  • Fit and zoom using buttons
  • Panning with mouse drag

As in the js-example example, it demonstrates how to import/decode an XML model using Codecs.

Note: This example should be kept in sync with the js-example example as it replicates the same use case.

Setup

From the repository root, run:

npm install
cd packages/core/
npm run build
cd ../../packages/js-example-selected-features/
# For more details see 'Run' below
npm run dev

For more build information see: @maxgraph/core.

Run

Run npm run dev from this directory and go to http://localhost:8080/

If you want to bundle the application, run npm run build and then run npm run preview to access to a preview of the bundle application.

Analyze the bundle

Rsdoctor is available to inspect what ends up in the bundle, which is useful to check the effect of the tree-shaking of maxGraph.

Run npm run build:analyze from this directory. This builds in production mode with Rsdoctor enabled, then opens the report in the browser. Press Ctrl+C to stop the report server.

Rsdoctor is intentionally not part of npm run build: it slows the build down and starts a server, so it is only enabled by the build:analyze script. The report is generated locally and is never published by the CI.

The production build also enforces a size budget, see the limits passed to withBundleAnalysisAndSizeBudget at the bottom of webpack.config.js. They are the current bundle size rounded up to the next kB, so npm run build fails when the bundle grows. Use npm run build:analyze to find out what was added, and update the limits when the increase is intended.

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.