copy & paste problem #2827
Unanswered
james-ep01
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Since I am not able to reproduce I assume It's a problem in how you define your shape. Please make sure that the class MyElement extends dia.Element {
initialize(...args) {
super.initialize(...args);
/* ... *.
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
-
I've tried all sorts of ways, but I can't. As expected, it's not easy. I have to experience it myself. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Introduction
To copy and paste objects, the properties of attr become strange. Then there is the missing attr. (Not a user-defined function)
What is the problem?
This problem occurs when using export json, so the exported json cannot be called and used as it is.
My Object Internal Code:
markup: [
{ tagName: 'image', selector: 'image' },
{ tagName: 'text', selector: 'label' },
{ tagName: 'text', selector: 'label_line' },
{ tagName: 'text', selector: 'label_load' },
{ tagName: 'text', selector: 'label_ex1' },
{ tagName: 'text', selector: 'label_ex2' },
],
attrs: {
image: {
href: ''
},
root: {
dataTooltip: '', dataTooltipPosition: 'left'
},
label: {
x: 'calc(w/2)', y:'calc(h+20)', fill: '#8f8f8f', text: '' , fontSize: 12,
},
label_line:{
x: 'calc(w/2)', y:50, text:'',fill:'#8f8f8f', fontSize: 11, textAnchor:'middle',
},
label_load:{
x: 'calc(w/2)', y:'calc(h-40)',text: '',fontSize: 11, fill:'#8f8f8f',textAnchor:'middle',
},
label_ex1: {
x: 'calc(w/2)', y:'calc(h / 2+ 30)',text:'', fontSize:12, fill:'blue', textAnchor: 'middle',
},
label_ex2: {
x: 'calc(w/2)', y:'calc(h / 2 + 40)',text:'', fontSize:11, fill:'red', textAnchor: 'middle',
},
},
and i made my object is
var hwb = new MyModel();
hwb.attr('root/dataTooltip', 'My Tooltip');
hwb.attr('label/text', 'lbl 1' );
hwb.attr('label_line/text', 'lbl 2' );
hwb.attr('label_load/text', 'lbl 3' );
hwb.attr('label_ex1/text', 'lbl 4' );
hwb.attr('label_ex2/text', 'lbl 5' );
Copied Object Properties
![image](https://private-user-images.githubusercontent.com/188142734/393697022-62d8015e-3350-4717-9f3e-83297fd4ecfa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxOTA2NDEsIm5iZiI6MTczOTE5MDM0MSwicGF0aCI6Ii8xODgxNDI3MzQvMzkzNjk3MDIyLTYyZDgwMTVlLTMzNTAtNDcxNy05ZjNlLTgzMjk3ZmQ0ZWNmYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxMjI1NDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jZTJjNzBmNGRjZWFlODU5MTVlMmIwNmQ5NzIyMDc2YmQwYzY2MWRhZjc3Yjg5NDZjZTIyYWY5NzI2NmIwM2EwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.In9v1IHiOciiipoqfGjuwxqO_rGr0Re8YVwP4dGAtLY)
Properties of pasted objects
![image](https://private-user-images.githubusercontent.com/188142734/393697403-c8dd026a-94e8-4f33-90cb-c7280ae8d68e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxOTA2NDEsIm5iZiI6MTczOTE5MDM0MSwicGF0aCI6Ii8xODgxNDI3MzQvMzkzNjk3NDAzLWM4ZGQwMjZhLTk0ZTgtNGYzMy05MGNiLWM3MjgwYWU4ZDY4ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxMjI1NDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04ZTk0NTZkMTNmZGQ2MmI5NGVmZDQwODA0MDEwN2U1MzljMTA4YzQ0YzE5MGMxZWFhNTEzMDMzZWZjZjIxN2FlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.bXcZvE-hfcuXYglG5o_Ish4Othv_yLMTvkT96id_NEI)
The label of the copied object property is changed and pasted from fill:'#8f8f8f' to fill:'#33333'.
And the attr of label_line, label_load, label_ex1, and label_ex2 all disappear except text.
Doesn't the attr function change only that property?
Steps to reproduce
No response
Restrictions & Constraints
No response
Does your question relate to JointJS or JointJS+. Select both if applicable.
JointJS+
Beta Was this translation helpful? Give feedback.
All reactions