Skip to content

Commit 4028c67

Browse files
Cindy WangCindy Wang
authored andcommitted
DM-11350 PointSelect Marker can not be added after the overlay layer is deleted
1 parent 7f83076 commit 4028c67

File tree

3 files changed

+31
-23
lines changed

3 files changed

+31
-23
lines changed

src/firefly/js/drawingLayers/PointSelection.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ function creator(initPayload, presetDefaults) {
5252
drawingDef= Object.assign(drawingDef,presetDefaults);
5353
idCnt++;
5454

55-
var pairs= {
55+
const pairs= {
5656
[MouseState.UP.key]: dispatchSelectPoint
5757
};
58-
59-
var actionTypes= [DrawLayerCntlr.SELECT_POINT];
60-
61-
var options= {
62-
isPointData:true,
63-
hasPerPlotData:true,
58+
const actionTypes= [DrawLayerCntlr.SELECT_POINT];
59+
const options = {
60+
isPointData: true,
61+
hasPerPlotData: true,
62+
canUserDelete: false,
6463
canUserChangeColor: ColorChangeType.DYNAMIC
6564
};
65+
6666
return DrawLayer.makeDrawLayer(`${ID}-${idCnt}`,TYPE_ID, 'Selected Point', options, drawingDef, actionTypes, pairs);
6767
}
6868

src/firefly/js/visualize/draw/DrawLayer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ export const ColorChangeType= {DISABLE,DYNAMIC,STATIC};
112112
* @param {object} drawingDef the defaults that the drawer will use if not overridden by the object @see DrawingDef
113113
* @param {Array} actionTypeAry extra [actions] that are allow though to the drawing layer reducer
114114
* @param {object} mouseEventMap object literal with event to function mapping, see documentation below in object
115-
*
116-
*
115+
* @param {object} exclusive
116+
* @param {function} getCursor
117117
* @return {DrawLayer}
118118
*/
119119
function makeDrawLayer(drawLayerId,

src/firefly/js/visualize/ui/DrawLayerItemView.jsx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ const bSty= {
1313
display:'inline-block',
1414
whiteSpace: 'nowrap'
1515
};
16+
const bStyWid = {
17+
...bSty, width: 'calc(33%)'
18+
};
19+
1620
const symbolSize= 10;
21+
const mLeft = 5;
1722

1823
function DrawLayerItemView({maxTitleChars, lastItem, deleteLayer,
1924
color, canUserChangeColor, canUserDelete, title, helpLine,
@@ -50,7 +55,7 @@ function DrawLayerItemView({maxTitleChars, lastItem, deleteLayer,
5055
<input type='checkbox' checked={visible} onChange={() => changeVisible()} />
5156
{getTitleTag(title,maxTitleChars)}
5257
</div>
53-
<div style={{padding:'0 4px 0 5px'}}>
58+
<div style={{padding:'0 4px 0 5px', width: 180, display: 'flex', justifyContent: 'flex-end'}}>
5459
{makeColorChange(color, canUserChangeColor,modifyColor)}
5560
{makeShape(isPointData,drawingDef, modifyShape)}
5661
{makeDelete(canUserDelete,deleteLayer)}
@@ -103,20 +108,20 @@ function makeColorChange(color, canUserChangeColor, modifyColor) {
103108
height:symbolSize,
104109
backgroundColor: color,
105110
display:'inline-block',
106-
marginLeft:5
111+
marginLeft: mLeft
107112
};
108113
if (canUserChangeColor) {
109114
return (
110-
<div style={bSty}>
115+
<div style={bStyWid}>
111116
<div style={feedBackStyle} onClick={() => modifyColor()} />
112117
<a className='ff-href'
113118
onClick={() => modifyColor()}
114-
style={Object.assign({},bSty,{marginLeft:5})}>Color</a>
119+
style={Object.assign({},bSty, {paddingLeft:5})}>Color</a>
115120
</div>
116121
);
117122
}
118123
else {
119-
return (<div style={Object.assign({},bSty, {width:15})}></div>);
124+
return false;
120125
}
121126

122127
}
@@ -130,25 +135,25 @@ function makeShape(isPointData, drawingDef, modifyShape) {
130135
var {width, height} = DrawUtil.getDrawingSize(size, drawingDef.symbol);
131136

132137
const feedBackStyle= {
133-
width:width,
134-
height:height,
138+
width,
139+
height,
135140
display:'inline-block',
136-
marginLeft:5
141+
marginLeft:mLeft
137142
};
138143

139144
return (
140-
<div style={bSty} >
145+
<div style={bStyWid} >
141146
<div style={feedBackStyle} onClick={() => modifyShape()}>
142147
<SimpleCanvas width={width} height={height} drawIt={ (c) => drawOnCanvas(c, df, width, height)}/>
143148
</div>
144149
<a className='ff-href'
145150
onClick={() => modifyShape()}
146-
style={Object.assign({}, bSty, {marginLeft:5})}>Symbol</a>
151+
style={Object.assign({}, bSty, {paddingLeft:5})}>Symbol</a>
147152
</div>
148153
);
149154
}
150155
else {
151-
return (<div style={Object.assign({},bSty, {width:20})}></div>);
156+
return false;
152157
}
153158

154159
}
@@ -179,15 +184,18 @@ function makeDelete(canUserDelete,deleteLayer) {
179184
const deleteStyle= {
180185
display:'inline-block',
181186
whiteSpace: 'nowrap',
182-
marginLeft: 5
187+
marginLeft: mLeft*2+symbolSize
183188
};
184189
if (canUserDelete) {
185190
return (
186-
<a className='ff-href' onClick={() => deleteLayer()} style={deleteStyle}>Delete</a>
191+
<div style={bStyWid}>
192+
<a className='ff-href'
193+
onClick={() => deleteLayer()} style={deleteStyle}>Delete</a>
194+
</div>
187195
);
188196
}
189197
else {
190-
return (<div style={Object.assign({},bSty, {width:15})}></div>);
198+
return false;
191199
}
192200

193201
}

0 commit comments

Comments
 (0)