Skip to content

Commit 69e01f5

Browse files
committed
source panel updates and new logo
1 parent 4e2df94 commit 69e01f5

40 files changed

+971
-244
lines changed

package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"mapbox-gl": "^0.44.2",
3131
"mapbox-gl-inspect": "^1.3.1",
3232
"react-beautiful-dnd": "^7.1.3",
33+
"react-color": "^2.14.1",
3334
"react-redux": "^5.0.7",
3435
"react-router": "^4.2.0",
3536
"react-router-dom": "^4.2.2",

public/favicon.ico

0 Bytes
Binary file not shown.

public/favicon.png

708 Bytes
Loading

public/img/icon copy 3.png

-5 KB
Binary file not shown.

public/img/icon copy 4.png

-3.83 KB
Binary file not shown.

public/img/icon.png

742 Bytes
Loading

src/App.css

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ label .badge{position:relative;top:2px;}
3939
.CodeMirror-linenumbers{}
4040
.CodeMirror-gutters{background:transparent;border-right:1px solid transparent;}
4141

42+
.code-error-left{left:-7px;}
43+
4244
.close-pos{top:0.25rem;right:0.25rem;}
4345

4446
.cm-s-default .cm-string{color: #03838F;}
@@ -71,12 +73,16 @@ label .badge{position:relative;top:2px;}
7173

7274
.flex-2{flex:2;}
7375

76+
.font-sm{font-size:0.7rem;}
77+
.font-med{font-size:0.8rem;}
78+
.font-lg{font-size:0.9rem;}
79+
7480
.form-group label{font-size:0.8em;}
7581
.form-control{font-size:0.85em;}
7682
.form-control-sm{font-size:0.875rem;}
7783
.form-control .btn{line-height:1.2;}
7884

79-
.func-border{border:2px solid #E6E6E6;border-radius:3px;}
85+
.func-border{border:1px solid #546D79;}
8086
.func-add{border:1px dashed #EEEEEE;padding:0.2rem;font-size:0.7em;
8187
cursor:pointer;}
8288
.func-add label{display:none;}
@@ -102,7 +108,10 @@ label .badge{position:relative;top:2px;}
102108

103109
.layer-search-pos{right:34px;left:6px;top:6px;}
104110

105-
.link-list{font-size:0.88em;color:#37474F;text-decoration:none;
111+
.left-col-title{line-height:34px;}
112+
.left-col-title input{font-size:0.7rem;}
113+
114+
.link-list{color:#37474F;text-decoration:none;
106115
overflow-wrap:break-word;word-wrap:break-word;word-break: break-word;
107116
font-weight:400;text-overflow:ellipsis;overflow:hidden;white-space: nowrap;}
108117
.link-list:hover{color:#273237;text-decoration:none;background-color:#FFF;}
@@ -117,10 +126,12 @@ label .badge{position:relative;top:2px;}
117126
.list-border-right{border-right:3px solid #E6E6E6;}
118127
.list-border-right.active{border-right:3px solid #273237;}
119128

120-
.list-right{position:absolute;right:10px;top:3px;}
121-
.list-left{position:absolute;left:10px;top:3px;}
129+
.list-right{position:absolute;right:8px;top:3px;}
130+
.list-left{position:absolute;left:4px;top:3px;}
131+
132+
.list-layer-color{position:absolute;left:8px;top:0;}
122133

123-
.link-list.p-list{padding-left:34px!important;padding-right:30px!important;}
134+
.link-list.p-list{padding-left:28px!important;padding-right:24px!important;}
124135
.link-list.pr-list{padding-right:30px!important;}
125136
.link-list.pl-list{padding-left:30px!important;}
126137

@@ -162,6 +173,9 @@ label .badge{position:relative;top:2px;}
162173
.o-scroll{overflow:scroll;}
163174
.o-y-scroll{overflow-y:auto;}
164175

176+
.panel-min-height{min-height:300px;}
177+
.panel-z-index{z-index:3;}
178+
165179
.property{position:relative;}
166180
.property label{font-size:0.65em;color:#616161;}
167181
.property input{border:none;border-radius:0px;border-bottom:1px solid #BDBDBD;}
@@ -172,6 +186,8 @@ label .badge{position:relative;top:2px;}
172186
.property .border-left{border-left:1px solid #EEEEEE;}
173187
.property .error-icon{top:0;left:-15px;}
174188

189+
.right-col-title{line-height:30px;}
190+
175191

176192
.swatch{width:22px;height:22px;cursor:pointer;}
177193
.swatch:hover{border:1px solid #AEAEAE;}
@@ -181,9 +197,11 @@ label .badge{position:relative;top:2px;}
181197
.swatch-pos{left:6px;top:4px;}
182198
.swatch-input-pl{padding-left:38px;}
183199

184-
.text-nav{line-height:34px;font-size:1em;}
200+
.text-nav{line-height:34px;}
185201
.text-overflow-ellipsis{text-overflow:ellipsis;overflow:hidden;white-space: nowrap;}
186202

203+
.tooltip{font-size:0.7rem;}
204+
187205
.w-max-500{max-width:500px;}
188206

189207
#map{position:absolute;top:0;bottom:0;left:0;right:0;width:100%;}

src/model/Msource.js

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,37 @@ import Store from '../Store';
22
import SourceReader from '../utility/SourceReader';
33
import MaterialColor from '../utility/MaterialColor';
44

5+
import styleSpec from '../vendor/style-spec/style-spec';
6+
57
import Mstyle from './Mstyle';
68

79
export default {
810

9-
add:function(source){
11+
add:function(source,key,makeLayers){
1012
return new Promise((resolve,reject)=>{
1113
if (!source.url) throw new Error('no source.url');
1214
if (!source.type) throw new Error('no source.type');
1315

16+
//set key on source
17+
key = key || source.url;
18+
1419
SourceReader.load(source.url).then((sourceJson)=>{
1520

1621
Store.dispatch({
1722
type:'SOURCE_ADD',
18-
payload:source
23+
payload:source,
24+
key:key
1925
});
2026
Store.dispatch({
2127
type:'STYLE_STORE_SETIN',
2228
key:['sourceJson',source.url],
2329
payload:sourceJson
2430
});
2531

26-
const sourceLayers = sourceJson.vector_layers;
27-
this.setupInitialLayers(source, sourceLayers);
32+
if (makeLayers){
33+
const sourceLayers = sourceJson.vector_layers;
34+
this.setupInitialLayers(key, sourceLayers);
35+
}
2836

2937
Mstyle.save();
3038
return resolve(source);
@@ -35,6 +43,41 @@ export default {
3543

3644
},
3745

46+
getAllTypeOptions:function(){
47+
const spec = styleSpec.latest;
48+
let values = {};
49+
for (let i in spec){
50+
if (i.indexOf('source_') === 0){
51+
const type = i.replace('source_','').replace('_','-');
52+
if (spec[i].type && spec[i].type.values && spec[i].type.values[type])
53+
values[type] = {doc:spec[i].type.values[type].doc};
54+
}
55+
}
56+
return values;
57+
},
58+
59+
remove:function(key){
60+
return new Promise((resolve,reject)=>{
61+
// remove all style layers associated with this source
62+
const layers = Mstyle.get().getIn(['rec','layers']);
63+
console.log('layers:',layers);
64+
layers.map((layer)=>{
65+
if (layer.get('source') === key){
66+
Store.dispatch({
67+
type:'LAYER_REMOVE',
68+
layerId:layer.get('id')
69+
});
70+
}
71+
});
72+
73+
Mstyle.removeIn(['sources',key]).then(()=>{
74+
resolve();
75+
}).catch((e)=>{
76+
reject(e);
77+
});
78+
});
79+
},
80+
3881
setJSON:function(key,source){
3982
//console.log('setJSON source:',source);
4083
return new Promise((resolve,reject)=>{
@@ -46,19 +89,21 @@ export default {
4689
});
4790

4891
Mstyle.save();
92+
93+
return resolve();
4994
}).catch((e)=>{
5095
return reject(e);
5196
});
5297
});
5398
},
5499

55-
setupInitialLayers:function(source, sourceLayers){
100+
setupInitialLayers:function(key, sourceLayers){
56101
return new Promise((resolve,reject)=>{
57102
sourceLayers.map((sourceLayer)=>{
58103
const color = MaterialColor.getBright(sourceLayer.id);
59104
let layer = {
60105
id:sourceLayer.id,
61-
source:source.url,
106+
source:key,
62107
'source-layer':sourceLayer.name,
63108
layout: {
64109
visibility: 'visible'

src/model/MstyleSource.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
Msource.add({
2020
url:sourceUrl,
2121
type:'vector'
22-
}).then((source)=>{
22+
},NameFromURL(sourceUrl),true).then((source)=>{
2323
//console.log('added source:',source);
2424
const json = Msource.getJson(source.url);
2525
console.log('added source json:',json);

0 commit comments

Comments
 (0)