fabric replace path | fabric замена пути - Forum

Forum Navigation
You need to log in to create posts and topics.

fabric replace path | fabric замена пути

Так я могу получить путь svg
So I can go the svg way
fabGetProperty "Container7" "blobObject" "path" [returnPath]

Но когда я пытаюсь изменить путь объект пропадает
But when I try to change the path the object disappears
fabSetProperty "Container7" "blobObject" "path" [blobPathData]

если я рисую новый путь, то объект создается
if i draw a new path then the object is created

как мне правильно заменить путь?
How can I replace the path correctly?

@lolo (using AI):

EN
I checked the plugin docs for FabricJS in VisualNEO Web. The reference confirms:

  • You can create a path with fabNewPath "containerId" "name" "path" x y "fill" (e.g. 'M 0 0 L 200 100 L 170 200 z').

  • You can read a property with fabGetProperty "containerId" "name" "property" [result]. (And, by symmetry with the docs and your snippet, fabSetProperty is the way to set properties.).

Why your object might “disappear” after setting "path":

  1. The new [blobPathData] isn’t a valid SVG path string (must start with M, coordinates numeric, commands spaced), so Fabric fails to render it.

  2. The geometry changes and the object ends up off-canvas (e.g., negative coordinates or huge path).

  3. After changing the path, Fabric’s bounds/controls need updating.

Try this sequence:

  1. Validate and set the path

fabSetProperty "Container7" "blobObject" "path" "[blobPathData]"
  1. Recompute position/visibility

fabCenterObject "Container7" "blobObject"
fabBringToFront "Container7" "blobObject"
  1. If your path lacks a close command, try adding Z/z (for closed shape) and test again.

  2. Ensure the path is a string, not JSON of points or URL-encoded.

To help you precisely, please share a minimal example:

  • The exact returnPath you get from fabGetProperty … "path" [returnPath].

  • The exact [blobPathData] you set.

  • The 3–4 lines you run in order.
    With that, I can spot whether it’s a formatting issue or you need to recenter after the change. (Docs: commands fabNewPath, fabGetProperty.)


RU
Я посмотрел документацию плагина FabricJS для VisualNEO Web. Там указано, что:

  • Создавать путь можно командой fabNewPath "containerId" "name" "path" x y "fill" (пример: 'M 0 0 L 200 100 L 170 200 z').

  • Считать свойство — fabGetProperty "containerId" "name" "property" [result]. (И по аналогии, для записи используется fabSetProperty.)

Почему объект «пропадает» после смены "path":

  1. Новая строка [blobPathData] — невалидный SVG-путь (не начинается с M, неверные числа/пробелы), и Fabric его не рисует.

  2. Геометрия изменилась, и объект ушёл за пределы холста (отрицательные координаты, очень большие значения).

  3. После смены пути нужно обновить позиционирование/границы.

Попробуйте так:

  1. Валидируйте и примените путь

fabSetProperty "Container7" "blobObject" "path" "[blobPathData]"
  1. Обновите положение/видимость

fabCenterObject "Container7" "blobObject"
fabBringToFront "Container7" "blobObject"
  1. Если фигура должна быть замкнутой — добавьте Z/z в конце.

  2. Убедитесь, что путь — это строка, а не массив точек/URL-код.

Чтобы я точно подсказал решение, пришлите минимальный пример:

  • Точное значение returnPath, полученное через fabGetProperty … "path" [returnPath].

  • Точное значение [blobPathData], которое вы устанавливаете.

  • 3–4 строки команд по порядку.
    Тогда я выявлю: формат ли это строки, или нужно просто перерасположить объект. (Документация: fabNewPath, fabGetProperty.)

@luishp

Я пытаюсь создать генератор blob
Похоже есть только один вариант, удалять и создавать новый объект

I'm trying to create a blob generator
It seems there is only one option, delete and create a new object

Uploaded files:
  • You need to login to have access to uploads.

Я сделал путем удаления и создания нового объекта, в принципе все нормально
I did it by deleting and creating a new object, in principle everything is fine

luishp has reacted to this post.
luishp