GIRA / PhysicalBits

A web-based programming environment for educational robotics that supports live coding and autonomy using a hybrid blocks/text programming language.
https://gira.github.io/PhysicalBits/
MIT License
18 stars 5 forks source link

Pulling blocks don't move with the speed of the mouse #4

Closed kristiank closed 4 years ago

kristiank commented 4 years ago

The further I drag blocks, the further they get misaligned from the mouse cursor. The misalignment seems to be a constant factor.

kristiank commented 4 years ago

It seems that this affects only Firefox. It works in Google Chrome and Microsoft Edge.

RichoM commented 4 years ago

Good catch! I don't usually use Firefox so I haven't noticed this before. I removed some css I was using to scale the blockly workspace and the misalignment doesn't seem to get worse the further you drag. However, the blocks are still not centered on the mouse cursor. This looks like a bug in the blockly library: google/blockly#2482 Apparently they fixed it on a more recent version. Would you try updating the blockly library and see if the problem persists?

kristiank commented 4 years ago

I'll try.

kristiank commented 4 years ago

I updated the CSS and blockly, now the pulling works fine. But I don't understand what you mean with "not centered on the mouse cursor". The behaviour now is exactly what I would expect -- if I click on a block then it doesn't move anywhere (it doesn't get centered below the mouse cursor), but this is what I want. It would be annoying if the blocks get displaced simply because I click on the block. Maybe I didn't get your point?

RichoM commented 4 years ago

I haven't updated blockly yet, just the css. And this is the behavior I see, notice how the block is at the left of the cursor:

ezgif-4-c5951fbbcc65

If updating blockly fixes the problem, great! Could you send a pull request? Thank you!

kristiank commented 4 years ago

I've been re-reading about the git submodules system. Is there a reason why blockly has not been added directly from Google's repo, but instead via a personal fork. This is how .gitmodules looks like now:

[submodule "web/blockly/google-blockly"]
    path = web/blockly/google-blockly
    url = https://github.com/RichoM/blockly.git

I was thinking the submodule could be added from Google directly (and pointing to the master branch) like this:

[submodule "web/blockly/google-blockly"]
    path = web/blockly/google-blockly
    url = https://github.com/google/blockly
    branch = master

This way it would be easy to bump the version in the future with simply git submodule update --remote.

What do you think? I could try commit these changes and create a pull request for that (or something else you would prefer).

RichoM commented 4 years ago

Yes, you're absolutely right. I don't know why I fork it. Maybe I though I would make some changes to the library? I really don't remember.

Also, another mistake I made: notice how even though the blockly submodule is added to the repo, for the IDE code I ended up copying the blockly files to another folder instead of actually using the submodule (see /web/ide/libs/google-blockly).

So please, feel free to fix this and create a pull request. Thank you very much!

kristiank commented 4 years ago

The more I investigate this, the more I seem to live through your decisions :-)

The Google Blockly's repo code is "huge" (150 mb). Because of this, I think we could just remove the Blockly submodule and do as you have done, I'll bump the files in /web/ide/libs/google-blockly.

RichoM commented 4 years ago

Sounds good. Thanks