Skip to content

Commit

Permalink
added classname for td
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin IGARASHI committed Aug 18, 2020
1 parent 60e91ce commit 6b64376
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ table.legend-table{
border-collapse:collapse;
margin:0 auto;
}
td,th{
td.legend-table-td,th.legend-table-th{
border:1px solid #ffffff;
margin: 10px;
padding:2px;
Expand Down
6 changes: 3 additions & 3 deletions docs/bundle.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default class MapboxLegendControl implements IControl
label1.textContent = this.targets[l.id];
var tr = document.createElement('TR');
var td1 = document.createElement('TD');
td1.className='legend-table-td';
if ((symbol.attributes.style.backgroundImage && symbol.attributes.style.backgroundImage !== "url(undefined)")){
var img = document.createElement('img');
img.src = symbol.attributes.style.backgroundImage.replace('url(','').replace(')','');
Expand All @@ -74,6 +75,7 @@ export default class MapboxLegendControl implements IControl
td1.style.opacity = symbol.attributes.style.opacity;

var td2 = document.createElement('TD');
td2.className='legend-table-td';
td2.appendChild(label1)
tr.appendChild(td1);
tr.appendChild(td2);
Expand Down Expand Up @@ -101,8 +103,10 @@ export default class MapboxLegendControl implements IControl

var tr = document.createElement('TR');
var td1 = document.createElement('TD');
td1.className='legend-table-td';
td1.appendChild(svg)
var td2 = document.createElement('TD');
td2.className='legend-table-td';
td2.appendChild(label2)
tr.appendChild(td1);
tr.appendChild(td2);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@watergis/mapbox-gl-legend",
"version": "1.0.1",
"version": "1.0.2",
"description": "This module adds legend control which is able to create legend panel from mapbox style to mapbox-gl",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 6b64376

Please sign in to comment.