Skip to content

Commit 8e32431

Browse files
committed
improved tooltips appearance
1 parent b2f8d37 commit 8e32431

File tree

4 files changed

+31
-13
lines changed

4 files changed

+31
-13
lines changed

src/reducer/Rstyle.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,8 @@ export default function(state = iState, action){
3939
return setUpdated(style);
4040
}
4141
case 'LAYER_REORDER':{
42-
43-
// action.sourceIndex
44-
45-
// action.destindex
46-
4742
const layer = state.getIn(['rec','layers',action.sourceIndex]);
48-
// remove source index
49-
5043
const layers = state.getIn(['rec','layers']).splice(action.sourceIndex,1).splice(action.destIndex,0,layer);
51-
//console.log('layers:',layers);
5244
const style = state.setIn(['rec','layers'],layers);
5345
return setUpdated(style);
5446
}

src/view/Vlayer/VlayerGroup/VlayerGroupSettings.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default class VlayerGroupSettings extends React.Component {
4141
const spec = styleSpec.latest.layer;
4242

4343
let addSpec = {
44-
id:spec.id,
44+
//id:spec.id,
4545
type:spec.type,
4646
source:spec.source,
4747
'source-layer':spec['source-layer'],

src/view/Vproperty/VpropertyArray/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default class VpropertyArray extends React.Component {
8989
const {property, focus} = this.props;
9090
const value = property.value;
9191

92-
console.log('value:',value);
92+
//console.log('value:',value);
9393

9494
// check if funcName exists in List, if not assume vector (not expression)
9595

src/view/Vproperty/VpropertyInfo.jsx

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default class Vproperty extends React.Component {
1515

1616
errorMessage(error){
1717
if (typeof error === 'string') return error;
18-
console.log('errorMessage:',error);
18+
//console.log('errorMessage:',error);
1919
if (Map.isMap(error) || List.isList(error)){
2020
let message = '';
2121
error.keySeq().toArray().forEach((key)=>{
@@ -24,13 +24,39 @@ export default class Vproperty extends React.Component {
2424
return message;
2525
}
2626
}
27+
28+
tooltip(){
29+
const {error} = this.props;
30+
31+
if (error !== null && error !== undefined){
32+
window.$(this.errorIcon).tooltip();
33+
return;
34+
}
35+
window.$(this.icon).tooltip();
36+
}
37+
38+
componentDidMount(){
39+
//console.log('mounted');
40+
this.tooltip();
41+
}
42+
componentDidUpdate(){
43+
//console.log('updated');
44+
this.tooltip();
45+
}
46+
47+
componentWillUpdate(nextProps){
48+
const {error} = nextProps;
49+
if (error && this.icon) window.$(this.icon).tooltip('dispose');
50+
else if ((error === null || error === undefined) && this.errorIcon) window.$(this.errorIcon).tooltip('dispose');
51+
}
2752

2853
render(){
2954
const {doc, error} = this.props;
3055

3156
//console.log('error:',error);
57+
3258

33-
if (error !== null && error !== undefined) return <i title={this.errorMessage(error)} className="text-danger material-icons md-14">error</i>;
34-
return <i title={doc} className="material-icons md-14 text-muted">info_outline</i>;
59+
if (error !== null && error !== undefined) return <i title={this.errorMessage(error)} ref={ref => {this.errorIcon = ref;}} className="text-danger material-icons md-14">error</i>;
60+
return <i title={doc} ref={ref => {this.icon = ref;}} className="material-icons md-14 text-muted">info_outline</i>;
3561
}
3662
};

0 commit comments

Comments
 (0)