Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7051935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:19:24+00:00 2026-05-28T03:19:24+00:00

I made a script that draws a series of lines on a canvas that

  • 0

I made a script that draws a series of lines on a canvas that makes it look like a sketch. There are two issues with the script. One, why is the y value twice as much as it should be? And two, why is the line several pixels wide and faded out?

I’ve tried it in both Google Chrome and Firefox and I get the same incorrect results. I realize that I can divide the y value by two to fix the first problem but that part of my question is why do I need to do that. I shouldn’t have to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:19:24+00:00Added an answer on May 28, 2026 at 3:19 am

    I think you have two issues:

    1. You need to be more careful in how you calculate the offset of where to draw. I have some code below that demonstrates how to handle this properly.
    2. You aren’t setting the width and height on the <canvas> element itself, which means it will scale your lines in funny ways depending how what you’ve set in your css.

    An Example

    I built a simple collaborative drawing app using <canvas> and socket.io that lets you draw to the screen like a pencil. You can check it out here:

    http://xjamundx.no.de/

    The source is also on github if that might help:

    • https://github.com/xjamundx/CollabPaintJS/ (main repo)
    • https://github.com/xjamundx/CollabPaintJS/blob/master/public/collabpaint.js (canvas drawing code)

    In particular I do something like this to figure out where to draw things:

    x = e.clientX + window.scrollX
    y = e.clientY + window.scrollY
    x -= $game.offsetLeft
    y -= $game.offsetTop
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, basicly, I made a script (that one) that makes a .post to a
I've made two versions of a script that submits a (https) web page form
I made a jQuery script that works fine, I'd just like to see if
Have made backup script that does well: makes backup zip-file and then uploads it
I have successfully made a script that filters out duplicate lines in a file
I made a script that crawls through a domain, and I want it to
I made a script that spawns a remote shell or runs a local shell
i made a script that dynamically loads content into a div and whenever the
I have made a script that uses a program called Diascope, its a video
What happes when the script that made @mysql_connect($server, $user, $password) dies? How long does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.