Skip to content

Conversation

@gelvidge
Copy link

@gelvidge gelvidge commented Jun 1, 2022

Summary
Fixes majority of html examples. Some small bugs may remain but 99% ok

Description for the changelog
Updates example html files and fixes bugs in core code that were found when testing

Other info

covers #73

Copy link
Collaborator

@junsikshim junsikshim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

I had to remove NODE_OPTIONS=--openssl-legacy-provider to make it run though, people with older versions of node (< 17) would face this problem.

A couple of things to comment on.

  • Please run prettier on all the files so that the styles stay the same.
  • I think IDE configuration files should be excluded from git repository(add to .gitignore), but it's up for debate.

Thanks!

*/
isLayer(cell: Cell) {
return this.isRoot(cell.getParent());
return cell != null && this.isRoot(cell.getParent());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If cell can be null or undefined, I think it's better change the method signature,
perhaps something like isLayer(cell?: Cell).

* left side of the current selection. Default is false.
*/
guidesEnabled = false;
guidesEnabled = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If guidesEnabled should be true by default, please update the comments above. :)

* Maximum number of cells for which live preview should be used. Default is 0 which means no live preview.
*/
maxLivePreview = 0;
maxLivePreview = 50;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like above, please change the comment accordingly if the default value must change.




for (var i = 0; i < childCount; i++)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get rid of vars. :)

container.style.width = `${args.width}px`;
container.style.height = `${args.height}px`;
container.style.width = '321px';
container.style.height = '241px';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be great if we can set the pixel values using storybook arguments.

Copy link
Member

@tbouffard tbouffard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing this Pull Request. This is a lot of work.
I am pretty sure that the Pull Request contains a lot of valuable work but it is too large to review.
It also contains too much unwanted formatting changes that makes it hard to read.

There are also some logic changes that requires to be discussed because I don't understand why they are needed. I don't have time to look at all commits to try to find where they could be required.
The lib has no automatic tests, and examples don't cover all use cases. It is also very easy to fix an example and break another one. The current proposal also contains several default changes that need to be discussed.

I suggest to split the work into several smaller Pull Requests: start with examples that only require storybook files changes. That way, we can review and merge working examples quickly and have more time to discuss tricky subjects

"webpack-merge": "^5.8.0"
},
"sideEffects": true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra change

decode(node: Element, into?: any): any {


//****Edit note - there may be other classes needed here????******
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

// @ts-ignore
ctor = window[node.nodeName];
ctor = classMap[node.nodeName]
if (ctor == undefined) console.log(node.nodeName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do proper Error management

imageBorder?: ColorValue;
imageHeight?: number;
imageWidth?: number;
imageVerticalAlign?: VAlignValue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For indicator only? There was no need for this in the original mxGraph code, why do we need this now?

(transients == null || transients.indexOf(i) < 0)
) {
if (!shallow && typeof obj[i] === 'object') {
if (!shallow && typeof obj[i] === 'object') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra change + formatting issue

"main": "index.js",
"scripts": {
"dev": "start-storybook -p 8901"
"dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 8901 ./public"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this: see #74 and #64 (reply in thread)

}
};

//getBBox of SVG element before rendered in DOM
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please write proper JSDoc

Comment on lines 1822 to 1827
bbox = new Rectangle(
(x + 1) * s.scale,
x * s.scale,
(y + 2) * s.scale,
w * s.scale,
(w +1) * s.scale,
(h + 1) * s.scale
);
Copy link
Member

@tbouffard tbouffard Jun 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure the previous implementation cames from the orignal mxGraph.
There are a lot of place where there are +1 on position, width or height. It is very hard to do the review here. Unfortunately, I don't have time to dig into the 56 commits to find which example may need the change and how this change impacts other examples.

if (point) {
perimeter = edge.style[source ? 'exitPerimeter' : 'entryPerimeter'] || false;

perimeter = edge.style[source ? 'exitPerimeter' : 'entryPerimeter'] || true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't change defaults

>;
type PartialType = PartialGraph & PartialFolding;

Client.imageBasePath = '/images'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are changing the configuration here and this impacts all users of the lib, not only the example.

@gelvidge
Copy link
Author

gelvidge commented Jun 7, 2022

Thanks both for reviewing and thanks for the feedback. I'll look into seeing how the PR can be improved by splitting and tidying up some of the formatting

@tbouffard
Copy link
Member

tbouffard commented Jun 8, 2022

@gelvidge hi, I will have some time on Thursday (June, 9th) to work on the project. I can try to cherry-pick some commits that quickly fix the examples in a dedicated PR.
Please let me know

@aminosbh
Copy link

@gelvidge we are currently on the process of changing the license of this project to the standard Apache 2.0 license (see #89). Do you agree to use the Apache 2.0 license on your contribution ?

@gelvidge
Copy link
Author

Yes that is OK. I will aim to get around to submitting the new commits soon but all my contributions can be under Apache v2

@tbouffard tbouffard mentioned this pull request Oct 9, 2022
@tbouffard
Copy link
Member

@gelvidge hi, do you still plan to recreate some PR based on the fixes proposed here?
@mayorovad started fixing some stories and some are already merged. That's why there is some merge conflicts here.

So I suggest you synchronize together if you both want to set new stories.

@tbouffard
Copy link
Member

This PR is kept opened on purpose even if it won't be merged. There is no need to update it, nor rebase it, as it it too large.

However, it contains a lot of valuable information and fixes. It can be used as a source of information to create new focused and small PR about a single topic.

@tbouffard
Copy link
Member

Closing this PR.
It will be used to pick some changes when fixing remaining problems in stories. See #505.

@tbouffard tbouffard closed this Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants