Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AUS-3966 Fixed the permanentLink opacity restore issue. #284

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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