Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #99 #100

Merged
merged 6 commits into from
May 16, 2024
Merged

Fix #99 #100

merged 6 commits into from
May 16, 2024

Conversation

nichoth
Copy link
Contributor

@nichoth nichoth commented May 12, 2024

This is a fix for #99. I had to add some dependencies and change the version of rollup-plugin-web-worker-loader in order to run the example locally. I documented the changes in the README though.

I made a change to the package.json style, in that I added dist to .gitignore, and !dist to .npmignore; I wasn't sure how you feel about committing compiled code.

Copy link
Owner

@jakubfiala jakubfiala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great fix, thank you! I'd just ask you not to remove the dist folder, and had one question about the dependency changes

.gitignore Outdated
@@ -5,3 +5,4 @@ dev-demo
.DS_STORE
.idea
test.html
dist
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my reasoning for checking in the dist directory is that I want to let people quickly grab the minified library even if they don't want to use NPM. I'm aware there are now CDN services such as unpkg.com but they're still effectively NPM proxies. So I'd suggest keeping the dist folder checked in, if you don't mind.

Then start a local server:
```sh
npm start
```
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! I don't think every library needs its own dev server setup, it's usually relatively pain-free to start a static HTML server in the demo directory and just have npm run watch refreshing the bundle. But I guess it's worth making it a little simpler for Atrament contributors.

package.json Outdated
@@ -36,7 +37,10 @@
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.26.0",
"rollup": "^4.9.4",
"rollup": "^2.0.0",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I'm a little concerned about downgrading rollup by 2 major versions. Do you know why you've had to do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, npm install failed for me unless I downgraded the version. This is the message:

atrament issue-99 % npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: rollup-plugin-web-worker-loader@1.6.1
npm ERR! Found: rollup@4.17.2
npm ERR! node_modules/rollup
npm ERR!   rollup@"^4.9.4" from the root project
npm ERR!   peerOptional rollup@"^2.0.0||^3.0.0||^4.0.0" from @rollup/plugin-terser@0.4.4
npm ERR!   node_modules/@rollup/plugin-terser
npm ERR!     @rollup/plugin-terser@"^0.4.4" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer rollup@"^1.9.2 || ^2.0.0" from rollup-plugin-web-worker-loader@1.6.1
npm ERR! node_modules/rollup-plugin-web-worker-loader
npm ERR!   rollup-plugin-web-worker-loader@"^1.6.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: rollup@2.79.1
npm ERR! node_modules/rollup
npm ERR!   peer rollup@"^1.9.2 || ^2.0.0" from rollup-plugin-web-worker-loader@1.6.1
npm ERR!   node_modules/rollup-plugin-web-worker-loader
npm ERR!     rollup-plugin-web-worker-loader@"^1.6.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/nick/.npm/_logs/2024-05-14T20_13_08_656Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/nick/.npm/_logs/2024-05-14T20_13_08_656Z-debug-0.log

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I wonder why this didn't occur for me. But indeed, rollup-plugin-web-worker-loader specifies either rollup v1 or v2 as a peer dep. I think that's mostly because the package hasn't been updated in 2 years, and people seem to have pointed this out. I'll have a think about how to solve this, but I'd actually prefer not downgrading rollup over it now. Would you mind removing that change, too?

I'll then sort out the peer dep conflict and release everything as v4.3.0 hopefully within the next 3-4 days.

// We also handle the case when pressure is 0.
this.#pressure = position.pressure === 1
? DEFAULT_PRESSURE
: position.pressure || DEFAULT_PRESSURE;
} else {
this.#mouse.set(x, y);
this.#mouse.previous.set(x, y);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT this is the actual fix, right? It's interesting because the ORs on L317-318 are there exactly to prevent drawing lines from (0,0). But now I see that #pointerUp also calls draw and that's probably where the unwanted lines are drawn. Thank you very much for spotting it!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the fix. Sorry about all the incidental changes.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries, I don't mind since you've explained your reasoning for them :)

@jakubfiala
Copy link
Owner

hey @nichoth, thanks for the fixes, I'll merge this now and sort out the remaining work around dependencies.

@jakubfiala jakubfiala merged commit 0bb769f into jakubfiala:main May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants