Previously, when setting startFill/endFill, the display was inverted
comparing to the configuration.
The marker was filled when set to false, not filled when set to true.
When not set, the marker was filled, which is the expected default.
The issue came from a wrong condition to manage the default value and
was reproduced with the Markers Story.
In addition to the code fix, update the Markers.stories.js to fix style
configurations
- use number instead of string for markers size
- use boolean instead of number for start/end fill
The type of the `endArrow`, `startArrow` and `shape` properties in
`CellStateStyle` were too strict. They prevented to
use custom registered shapes in the style configuration without using a
cast.
Markers of the arrow and custom shapes can be registered by using
methods in `MarkerShape` and `CellRenderer` respectively.
The key to identify the shapes is a string so the types of the
properties in `CellStateStyle` now allow `string` as well.
These offer both the type guidance for standard maxGraph registered
shapes (via a dedicated type) and the extensibility
for custom shapes.
These properties were not documented after the style configuration was
changed (move from the string-based to the object-based configuration).
In mxGraph, the properties were documented in `mxConstants`.
The documentation is created based on `mxGraph`, `typed-mxgraph` and the
current `maxGraph` implementation.
Some properties remains undocumented because they are not used, some
have a wrong type (mainly number instead of boolean). This will be managed
in a next commit.
Co-authored-by: Souchet Céline <4921914+csouchet@users.noreply.github.com>
`StyleSheet.getCellStyle` didn't keep the properties of the default
style when `baseStyleNames` was set in the `cellStyle` parameter.
The JSDoc was incorrect (it came from mxGraph) about how the style is
computed, in particular about the default style. It probably leads to
the erroneous implementation during migration. It is now fixed and
clearly describe the rules followed to merge style properties.
The 'Stylesheet' story has been updated to correctly use the maxGraph
API. It also includes more examples involving `baseStyleNames` to
show the 'properties merge' in action.
The `align` and `verticalAlign` values passed to the constructor weren't
set, so the overlay position was always set to
the default one.
The `align` and `verticalAlign` properties are now using the AlignValue
and VAlignValue types respectively instead of
defining inline types. This improves the consistent in the whole code.
To demonstrate the fix, the Overlays story now set 'align' and
'verticalAlign' randomly.
Also introduce `jest` to test the fix and the whole
implementation of the changed method. Types check support is provided by
`ts-jest`. As maxGraph uses a lot of browser objects, also setup
`jest-jsdom-environment`.
The `CHANGE` event is now fired to `GraphSelectionModel` instead of `Graph`.
This is the behavior of mxGraph that was mistakenly modified during the migration of the code.
There was a logical error in processing `ChildChange` in `Graph`. When cell was removed, `ChildChange` created to change parent of removed cell to `null`. But in code, if parent is null, code to destroy child cell state was not called, so cell stayed rendered on canvas.
The fix add a check for "falsy" parent, so correct branch of code is executed and cells are destroyed.
Update the project status.
npm package availability:
- add a badge to display the latest version available in the npm
registry.
- explain how to install maxGraph in applications.
The former mxGraph tags have been removed. List them in the changelog
for history.
Also update the project status in the README as there is no more
blocking issue for a first release.
Add the `window.TouchEvent` guard prior code involving `TouchEvent`.
`TouchEvent` is not available in Safari and Firefox Desktop.
Co-authored-by: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com>
Co-authored-by: Анатолий Майоров <mayorov.ad@outlook.com>
We use a recent TypeScript version to build maxGraph but applications
that integrates it may be forced to use old TypeScript versions.
We never explain what is the minimum TypeScript version requires to use
`maxGraph`. The changes proposed here are a first step to make this
information available.
It is only informative for now (mentioned in the README) and the minimum
TypeScript version is tested in the `ts-support` package (part of the
'build' GitHub workflow).
Add base `tsconfig.json` to root of repository and extend packages upon
it. Refactoring `src` values of `tsconfig.json` of packages.
- Moved repeating declarations in base `tsconfig.json`
- Removed `ESNext` target/module/lib from `ts-example`, which will lead
to use of `es2020` from base `tsconfig.json`
Added `eslint` to project and configured it. The fixes will be applied later.
```
Found 1855 problems (709 errors, 1146 warnings) 🙈
628 errors and 291 warnings potentially fixable with the `--fix` option.
```
- Bumped Typescript to 4.8.3 and typedoc to 0.23.15
- Moved types IdentityObject and IdentityFunction to types.ts
- Renamed const FIELD_NAME to IDENTITY_FIELD_NAME and moved it to
util/Constants.ts
- Set Cell and CellOverlay to implement IdentityObject (found only them
using in Dictionary as key)