Skip to content

Conversation

@mcyph
Copy link
Collaborator

@mcyph mcyph commented May 2, 2021

I've removed all the different STYLE_ variables from mxConstants to reduce the complexity of various files.

Next step I hope to create style templates which directly assign defaults to each variable so that they're stored in fewer places e.g.:

class StyleBase {
  highlightColor: string = "#00FF00";
  wordWrap: string = "normal";
  ...
}

I'd also like to remove mxUtils.getValue and similar methods, and make it so types are clarified. In particular, boolean values can be "1"/"0", 1/0, true/false in various places and would like to make them all simply use true and false unless there's a good reason not to because of the way things serialized. If these changes were made, it should be possible to change the following from:

if (mxUtils.getValue(shape.style, 'flipH', 0) == 1) {}

to be just:

if (shape.style.flipH) {}  // -> 

@mcyph mcyph requested a review from junsikshim May 2, 2021 07:24
@junsikshim
Copy link
Collaborator

I totally agree that those getSomethingValue methods are unnecessary. We should remove them as soon as possible.

Btw, on a totally different subject, how about keeping models separated from views as before?
I see mxCell is located in view/cell and mxGraphModel is in view/graph.
Since mxGraph provides helper functions so the users don't have to deal with mxGraphModel directly, so the line is a bit vague, but I think if we can keep the level of abstraction, there might be possibilities where we can substitute other type of views, or no-view(maybe SSR?).

@junsikshim junsikshim merged commit 57b118f into maxGraph:development May 8, 2021
@tbouffard tbouffard added the refactor Code refactoring label Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants