DarwinNE / FidoCadJ

FidoCadJ is a free user-friendly vector graphic editor for macOS, Linux, Windows and Android with a library of electronic symbols.
http://darwinne.github.io/FidoCadJ/
GNU General Public License v3.0
116 stars 43 forks source link

Implemented "normalizeCoordinates()" to resolve issue #219 #264

Closed manufino closed 2 months ago

manufino commented 3 months ago

And #219 can also be closed.

manufino commented 3 months ago

@DarwinNE, could you explain more clearly how you'd like this to be implemented?

If we move this logic into the movement process, it becomes very heavy because it would constantly have to check that all vertices of all selected primitives are normalized. With many primitives selected, this would almost certainly result in lag during movement.

DarwinNE commented 3 months ago

It is possible, but IIRC by far the most time critical operation is the redraw. Each time you move something, part of the drawing has to be redrawn (*). As long as the normalizeCoordinates() just checks the selected primitives, it will introduce a negligible lag. In any case, there is a timer integrated in FidoCadJ to check the effect of such things, I think I mostly used checking the redraw speed, but I think it was useful also when moving objects on the screen.

(*) the fact that FidoCadJ redraws much more than FidoCAD (with double buffering) is due to the fact that we can not use the XOR toggle technique that was possible (and common) at the time of FidoCAD. Unfortunately, the XOR technique does not work well with the anti-aliasing.

manufino commented 3 months ago

I understand, I'll try to implement something efficient during the movement phase.

The problem still remains with existing drawings. Do you think we should apply normalizeCoordinates() when opening a file as well?

DarwinNE commented 3 months ago

I think it may be a good idea, maybe asking to the user what they want to do. What do you think about it?

manufino commented 3 months ago

Great, let's proceed that way then.

manufino commented 2 months ago

@DarwinNE, , I think this should be fine.

manufino commented 2 months ago

@DarwinNE, while doing some debugging, I traced the issue to this line. In the checkKey(), "md.filename" should be compared, not "md.library".

DarwinNE commented 2 months ago

Great stuff. I changed "primitives" into "elements" in some contexts, as it is more general. After all, a macro can be outside of the drawing area, too.