Commit 9b6bda81 authored by 李纪文's avatar 李纪文

feat: 组态实时值增加单位设置

parent d4cfd50a
......@@ -1289,10 +1289,10 @@ const ConfigurationView = (props) => {
const padding = v ? v.split(',') : null;
return padding
? new go.Margin(
padding[0] * 1 || 0,
padding[1] * 1 || 0,
padding[2] * 1 || 0,
padding[3] * 1 || 0,
padding?.[0] * 1 || 0,
padding?.[1] * 1 || 0,
padding?.[2] * 1 || 0,
padding?.[3] * 1 || 0,
)
: 0;
}).makeTwoWay(),
......@@ -1914,6 +1914,12 @@ const ConfigurationView = (props) => {
new go.Binding('location', 'loc', go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding('angle').makeTwoWay(),
roleVisibleBinding(), // 绑定角色可见
goJS(
go.Panel,
'Horizontal',
goJS(
go.Panel,
'Auto',
goJS(
go.Shape,
'RoundedRectanglePlus',
......@@ -1945,6 +1951,42 @@ const ConfigurationView = (props) => {
new go.Binding('minSize', 'textSize'),
new go.Binding('flip', 'flip'),
),
),
goJS(
go.TextBlock,
textStyle(),
{
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: false,
font: 'normal 10px Helvetica,Arial,sans-serif',
stroke: '#ffffff',
},
new go.Binding('text', 'unitText'),
new go.Binding('font', '', (v) => {
return `normal ${v?.unitSize || 10}pt ${
v?.unitStyle || 'Helvetica,Arial,sans-serif'
}`;
}),
new go.Binding('stroke', 'unitColor'),
new go.Binding('visible', '', (v) => {
return (v?.unitSwitch && !!v?.unitText) || false;
}),
new go.Binding('margin', '', (v) => {
const unitGap = v?.unitGap || '0,0,0,5';
if (unitGap && isNumber(unitGap)) return unitGap;
const margin = unitGap?.split(',') || null;
return margin
? new go.Margin(
margin?.[0] * 1 || 0,
margin?.[1] * 1 || 0,
margin?.[2] * 1 || 0,
margin?.[3] * 1 || 0,
)
: 0;
}),
),
),
{
click(e, node) {
const { data } = node;
......
......@@ -1856,10 +1856,10 @@ const ConfigurationView = (props) => {
const padding = v ? v.split(',') : null;
return padding
? new go.Margin(
padding[0] * 1 || 0,
padding[1] * 1 || 0,
padding[2] * 1 || 0,
padding[3] * 1 || 0,
padding?.[0] * 1 || 0,
padding?.[1] * 1 || 0,
padding?.[2] * 1 || 0,
padding?.[3] * 1 || 0,
)
: 0;
}).makeTwoWay(),
......@@ -2531,6 +2531,12 @@ const ConfigurationView = (props) => {
new go.Binding('location', 'loc', go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding('angle').makeTwoWay(),
roleVisibleBinding(), // 绑定角色可见
goJS(
go.Panel,
'Horizontal',
goJS(
go.Panel,
'Auto',
goJS(
go.Shape,
'RoundedRectanglePlus',
......@@ -2562,6 +2568,42 @@ const ConfigurationView = (props) => {
new go.Binding('minSize', 'textSize'),
new go.Binding('flip', 'flip'),
),
),
goJS(
go.TextBlock,
textStyle(),
{
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: false,
font: 'normal 10px Helvetica,Arial,sans-serif',
stroke: '#ffffff',
},
new go.Binding('text', 'unitText'),
new go.Binding('font', '', (v) => {
return `normal ${v?.unitSize || 10}pt ${
v?.unitStyle || 'Helvetica,Arial,sans-serif'
}`;
}),
new go.Binding('stroke', 'unitColor'),
new go.Binding('visible', '', (v) => {
return (v?.unitSwitch && !!v?.unitText) || false;
}),
new go.Binding('margin', '', (v) => {
const unitGap = v?.unitGap || '0,0,0,5';
if (unitGap && isNumber(unitGap)) return unitGap;
const margin = unitGap?.split(',') || null;
return margin
? new go.Margin(
margin?.[0] * 1 || 0,
margin?.[1] * 1 || 0,
margin?.[2] * 1 || 0,
margin?.[3] * 1 || 0,
)
: 0;
}),
),
),
{
click(e, node) {
if (navigatorAgent) return false;
......
......@@ -1862,10 +1862,10 @@ const ConfigurationView = (props) => {
const padding = v ? v.split(',') : null;
return padding
? new go.Margin(
padding[0] * 1 || 0,
padding[1] * 1 || 0,
padding[2] * 1 || 0,
padding[3] * 1 || 0,
padding?.[0] * 1 || 0,
padding?.[1] * 1 || 0,
padding?.[2] * 1 || 0,
padding?.[3] * 1 || 0,
)
: 0;
}).makeTwoWay(),
......@@ -2537,6 +2537,12 @@ const ConfigurationView = (props) => {
new go.Binding('location', 'loc', go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding('angle').makeTwoWay(),
roleVisibleBinding(), // 绑定角色可见
goJS(
go.Panel,
'Horizontal',
goJS(
go.Panel,
'Auto',
goJS(
go.Shape,
'RoundedRectanglePlus',
......@@ -2568,6 +2574,42 @@ const ConfigurationView = (props) => {
new go.Binding('minSize', 'textSize'),
new go.Binding('flip', 'flip'),
),
),
goJS(
go.TextBlock,
textStyle(),
{
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: false,
font: 'normal 10px Helvetica,Arial,sans-serif',
stroke: '#ffffff',
},
new go.Binding('text', 'unitText'),
new go.Binding('font', '', (v) => {
return `normal ${v?.unitSize || 10}pt ${
v?.unitStyle || 'Helvetica,Arial,sans-serif'
}`;
}),
new go.Binding('stroke', 'unitColor'),
new go.Binding('visible', '', (v) => {
return (v?.unitSwitch && !!v?.unitText) || false;
}),
new go.Binding('margin', '', (v) => {
const unitGap = v?.unitGap || '0,0,0,5';
if (unitGap && isNumber(unitGap)) return unitGap;
const margin = unitGap?.split(',') || null;
return margin
? new go.Margin(
margin?.[0] * 1 || 0,
margin?.[1] * 1 || 0,
margin?.[2] * 1 || 0,
margin?.[3] * 1 || 0,
)
: 0;
}),
),
),
{
click(e, node) {
if (navigatorAgent) return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment