Need Help with Resizing Elements in My Website Builder
Asked by
shallow-rooted
I'm a beginner with coding and feeling pretty good about my progress so far. I'm currently building a website builder and have implemented features that users can add. Right now, I'm working on a drag-and-drop system, but I'm struggling with the resizing logic. Each feature is represented by its own block, and while I created handles for resizing, I'm having issues. The left and right handles work fine for adjusting width, but the top handle pulls the feature up without increasing the height, and the bottom one increases the height of the resizer block but not the actual feature. Can anyone offer guidance on how to fix this? Thanks!
Answers
It's awesome that you're aiming to learn everything from scratch! While libraries can feel like cheating sometimes, they can save a lot of time. Don't hesitate to use them for guidance but keep pushing your limits. Since you prefer to solve issues yourself, just break down the resizing logic step by step and tackle each part. You'll get there!
Reply to this answer
Sounds like a challenging project for a newbie, but you're definitely on the right track! Resizing can get tricky because you need to consider both the container and the child components inside it. Iโd recommend checking if you can scale each component based on what you want the end result to be. Maybe create a list of properties that need to respond to the resizing and set rules for them. Going through each child component recursively and adjusting them could be a solid approach. It might be tough at first, but youโll learn a lot through this!
diagrammatic: What do you mean by 'create rules for how they respond to scaling'? How would I go about doing that?
Reply to this answer
Add your answer
Answers are reviewed before publication.
shallow-rooted: Thanks! I just feel stuck sometimes when I'm coding, but I'll keep trying to figure it out without heavy libraries.