ridiculous_coding icon indicating copy to clipboard operation
ridiculous_coding copied to clipboard

Images appearing at top left on MacOS

Open ACB-prgm opened this issue 4 years ago • 11 comments

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.

ACB-prgm avatar Aug 18 '20 21:08 ACB-prgm

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.

jotson avatar Aug 20 '20 14:08 jotson

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

ridiculous-1

frosty avatar May 24 '21 10:05 frosty

Having the same issue on Ubuntu 20.04.3

toasterofbread avatar Oct 27 '21 14:10 toasterofbread

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

ThunderFD avatar Nov 22 '21 21:11 ThunderFD

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.

jotson avatar Nov 28 '21 23:11 jotson

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

TheLastDarkMage avatar Dec 24 '21 14:12 TheLastDarkMage

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).

paddy-exe avatar Jan 03 '22 18:01 paddy-exe

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

Lulullia avatar Feb 15 '22 18:02 Lulullia

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

However, by setting interface/editor/code_font to e.g. Hack seems to solve the problem

haruotsa avatar Mar 02 '22 20:03 haruotsa

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

CactiChameleon9 avatar Mar 03 '22 21:03 CactiChameleon9

Having the same issue on Windows 10 in Godot 3.5.2

RPicster avatar May 31 '23 08:05 RPicster