jotson / ridiculous_coding

Ridiculous addon for Godot Engine 4 that adds screenshake and explosions to your coding experience
MIT License
862 stars 30 forks source link

Images appearing at top left on MacOS #2

Open ACB-prgm opened 4 years ago

ACB-prgm commented 4 years ago

I am using a mono editor font (JetBrains-Regular) but the images are appearing on the top left of the screen. They do try to follow the cursor, but they begin at the top left corner and move less than a line space vertically or a character space horizontally.

EDIT: I think the Godot get_ functions in TextEdit are having issues on macOS because they are def returning weird values (the get_line, get_column functions are really messed up and the line_space one is pretty bad as well).

This should work but it does not at all: pos.y = (line - vscroll) * (fontsize.y + line_spacing) + 6 ('6' is the #pixels between the top of the editor viewport and the first line)

After playing around with the cursor location formula in 'plugin.gd', I was able to get it working for a few font sizes: this will work well for a size 14 font pos.x = (column)(11.0/6.0) (fontsize.x) - hscroll + 140 pos.y = (line - vscroll)(11.0/6.0) (fontsize.y + line_spacing) + 28 for a size 16 font: pos.x = (column)(9.0/5.0) (fontsize.x) - hscroll + 140 pos.y = (line - vscroll)(9.0/5.0) (fontsize.y + line_spacing) + 30

The ratios in those formulas I got by finding the slope between two points of error visually. IE, cursor on line 25, image at line 14 = (25,14); cursor on 15, image at line 9 = (15,9). Slope = (25-14)/(15-9) = 11/6. idk why that worked really, but it did for every font size I tried. So if you prefer another font size, you can just do that and then enter the ratio in the formula and it should work lol.

jotson commented 4 years ago

Hm, that does sound like it could be a bug in the macOS build of Godot. I'll test it on a Mac here and see if I get the same result. If so, I'll create a bug report upstream.

frosty commented 3 years ago

I'm seeing the same here on macOS, fwiw.

ridiculous-1

toasterofbread commented 3 years ago

Having the same issue on Ubuntu 20.04.3

ThunderFD commented 3 years ago

same issue here on macOS 11.6 on Apple Silicon with the latest stable native version of Godot: v3.4.stable.official [206ba70f4]

jotson commented 3 years ago

Sorry folks I just don't have time to test this on a Mac. It sounds like it could be a bug in the macOS Godot build in which case someone will need to file a bug upstream with the Godot devs.

TheLastDarkMage commented 2 years ago

Same issue here on Windows 7 with the latest stable native version of Godot (3.4.2.stable).

paddy-exe commented 2 years ago

Alright I opened an issue in the Godot repo. Would be great if everyone experiencing this would also comment their operation system (if it isn't the same as mine).

Lulullia commented 2 years ago

Hi, I have the same problem on Windows 10, Godot 3.4.2: coding

haruotsa commented 2 years ago

I have the same issue as @Lulullia. I'm on Linux Mint 20.3, Godot 3.4.2.

However, by setting _interface/editor/codefont to e.g. Hack seems to solve the problem

CactiChameleon9 commented 2 years ago

On linux and had the same problem, this worked for me in plugin.gd (trial and error):


    pos.x = (column) * (12.0) * (fontsize.x) - hscroll + 110
    pos.y = (line - vscroll) * (4.0) * (fontsize.y + line_spacing) + 20
RPicster commented 1 year ago

Having the same issue on Windows 10 in Godot 3.5.2