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

#150 line shape created #173

Merged
merged 4 commits into from
Aug 12, 2024

Conversation

oleojake
Copy link
Collaborator

@oleojake oleojake commented Aug 11, 2024

Created Line Basic Shape. Closes #150

I had to do some fixing, the transformer works badly for very small elements. I have created a 10 px transparent rectangle containing the line so it can work.

@brauliodiez I have a question here, should we change the drag "points" of the transformer for certain figures? For example, a line could only be extended to the sides, but not from the corners.

Do you think it could be solved directly from the Hook of the transformer? I've made some approximations and it seems to work, but I'd have to get some info from the provider, I don't know if you want me to take a look at it.

//useEffect
		if (transformerRef.current) {
			if (selectedShapeType === 'line') {
				transformerRef.current.enabledAnchors(['middle-left', 'middle-right']);
			} else {
				transformerRef.current.enabledAnchors([
					'top-left', 'top-center', 'top-right',
					'middle-left', 'middle-right',
					'bottom-left', 'bottom-center', 'bottom-right'
				]);
			}`

CPT2408111654-575x390

@oleojake oleojake requested a review from brauliodiez August 11, 2024 14:55
@brauliodiez
Copy link
Member

Wow sounds quite interesting what you mention, we can create a helper in the canvas.model, where in the switch case the default just places the standard one, if it's e.g. line we just place the simple one

@brauliodiez brauliodiez merged commit 7085ad2 into main Aug 12, 2024
1 check passed
@brauliodiez brauliodiez deleted the feature/#150-create-line-shape-under-basic-shapes branch August 12, 2024 15:56
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.

Create a Line Shape as konva Component under BASIC SHAPES
2 participants