Adding Zoom Tool To HTML Canvas | Drawing App Tutorial Part 8

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ส.ค. 2023
  • Hey! Now that we have added the Pan tool, the Zoom too will be a bit easier to add as it follows the same principals. Let's do that next, hope you enjoy :)
    Useful Links:
    GitHub: github.com/redhwannacef/youtu...
    Drawing App Series: • Build a Drawing App wi...
    MDN Docs Scale: developer.mozilla.org/en-US/d...
    Music:
    • Akita Inu
    Huge thank you to Harris Heller for providing copyright-free music.
    Hey everyone! My name is Redhwan Nacef (Red for short). In this channel, I'm hoping to share my thoughts on software engineering, coding, management, and all things tech. I hope you enjoy!
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 22

  • @vinodhvarma6075
    @vinodhvarma6075 5 หลายเดือนก่อน +5

    Very informative tutorial, please continue this series

  • @deepakchoudhary3370
    @deepakchoudhary3370 6 หลายเดือนก่อน +1

    Hey, Bro, it's really amazing learning from your playlist. Thank you, Redhwan.
    It will be additional learning if you make a video on how to save details of the canvas in the database.

  • @leandro-siqueira
    @leandro-siqueira 11 หลายเดือนก่อน +4

    I have tried doing this at my canvas once and you videos helped a loot, but a coud't do it by myself. Now i can finish the project 😅, so thanks again!! Sorry about my english, i am still working on it, but a van tell that you explain so well that i can understand everything without legends!

    • @RedhwanNacef
      @RedhwanNacef  11 หลายเดือนก่อน +1

      Glad to hear this helped. Keep going! 💪🏽

  • @jijivre
    @jijivre 4 หลายเดือนก่อน +1

    Hey this series helped me a lot. Your videos are great value!
    Do you know how you could connect shapes together with lines or arrows that move along with the shape, like in excalidraw?

  • @joshgriffiths8467
    @joshgriffiths8467 5 หลายเดือนก่อน

    Hey mate, fantastic video. really learnt a lot from this playlist. Is it possible for the zoom to keep the mouse in the same relative position, rather than zooming into the center of the screen? e.g. if the mouse is on the corner of a rectangle, as you zoom, the mouse stays on that point? Been stuck trying to work this out for days

  • @NattyEngineer
    @NattyEngineer 10 หลายเดือนก่อน

    Hey Redhwan huge thanks to u for this drawing app series,appreciate your effort making this tutorial but i want to modify the excali draw in terms of erasing as it erase the entire content not the drawing content i want to erase please reply if there is any way of working out

  • @tobiaskathan134
    @tobiaskathan134 3 หลายเดือนก่อน

    Very nice series. How could I implement it instead of an infinite whiteboard with typical sheet sizes (e.g. A4)? (kind of a very simple Goodnotes clone)

  • @haiduy5141
    @haiduy5141 7 หลายเดือนก่อน

    How can I have a scrollbar whenever I zoomed in the rect inside a frame. Btw your videos is awesome, love to see latest video

  • @francovedia5584
    @francovedia5584 29 วันที่ผ่านมา

    thanks

  • @vickrammark2082
    @vickrammark2082 11 หลายเดือนก่อน

    awesome 🔥🔥🔥🔥🔥🔥🔥🔥

    • @RedhwanNacef
      @RedhwanNacef  11 หลายเดือนก่อน +1

      Thanks 🔥

  • @yonjaydo2435
    @yonjaydo2435 9 หลายเดือนก่อน +2

    Your github not update! I cannot find Part 8

  • @user-lz2wf5dz2f
    @user-lz2wf5dz2f 2 หลายเดือนก่อน

    One thing I've noticed about HTML canvas is that when zooming the resolution quickly looks really bad. What do you think is the best way to fix that?

  • @winningless
    @winningless 11 หลายเดือนก่อน +1

    Can you show us how to implement a delete button that deletes a specific element and updates the elements array when you click it?

    • @RedhwanNacef
      @RedhwanNacef  11 หลายเดือนก่อน +1

      Yep, noted!

    • @winningless
      @winningless 11 หลายเดือนก่อน +2

      @@RedhwanNacef
      Thanks.
      I came up with this and it seems to work. I thought I would have to update the Actions array as well for undo and redo but it seems to function fine.
      I filtered the deleted element and then updated the id of each element to remain to keep them the same as their index in the Elements array:
      In handleMouseDown function:
      if (tool === 'delete') {
      const { offsetX: x, offsetY: y } = e.nativeEvent;
      const elementToDelete = getElementAtPosition(x, y, elements);
      if (elementToDelete) {
      const elementsCopy = [...elements];
      const updatedElements = elementsCopy
      .filter((element) => element.id !== elementToDelete.id)
      .map((element, index) => {
      return { ...element, id: index };
      });
      setElements(updatedElements);
      }
      return;

  • @thomaswoodward9514
    @thomaswoodward9514 11 หลายเดือนก่อน

    P r o m o S M 🌹