Comments (8)
thanks for submitting the PRs @bencergazda – and sorry I'm getting to this late!
both PRs are looking good – going to approve & merge, then test the changes and publish
from atrament.
@Ben76 thanks for submitting the issue. Can you see any errors being thrown in the console? Alternatively, can you create a codepen/jsbin that demonstrates the issue?
from atrament.
@Ben76 @jakubfiala I was having the same issue. In my case, it occured only when we needed to scroll downwards the page to the canvas. In this situation, the scrollTop gets added to the mouse position when drawing (see + document.documentElement.scrollLeft
in src/atrament.js#L31). Like this, if we scroll down for 10px, and the start painting, the drawing appears 10px under the mouse cursor/touch point.
See: https://codepen.io/bencergazda/full/OapvVL/
I did a quick test with removing the addition of document.documentElement.scrollLeft
. This fixes the issue on Mobile Chrome, and looks like not causing problems in other browsers (Firefox, Desktop Chrome, Mobile Safari)
I can make a pull request with a fix.
from atrament.
this is now resolved in #39
from atrament.
Hello, I get the same stuck. Can you please check my app.
I can draw perfect on desktop and chrome simulator on desktop and main browser of android. But I can's draw correct on android chrome. It seem i get incorrect coordinate on touch
My app: https://zcolorqa.azurewebsites.net/
Many thanks
from atrament.
@viettq1986 thanks for reporting the issue. Could you please let me know how I can replicate the issue in your app? I'm having trouble finding the place where Atrament is used.
Also, what version of Android (and Chrome) are you using?
from atrament.
@viettq1986 thanks for reporting the issue. Could you please let me know how I can replicate the issue in your app? I'm having trouble finding the place where Atrament is used.
Also, what version of Android (and Chrome) are you using?
Hello, Sorry for your Atrament.
Please see my step by step:
I am using lasted android chrome version
My function for get mouse and touch coordinates
getCoordinate = (e, canvas) => {
let coordinate = {
x: 0,
y: 0
};
if (e.touches && e.touches.length > 0) {
let touch = e.touches[0]; //Get the information for finger #1
let rect = canvas.getBoundingClientRect();
//coordinate.x = Math.floor((touch.pageX - rect.left) * (canvas.width / rect.width));
//coordinate.y = Math.floor((touch.pageY - rect.top) * (canvas.height / rect.height));
coordinate.x = Math.floor((touch.pageX - rect.left) * (canvas.width / rect.width));
coordinate.y = Math.floor((touch.pageY - rect.top) * (canvas.height / rect.height));
let matrix = canvas.getContext("2d").getTransform();
let iMatrix = matrix.invertSelf();
coordinate = applyToPoint(iMatrix, coordinate);
} else {
if (e.offsetX) {
coordinate.x = e.offsetX;
coordinate.y = e.offsetY;
} else if (e.layerX) {
coordinate.x = e.layerX;
coordinate.y = e.layerY;
} else if (e.clientX) {
coordinate.x = e.clientX;
coordinate.y = e.clientY;
}
}
return coordinate;
}
Thank you very much
from atrament.
@viettq1986 I believe your issue might be solved in v4.0.0 - please feel free to reopen if the issue occurs again
from atrament.
Related Issues (20)
- Demo link HOT 2
- Save strokes with uniform sizes HOT 2
- Add a "disable" option for drawing mode. HOT 1
- How to retain smoothing effect in SVG when programmatically creating SVG from stroke data HOT 2
- Sometimes drawing adds a line between beginning and end of stroke HOT 1
- Undo implementation HOT 5
- question about layers/transparency HOT 2
- Realtime draw updates HOT 4
- Different behavior when Inspect Element is open on Chrome HOT 4
- Online Demo Error HOT 1
- Bundle with Rollup HOT 1
- Test rendering with WebGL HOT 1
- QA with iPad + Apple Pencil and a similar Android tablet HOT 2
- Add support for advanced `Touch` properties HOT 1
- Adaptive stroke causes flood fill artifacts HOT 2
- Fix demo link in readme HOT 1
- Just add some text labelling for drawings HOT 3
- Can only undo for one step HOT 4
- Click creates a line in top left corner HOT 1
- Diagonal line from top left
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atrament.