Skip to content

Commit 65f6d4c

Browse files
committed
Small tweaks
1 parent 2b2a985 commit 65f6d4c

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

packages/base/src/dialogs/components/symbology/CanvasSelectComponent.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ const CanvasSelectComponent = ({
7676
nshades: 255,
7777
format: 'rgbaString'
7878
});
79-
const ting = { name: name, colors: colorRamp };
80-
colorMapList.push(ting);
79+
const colorMap = { name: name, colors: colorRamp };
80+
colorMapList.push(colorMap);
8181

8282
setColorMaps(colorMapList);
8383
});
@@ -110,12 +110,12 @@ const CanvasSelectComponent = ({
110110

111111
const updateCanvas = (rampName: string) => {
112112
// update canvas for displayed color ramp
113-
const cv = document.getElementById('cv') as HTMLCanvasElement;
114-
if (!cv) {
113+
const canvas = document.getElementById('cv') as HTMLCanvasElement;
114+
if (!canvas) {
115115
return;
116116
}
117-
cv.style.visibility = 'hidden';
118-
const ctx = cv.getContext('2d');
117+
canvas.style.visibility = 'hidden';
118+
const ctx = canvas.getContext('2d');
119119

120120
if (!ctx) {
121121
return;
@@ -131,7 +131,7 @@ const CanvasSelectComponent = ({
131131

132132
ctx.fillRect(i * 2, 0, 2, 50);
133133
}
134-
cv.style.visibility = 'initial';
134+
canvas.style.visibility = 'initial';
135135
};
136136

137137
useEffect(() => {
@@ -147,7 +147,6 @@ const CanvasSelectComponent = ({
147147
id="jp-gis-canvas-button"
148148
onClick={toggleDropdown}
149149
className="jp-Dialog-button jp-gis-canvas-button"
150-
// style={{ visibility: 'hidden' }}
151150
>
152151
<canvas
153152
id="cv"

packages/base/src/dialogs/components/symbology/ColorRamp.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ const ColorRamp = ({ layerId, modeOptions, classifyFunc }: IColorRampProps) => {
3030
const populateOptions = async () => {
3131
const stateDb = GlobalStateDbManager.getInstance().getStateDb();
3232

33-
const layerState = await stateDb?.fetch(`jupytergis:${layerId}`);
33+
const layerState = (await stateDb?.fetch(
34+
`jupytergis:${layerId}`
35+
)) as ReadonlyJSONObject;
3436

3537
let nClasses, singleBandMode, colorRamp;
3638

3739
if (layerState) {
38-
nClasses = (layerState as ReadonlyJSONObject).numberOfShades as string;
39-
singleBandMode = (layerState as ReadonlyJSONObject)
40-
.selectedMode as string;
41-
colorRamp = (layerState as ReadonlyJSONObject).selectedRamp as string;
40+
nClasses = layerState.numberOfShades as string;
41+
singleBandMode = layerState.selectedMode as string;
42+
colorRamp = layerState.selectedRamp as string;
4243
}
4344

4445
setNumberOfShades(nClasses ? nClasses : '9');

packages/base/src/dialogs/components/symbology/ColorRampEntry.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ interface IColorRampEntryProps {
88
}
99

1010
const ColorRampEntry = ({ index, colorMap, onClick }: IColorRampEntryProps) => {
11-
// const canvasWidth = 345;
1211
const canvasHeight = 30;
1312

1413
useEffect(() => {
15-
const cv = document.getElementById(`cv-${index}`) as HTMLCanvasElement;
16-
if (!cv) {
14+
const canvas = document.getElementById(`cv-${index}`) as HTMLCanvasElement;
15+
if (!canvas) {
1716
return;
1817
}
19-
const ctx = cv.getContext('2d');
18+
const ctx = canvas.getContext('2d');
2019

2120
if (!ctx) {
2221
return;
@@ -41,7 +40,6 @@ const ColorRampEntry = ({ index, colorMap, onClick }: IColorRampEntryProps) => {
4140
<span className="jp-gis-color-label">{colorMap.name}</span>
4241
<canvas
4342
id={`cv-${index}`}
44-
// width={canvasWidth}
4543
height={canvasHeight}
4644
className="jp-gis-color-canvas"
4745
></canvas>

packages/base/src/dialogs/components/symbology/Graduated.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ const Graduated = ({
286286

287287
const valueColorPairs: IStopRow[] = [];
288288

289-
// assume stops and colors are same length
290289
for (let i = 0; i < +numberOfShades; i++) {
291290
valueColorPairs.push({ stop: stops[i], output: colorMap[i] });
292291
}
@@ -364,12 +363,6 @@ const Graduated = ({
364363
>
365364
Add Stop
366365
</Button>
367-
{/* <Button
368-
className="jp-Dialog-button jp-mod-accept jp-mod-styled"
369-
onClick={buildColorInfoFromClassification}
370-
>
371-
Classify
372-
</Button> */}
373366
</div>
374367
</div>
375368
);

0 commit comments

Comments
 (0)