Building a Drawing App in React - Pt 3: Resizing Elements | Tutorial

Поделиться
HTML-код
  • Опубликовано: 9 янв 2025

Комментарии • 41

  • @ArihantAV
    @ArihantAV 4 года назад +4

    All the three videos really taught me a lot, looking forward to more such videos from you :) These videos should be seen by more people!

    • @RedhwanNacef
      @RedhwanNacef  4 года назад +1

      Thank you for the positive feedback. :)

  • @mayaahmed
    @mayaahmed 4 года назад +3

    Excellent series. Thanks a lot for these three videos.

  • @sonnypham6846
    @sonnypham6846 2 года назад +1

    Hi Red, you are beautiful! I'm learning so much from your tutorials. Thanks heaps!

    • @RedhwanNacef
      @RedhwanNacef  2 года назад

      Hi, thanks! Really glad you're learning from them 😊

  • @JustPlaysTech
    @JustPlaysTech 4 года назад +2

    great 3 videos ... good content .. will watch other videos as well . thank you

    • @RedhwanNacef
      @RedhwanNacef  4 года назад

      Thanks again! Glad you enjoyed them :)

  • @ikibkilam8383
    @ikibkilam8383 4 года назад +2

    Excellent series. How about undo/redo feature? Do you plan to build a video on this feature.

    • @RedhwanNacef
      @RedhwanNacef  4 года назад

      Thank you. Open to suggestions, will add 'undo/redo' to my todo list.

    • @ikibkilam8383
      @ikibkilam8383 4 года назад +1

      @@RedhwanNacef Thanks, looking forward.

  • @karimomaya594
    @karimomaya594 3 года назад

    For the cursor calculation i think it need to be adjust; kindly try the below code
    case "rectangle":
    const topLeft = nearPoint(x, y, x1, y1, "tl");
    const topRight = nearPoint(x, y, x1+x2, y1, "tr");
    const bottomLeft = nearPoint(x, y, x1, y1+y2, "bl");
    const bottomRight = nearPoint(x, y, x1+x2, y1+y2, "br");
    const inside = ((x >= x1 && x = y1 && y

    • @RedhwanNacef
      @RedhwanNacef  3 года назад +1

      Thanks for the suggestion, testing out these changes the corners and inside area are not quite in the right places. Maybe I am missing something, what is the reason for using the sum of the two coordinates instead of the coordinate directly as it is now?

  • @rugvedb9842
    @rugvedb9842 2 года назад +1

    This is so good! Thanks a lot brother.

  • @rugvedb9842
    @rugvedb9842 2 года назад +1

    Can you also build an eraser feature? I am not able to figure it out.

    • @RedhwanNacef
      @RedhwanNacef  2 года назад +1

      Yep, got this on my todo list! When you say eraser, do you mean a way to remove elements? Or a literal eraser that removes parts of an existing element?

    • @rugvedb9842
      @rugvedb9842 2 года назад +1

      @@RedhwanNacef Thanks for the reply! Literal eraser. Deleting entire elements is something I figured out. But I was not able to figure out how to implement a literal eraser.

    • @RedhwanNacef
      @RedhwanNacef  2 года назад

      Ah I see, yea I think that is a bit more work, I imagine that’s why some apps avoid it for apps like this. For example can you erase parts of text/shapes, and if you can, is the text still text or is it now just free drawn path (similar to masks I guess). I’d be interested in the use case? I will try look Into it when I have a chance.

  • @NotAllHeroesWearCapes-101
    @NotAllHeroesWearCapes-101 3 года назад +1

    man .. you are awesome

  • @AabidKhan-bv7qk
    @AabidKhan-bv7qk 2 года назад

    my canvas is on the center of the page... i have navbar as well..... it effects the drawing point.... i m drawing somewhere on the screen and in canvas it is drawn somewhere else ?? any fix

    • @RedhwanNacef
      @RedhwanNacef  2 года назад +1

      Yes, right now we use client `clientY` which is based on the view port. If you want to do it relative to the canvas, you can get the canvas width and height by using
      `const canvasRect = event.target.getBoundingClientRect()`
      then instead of using clientY and clientX you can use
      `clientY - canvasRect.y`
      `clientX - canvasRect.x`
      Hope that helps.

    • @AabidKhan-bv7qk
      @AabidKhan-bv7qk 2 года назад +1

      @@RedhwanNacef thank you so much... It is fixed

  • @firmansyah-ln9nm
    @firmansyah-ln9nm 4 года назад

    how to insert cursor on the middle for height and width so the corner used for constrain proportion?

    • @RedhwanNacef
      @RedhwanNacef  4 года назад

      Sorry I don't quite understand your question? Do you mean how to resize one the rectangle with only changing one side by selecting the middle of the line?

    • @firmansyah-ln9nm
      @firmansyah-ln9nm 4 года назад

      @@RedhwanNacef resize the rectangle... so there will be 8 cursor for resizing... corner for changing the size with proportion, top and bottom for height, and side for width... i tried it... but it run the opposite direction of the cursor...

    • @RedhwanNacef
      @RedhwanNacef  4 года назад +1

      Ah I see, I have added a commit on a branch with the above functionality. I have a quick explanation on the commit message: github.com/redhwannacef/youtube-tutorials/commit/4a50a21bac57987867e4040766a955502dd84c72. Hopefully this helps, if there is anything you are still unsure about let me know and I'll be happy to explain.

  • @asena388
    @asena388 4 года назад

    on chrome windows works very well but on android it doesn't work, would you know why?

    • @RedhwanNacef
      @RedhwanNacef  4 года назад

      I don't quite understand what you mean by it doesn't work on android? Do you maybe mean it doesn't work on a different browser?

  • @sathishsaminathan1347
    @sathishsaminathan1347 3 года назад

    Pencil tool Available?

    • @RedhwanNacef
      @RedhwanNacef  3 года назад

      I don’t have that in now, but I’m sure that can be added without too many changes. I can try add that at some point if you are interested?

    • @sathishsaminathan1347
      @sathishsaminathan1347 3 года назад

      @@RedhwanNacef yes please

    • @sathishsaminathan1347
      @sathishsaminathan1347 3 года назад

      @@RedhwanNacef I really stucked there your help is more appreciated

    • @sathishsaminathan1347
      @sathishsaminathan1347 3 года назад

      @@RedhwanNacef Please could you help me that will be helpful

    • @RedhwanNacef
      @RedhwanNacef  3 года назад

      Yes I am happy to try add the pencil tool as a next video as soon as I have some time.

  • @francovedia5584
    @francovedia5584 6 месяцев назад

    thanks

  • @sapnasingh897
    @sapnasingh897 2 года назад

    Hello

    • @RedhwanNacef
      @RedhwanNacef  2 года назад

      Hi

    • @sapnasingh897
      @sapnasingh897 2 года назад

      Draw traingle using two line just like autocad in react native please help me