Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(): Convert align guidelines to TS. Add build system for extensions #10043

Merged
merged 26 commits into from
Aug 11, 2024

Conversation

zhe-he
Copy link
Contributor

@zhe-he zhe-he commented Aug 6, 2024

To avoid disrupting the original file structure, I placed the main code in the lib folder and only added exports in the entry file. At the same time, it supports the configuration related to reference lines.
how to use:

import { initAligningGuidelines } from "fabric";

initAligningGuidelines(canvas);

Copy link

codesandbox bot commented Aug 6, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

fabric.ts Outdated
@@ -178,3 +178,5 @@ export { Control } from './src/controls/Control';
export * as controlsUtils from './src/controls';

export * from './src/filters';

export { initAligningGuidelines } from './lib/aligning_guidelines/index';
Copy link
Member

Choose a reason for hiding this comment

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

this is the issue i want to solve. I don't want to package those in this way.
I ll need to work out a way for rollup to produce a different bundle that has fabric has an external dep and that is reacheable from fabric/plugin or something like that

@asturur
Copy link
Member

asturur commented Aug 7, 2024

I will rename lib into plugins as first step

@asturur
Copy link
Member

asturur commented Aug 10, 2024

worked a bit on the build system this morning, still requires some tweaks.

@@ -0,0 +1,11 @@
import * as fabric from 'fabric';
import { initAligningGuidelines } from 'fabric/extensions';
Copy link
Member

Choose a reason for hiding this comment

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

@zhe-he this is how i want to import the extensions like the guidelines.
I think we can refine this so that splitting and node/browser are still possible cdn links

@asturur asturur changed the title feat: add v6 aligning guidelines feat(): Convert align guidelines to TS. Add build system for extensions Aug 10, 2024
? activeObjectX + activeObjectWidth / 2 + aligningLineOffset
: activeObjectX - activeObjectWidth / 2 - aligningLineOffset,
};
}
Copy link
Member

Choose a reason for hiding this comment

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

@zhe-he this file seems completely unused. Why is it here? can i delete it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this file is not used anywhere, and you can delete it. In the original alignment version, there is a parameter called aligningLineOffset, and I found that its use case is completely ineffective in the new version. Later, I forgot to delete this file, and the offset property in AligningLineConfig should also be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@asturur
Copy link
Member

asturur commented Aug 10, 2024

I will merge this code as is because i don't really have time to review the implementation.
I will do that later and ping you for questions and to look at eventual changes.
I still need to verify that i can write a unit test and that the unit test run correctly and that i can make a playwright test for those.
Also different build types.

@asturur
Copy link
Member

asturur commented Aug 11, 2024

I set up the base for testing and building

@asturur asturur merged commit 4dd0ef7 into fabricjs:master Aug 11, 2024
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants