Skip to content

Conversation

nimeratus
Copy link

Resolves

What Github issue does this resolve (please include link)?

(most of these are duplicates of each other)

Proposed Changes

Describe what this Pull Request does

  1. Resize the dragging bounds with the same CSS transform that resizes the monitors, instead of changing the width/height CSS properties
  2. Remove the <Box> that used to do the CSS transform
  3. Set the scale property on the <Draggable>
  4. Prevent the monitor from going to fractional coordinates even if scale is a fraction

Reason for Changes

Explain why these changes should be made

  1. This way CSS word wrapping and react-draggable will let the monitors go to the edges of the stage
  2. It doesn't do the transform anymore and I don't think it did anything else
  3. This way react-draggable knows the speed at which it should move the monitors
  4. The existing code expects the monitor coordinates to be integers here and there might be other places where it expects integers

Test Coverage

Please show how you have added tests to cover your changes

I've run npm test and it accepted it (I think) (it didn't say "error" like when it didn't like the identation)

I've tried it out in these browsers and it seems to work

  • Windows 10, Chrome 139
  • Android, Chrome 138

Instead of changing the width/height properties, use the CSS transform to resize the dragging bounds.
Because the transform has been removed from the inner box, now it does nothing and it can be removed
Forward scaling info through MonitorList -> Monitor -> MonitorComponent -> react-draggable

This way the monitor will move at the same speed as the cursor when it's dragged.
eslint complained about the identation because I removed a <Box> but didn't remove the identiation until now
The existing code expects monitors to be at integer coordinates at least at one point, but changing `scale` to a fraction allows dragging the monitor to fraction coordinates
* Add grid=[scale, scale] to the <Draggable> to make it round the coordinates while dragging
* Add rounding in the drag event handler to prevent floating point errors in the drag results
It looks like eslint is very strict on the code's formatting (by the way if you wonder why all of my commit titles starts with "fix:", I think there is an automatic test somewhere that checks if commit titles start with something like that and I don't want my PR to fail just because of the commit titles)
@nimeratus nimeratus requested a review from a team as a code owner September 6, 2025 19:52
Copy link

github-actions bot commented Sep 6, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@nimeratus
Copy link
Author

me:

(by the way if you wonder why all of my commit titles starts with "fix:", I think there is an automatic test somewhere that checks if commit titles start with something like that and I don't want my PR to fail just because of the commit titles)

commitlint:

✖ body's lines must not be longer than 100 characters [body-max-line-length]

Noooo, why...

@nimeratus nimeratus closed this Sep 6, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 6, 2025
@nimeratus nimeratus deleted the fix-dragging-monitors-on-small-stage branch September 6, 2025 21:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant