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

Set Rotate from propPanel default schema #290

Merged
merged 1 commit into from
Oct 26, 2023
Merged

Conversation

hand-dot
Copy link
Collaborator

Instead of mandating the implementation of 'rotate' for all elements, which would increase the developer's workload, allow for the omission of 'rotate' implementation on a case-by-case basis.

If 'rotate' is set here, enable rotate in the Designer, and if 'rotate' is not set here, make rotate unavailable.

@@ -242,6 +242,10 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
setEditing(true);
};

const rotatable = schemasList[pageCursor]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

detect rotatable or not

@@ -135,6 +135,9 @@ export const propPanel: PropPanel<TextSchema> = {
position: { x: 0, y: 0 },
width: 45,
height: 10,
// If the value of "rotate" is set to undefined or not set at all, rotation will be disabled in the UI.
// Check this document: https://pdfme.com//docs/custom-schemas#learning-how-to-create-from-pdfmeschemas-code
rotate: 0,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

set rotate as number

const ids = activeElements.map((ae) => ae.id);
const activeSchema = schemas.find((s) => ids.includes(s.id));

if (activeSchema?.type === 'text') {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

refactoring

@hand-dot hand-dot merged commit 3790a2a into main Oct 26, 2023
2 checks passed
@peteward
Copy link
Collaborator

nice!

@hand-dot hand-dot deleted the minorfix-for-rotate branch November 9, 2023 00:35
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.

None yet

2 participants