Page 15 of 16

Re: EditorFactory - Module for object management in a Canvas

Posted: Thu Jan 30, 2025 4:26 pm
by blueb
Merci ShadowSorm :D

Re: EditorFactory - Module for object management in a Canvas

Posted: Thu Jan 30, 2025 9:20 pm
by ShadowStorm
blueb wrote: Thu Jan 30, 2025 4:26 pm Merci ShadowSorm :D
De rien, si tu as besoin d'aide hésite pas :)

Re: EditorFactory - Module for object management in a Canvas

Posted: Tue Sep 02, 2025 7:42 pm
by punak
Hello
How can we save the result of drawing by EditorFactory on canvas as svg?

Re: EditorFactory - Module for object management in a Canvas

Posted: Wed Sep 03, 2025 8:15 am
by STARGÅTE
punak wrote: Tue Sep 02, 2025 7:42 pm Hello
How can we save the result of drawing by EditorFactory on canvas as svg?
There is no module function for this.
However, PureBasic has the command SvgVectorOutput(), which you can use in the StartVectorDrawing() function, instead of the CanvasVectorOutput().

In principle, there is only one call of StartVectorDrawing() in the EditorFactory-include, it's in the private module function: ObjectDrawing(), you can search for it in the source code. So it should be possible to add an additional parameter to trigger an output to a SVG file.
However, I never tried the SvgVectorOutput() command, I'm not sure if it has the same functionality for drawings as CanvasVectorOutput().

I can try it on weekend, or you can try it yourself.

Re: EditorFactory - Module for object management in a Canvas

Posted: Wed Sep 03, 2025 8:05 pm
by punak
@STARGÅTE : Thanks for your help.
Another question : How do I create a snap to grid mode to move objects?

Re: EditorFactory - Module for object management in a Canvas

Posted: Wed Sep 03, 2025 9:03 pm
by STARGÅTE
punak wrote: Wed Sep 03, 2025 8:05 pm @STARGÅTE : Thanks for your help.
Another question : How do I create a snap to grid mode to move objects?
With the module function SetObjectMovementStep() and SetObjectResizeStep() you can define a grid snapping for movements and resizing. You can define it by default (for new objects), for all objects, or a specific object.
For example, the call of EditorFactory::SetObjectMovementStep(#Object_Default, 10, 10) defines a 10-px-grid for all new objects.

Re: EditorFactory - Module for object management in a Canvas

Posted: Fri Sep 05, 2025 12:48 pm
by punak
Hello again,
How to enable z-order feature in this module? I want an object to be placed above other objects when I click on it.

Of course, if possible, please add the save to svg function.

Re: EditorFactory - Module for object management in a Canvas

Posted: Fri Sep 05, 2025 8:25 pm
by STARGÅTE
punak wrote: Fri Sep 05, 2025 12:48 pm Hello again,
How to enable z-order feature in this module? I want an object to be placed above other objects when I click on it.
Please take a look in Example04_Object-order.pb from the download.
SetObjectLayer() can be used to change the z-order and with CanvasObjectsEvent() you can detect a click.
punak wrote: Fri Sep 05, 2025 12:48 pm Of course, if possible, please add the save to svg function.
I will try it on weekend, as I said.

Re: EditorFactory - Module for object management in a Canvas

Posted: Mon Sep 08, 2025 9:03 pm
by STARGÅTE
punak wrote: Tue Sep 02, 2025 7:42 pm How can we save the result of drawing by EditorFactory on canvas as svg?
I quickly checked the option to save the canvas output as a SVG.
Indeed, it is relatively easy to add this feature.
However, the saved SVG image is simplified and not complete:
- In my test, text (with fonts) was not exported.
- Color gradient areas were just solid color.
If both is not relevant to you, I can provide you with a procedure.

Re: EditorFactory - Module for object management in a Canvas

Posted: Mon Sep 08, 2025 9:20 pm
by punak
Thanks for following up on my request.
I am building a visual calendar designer using your powerful EditorFactory - Module and of course, with the copilot laborious consultations :D
Your designer's output is a vector file for graphic designers.

The font problem seems to be a bug (SvgVectorOutput) and needs to be fixed. I mentioned it in the following thread.
viewtopic.php?t=87523
For other cases, it doesn't matter at all, just draw the same simple shape, it's great.

Re: EditorFactory - Module for object management in a Canvas

Posted: Thu Sep 11, 2025 5:10 pm
by punak
I'm posting again because I'm in a bit of a hurry.
Now, if I use svgVectorOutput instead of canvasVectoroutput in the objectdrawing function, will there be any problems with the drawing???

Re: EditorFactory - Module for object management in a Canvas

Posted: Thu Sep 11, 2025 5:32 pm
by STARGÅTE
I will upload an experimental version for you in a few hours and send you a PN.

Re: EditorFactory - Module for object management in a Canvas

Posted: Fri Sep 26, 2025 2:00 pm
by punak
How can I create a function to copy/cut/Paste objects?
I looked at all the module functions and the only one that came close to what I wanted was the DuplicateObject function.
Am I understanding correctly? Can this function be used to copy/cut/Paste objects?

Re: EditorFactory - Module for object management in a Canvas

Posted: Sat Sep 27, 2025 12:45 pm
by STARGÅTE
punak wrote: Fri Sep 26, 2025 2:00 pm How can I create a function to copy/cut/Paste objects?
I looked at all the module functions and the only one that came close to what I wanted was the DuplicateObject function.
Am I understanding correctly? Can this function be used to copy/cut/Paste objects?
There is no function to apply the copy/cut/paste functionality directly.
However, you can indeed use DuplicateObject() to clone the specified object into the same or an other canvas, and delete (if you want) the old one.
After you duplicated the object, you can set the position as you want, e.g. the position of the mouse cursor.

Re: EditorFactory - Module for object management in a Canvas

Posted: Sun Nov 16, 2025 8:04 pm
by ShadowStorm
Hi everyone,

“There is no function that allows you to directly apply the copy/cut/paste functions.”

That's true, but a while ago I wrote some code to do all that!

Cut, copy, paste, and even undo and redo!

I'm happy to share the examples :D
But I have to translate them into English first.

I've also created other examples.
But since no one seems interested, which I don't understand, I haven't been very motivated, and our dear friend Stargate has also lost motivation. It's normal, since all of this takes a lot of time, and if no one is interested, then what's the point?