Group: Forum Members
Last Active: 14 Years Ago
Posts: 3,
Visits: 1
|
Hello!
How could I change view appearance logic? For example I'd like to have one document with two document views. And I have 3 separate cases...
1 case: And I'd like to have different shape positions on the views. But I'd like to have the same shapes, same connections, same shape names, synchronized shape creation and deletion. 2 case: I'd like to have one document with two document views. And I'd like to have the second view flipped horizontally. It means that ruler will go from right to left. When I will move a shape on the first view to the right it should be moved on the second to the left.\ 3 case: I'd like to have different visualization of the shapes on the different views.
I think it could be different solutions for different cases.
Thank you for your attention.
|
Group: Forum Members
Last Active: 14 Years Ago
Posts: 3,
Visits: 1
|
I thought up a way to do that: to implement my own documentView. But should I draw every shape myself? It'll be a great deal. It's not very good way to reimplement huge part of the Diagram component.
|
Group: Forum Members
Last Active: 2 Months Ago
Posts: 35,
Visits: 15
|
Needless to say your requirement is complex in nature. The multiple views feature of the document is designed to help you split the working area – shape positions in scene coordinates will be the same in all cases. To implement more complex document – views scenario I would suggest that you have a different approach that involves document synchronization. So instead of having just one document you must have say three documents the content of which is synchronized to some extend.
There are two approaches to your requirement: 1. Pull approach – perform complete synchronization at regular intervals of time. 2. Push approach – perform partial synchronization in the other views when something in one of the views changes.
I would recommend you to get started with the push approach by subscribing to all events in the document Event Sink service. To preserve at least the connected structure of the shapes I would also recommend to have something like a global map of say abstract shape to shape instances – e.g. keep track of an abstract shape, which is represented by a particular shape in each document instance.
When you add a shape -> you create a new abstract shape and create instances for the added shape in all other documents. Shape deep cloning can be useful here. However since you have actually three shapes they all can have different positions and geometry.
When you delete a shape -> you can find the abstract shape and find the related instances in the other views to delete.
When you connect two shapes -> again you can query the global map and find the instances of the shapes in the other documents that need to be connected.
So in general your requirement can be achieved, because the document event sink service will raise all the mutation events that you need to implement the push approach, but it is not something that we provide support for “out of the box”
|
Group: Forum Members
Last Active: 14 Years Ago
Posts: 3,
Visits: 1
|
Hello! Unfortunately my previous reply I made last week didn't correctly posted by browser (session timeout or something else). Thank you very much for your answer! I'll try to implement your push approach. I understand that my requirement is not simple and not native for the diagram component. That is all I need. Best wishes, Vladimir.
|