Is it possible to configure that the dragged shape will first appear closer to the shape preview in the pallet? |
Please use SymbolPalette’s “previewOffset” property to achieve your requirement. Please refer to the below code example.
$("#symbolpalette").ejSymbolPalette({
palettes: palettes, height: "500px", width:"300px", previewOffset: { x: 50, y: 50 }
});
Here is the playground link for your reference,
|
I am trying to detect changes to a user-editable diagram. I see there are events for detecting specific changes, but it would be helpful to have a single "diagram changed" event that would fire whenever any node or connection is added, removed, moved or any of its properties are changed. Is there such an event that I missed? |
To achieve your requirement, define propertyChange event to the diagram. This event will satisfy most of the situation when interacting with diagram or else you can use the same method for all events and you can do your own logics in the method based on the event type. Please refer to the below code example.
$("#diagram").ejDiagram({
width: "100%",
height: "600px",
propertyChange: eventChange,
selectionChange: eventChange
});
function eventChange(args) {
if (args.type === "selectionChange") {
//do your own logics here
console.log(args.type);
}
if (args.type === "propertyChange") {
//do your own logics here
console.log(args.type);
}
}
If the provided solution does not meet your needs, then share more details about your requirement to analyze further. |
Another question: is it possible to convert the diagram's JSON to SVG or image without rendering the diagram component? This is useful when the conversion needs to happen in non-browser environment where we don't have a DOM, or even if we have a DOM but don't really need the diagram component and just want to export a previously saved JSON. |
We couldn’t convert the diagram into SVG or image format without rendering the diagram control. However, we can achieve your requirement by using phantomjs which is used to convert the specified region to image format by specifying the URL link and region. Could you please confirm that phantomjs will satisfy your requirement? if so, we will provide a sample using phantomjs with console application.
|