-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
Conversation
@@ -242,6 +242,10 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => { | |||
setEditing(true); | |||
}; | |||
|
|||
const rotatable = schemasList[pageCursor] |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactoring
nice! |
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.