Open Giwayume opened 4 years ago
Change is easy, just replace this line with code below: https://github.com/viliusle/miniPaint/blob/master/src/js/tools/brush.js#L113
if(typeof e.pressure !== "undefined"){
new_size = size * e.pressure * 2; //e.pressure has range [0 - 1]
}
else if (params.smart_brush == true) {
Sadly, i can not push, dont have any device with pressure support and can not test it.
If anybody could test it, i would implement it.
The variable only shows up on pointer events, like "pointermove". https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onpointermove
"pointermove" fires along-side "mousemove" and "touchmove", so you have to be careful not to handle the events twice.
I'm looking at it
Hmmm... looks like it's more complicated than checking e.pressure
. There are some devices that have false positives, like I have a laptop with a touch screen that does not support pressure, but it always reports the value as "0.5".
There's a library called pressure.js that checks if the value is "0.5" in order to determine whether or not pressure is supported. https://github.com/stuyam/pressure/blob/323d8078f1b605d34da1b56a5d58f269acf0b042/src/adapters/adapter_pointer.js#L18
So it looks like that's a common problem.
I'd say what's left on this is:
I could agree, but we will have problem, where i will not be able even to touch that code without physical device for testing pressure. Already happened with brush, i implemented line smoothing and broke your code. Lets hold with it for now.
If you're interested, drawing pads are relatively cheap. Takes some getting used to with hand eye coordination though.
https://www.amazon.com/StarG640-Ultrathin-Graphics-Battery-Free-Pressure/dp/B078YR2MTF/
i will check if it is possible to use:
@Giwayume what is your opinion on pressure feature on pencil tool? I have requests on it.
personally believe that pencil is tool is only for precise/accurate edits when zoomed in. And if you want pressure here, brush should be used instead.
I think you'd need to consider the future of these tools.
Photoshop kind of created this pencil/brush tool convention, so far as I know. In Photoshop, whatever source image is used for the brush is essentially given a hard pixel edge when used in the pencil tool (pixels that were semi-transparent are fully opaque instead).
Left: pencil, Right: brush, same brush image.
In minipaint the brush creates a vector arc line instead of using a raster image as base, so you're limited to a circular brush but the lines are pefect.
To me it makes more sense to ditch the pencil/brush convention and have something more like raster brush & vector brush. I wouldn't use those exact names, but that's just to give the idea. The raster brush works like Photoshop pencil/brush tool where what you draw is based on a bitmap source image, and you can have a setting to switch hard edges on/off to simulate the difference between pencil/brush tool. Vector brush would be the current brush tool, with maybe more shape options down the line.
We need to Pencil tool to be pressure-sensitive as well as the brush tool. Please can this be added to the list?
Can anybody test pressure support on real device using "pencil" tool on latest code from master?
Related commit: https://github.com/viliusle/miniPaint/commit/dae340d0eae3b4ed2c0a894f9b423198e08a3baf
Yes, we can. I can do it tomorrow.
Sent from BlueMail
On 14 Mar 2022, 19:23, at 19:23, Vilius @.***> wrote:
Can anybody test pressure support on real device using "pencil" tool on latest code from master?
Related commit: https://github.com/viliusle/miniPaint/commit/dae340d0eae3b4ed2c0a894f9b423198e08a3baf
-- Reply to this email directly or view it on GitHub: https://github.com/viliusle/miniPaint/issues/179#issuecomment-1067199599 You are receiving this because you commented.
Message ID: @.***>
Is it on the mini paint site? I can test it tomorrow.
Sent from BlueMail
On 14 Mar 2022, 19:23, at 19:23, Vilius @.***> wrote:
Can anybody test pressure support on real device using "pencil" tool on latest code from master?
Related commit: https://github.com/viliusle/miniPaint/commit/dae340d0eae3b4ed2c0a894f9b423198e08a3baf
-- Reply to this email directly or view it on GitHub: https://github.com/viliusle/miniPaint/issues/179#issuecomment-1067199599 You are receiving this because you commented.
Message ID: @.***>
no, only on github master branch
Ok. We van test on saturday as our installer is away until then
Sent from BlueMail
On 14 Mar 2022, 21:27, at 21:27, Vilius @.***> wrote:
no, only on github master branch
-- Reply to this email directly or view it on GitHub: https://github.com/viliusle/miniPaint/issues/179#issuecomment-1067312820 You are receiving this because you commented.
Message ID: @.***>
It's working like the brush tool. Might want to make pressure toggle-able like the brush, otherwise a pen user will have little control if they want an exact size.
https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure
For people with drawing tablets or other devices that have a compatible pen with pressure sensitivity, would be nice if the brush tool could take this into account when sizing instead of basing it off stroke speed. Any other tool that has an effect based on size would be a candidate.