Skip to content

Commit

Permalink
Merge pull request #284 from jia020/master
Browse files Browse the repository at this point in the history
AUS-3966 Fixed the permanentLink opacity restore issue.
  • Loading branch information
vjf committed Jun 21, 2023
1 parent 2fa8a21 commit 5a5f729
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/app/menupanel/layerpanel/layerpanel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,16 @@ export class LayerPanelComponent implements OnInit {
me.layerGroups[group].expanded = true;
me.layerGroups[group].loaded = me.layerGroups[group];
me.layerGroups[group][layer_idx].expanded = true;
if (layerStateObj[uiLayerModel.id].opacity) {
// Load opacity from state
const opacity = layerStateObj[uiLayerModel.id].opacity;
uiLayerModel.opacity = opacity;
me.uiLayerModelService.setUILayerModel(me.layerGroups[group][layer_idx].id, uiLayerModel);
const layer = me.layerGroups[group].loaded[layer_idx];
setTimeout(() => {
me.csMapService.setLayerOpacity(layer, opacity / 100);
}, 1000);
}
if (layerStateObj[uiLayerModel.id].filterCollection && layerStateObj[uiLayerModel.id].filterCollection.hasOwnProperty('hiddenParams')) {
me.layerGroups[group][layer_idx].filterCollection.hiddenParams = layerStateObj[uiLayerModel.id].filterCollection.hiddenParams;
}
Expand Down
4 changes: 3 additions & 1 deletion src/app/services/user/user-state.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { CsMapService, ManageStateService } from '@auscope/portal-core-ui';
import { v4 as uuidv4 } from 'uuid';
import { HttpResponse } from '@angular/common/http';
import { environment } from 'environments/environment';
import { UILayerModelService } from '../ui/uilayer-model.service';


@Injectable()
Expand All @@ -26,7 +27,7 @@ export class UserStateService {
private _states: BehaviorSubject<PermanentLink[]> = new BehaviorSubject([]);
public readonly states: Observable<PermanentLink[]> = this._states.asObservable();

constructor(private apiService: AuscopeApiService, private manageStateService: ManageStateService, private csMapService: CsMapService) {}
constructor(private apiService: AuscopeApiService, private manageStateService: ManageStateService, private csMapService: CsMapService, private uiLayerModelService: UILayerModelService) {}

/**
* Get the currently logged in user (if one is logged in)
Expand Down Expand Up @@ -157,6 +158,7 @@ export class UserStateService {
if (layerKey.toLowerCase() !== 'map' && layerKey.toLowerCase() !== 'basemap') {
const layerIndex = this.csMapService.getLayerIndex(layerKey);
state[layerKey].index = layerIndex;
state[layerKey].opacity = this.uiLayerModelService.getUILayerModel(layerKey).opacity;
}
}
return this.apiService.saveUserPortalState(id, name, description, JSON.stringify(state), isPublic).pipe(map(response => {
Expand Down

0 comments on commit 5a5f729

Please sign in to comment.