message: ViewFlags and env settings are undo-able.
diff: @@ -12,10 +12,11 @@ import {
  Viewport,
  } from "@bentley/imodeljs-frontend";
  import {
  + AmbientOcclusion,
  BackgroundMapProps,
  BackgroundMapType,
  RenderMode,
  - AmbientOcclusion,
  + ViewFlags,
  } from "@bentley/imodeljs-common";
  import { CheckBox, createCheckBox } from "./CheckBox";
  import { createComboBox } from "./ComboBox";
  @@ -43,6 +44,7 @@ export class ViewAttributes {
  private _aoBlurDelta?: Slider;
  private _aoBlurSigma?: Slider;
  private _aoBlurTexelStepSize?: Slider;
  + private _scratchViewFlags = new ViewFlags();
  public constructor(vp: Viewport, parent: HTMLElement) {
  this._vp = vp;
  @@ -87,7 +89,9 @@ export class ViewAttributes {
  private addViewFlagAttribute(label: string, flag: ViewFlag, only3d: boolean = false): void {
  const elems = this.addCheckbox(label, (enabled: boolean) => {
  - this._vp.view.viewFlags[flag] = enabled;
  + const vf = this._vp.view.viewFlags.clone(this._scratchViewFlags);
  + vf[flag] = enabled;
  + this._vp.view.viewFlags = vf;
  this.sync();
  });
  @@ -102,23 +106,23 @@ export class ViewAttributes {
  }
  private addEnvAttribute(label: string, aspect: EnvironmentAspect): void {
  - const getEnv = (view: ViewState, path: EnvironmentAspect) => {
  - const view3d = view as ViewState3d;
  - const style = view3d.getDisplayStyle3d();
  - return style.environment[path];
  - };
  -
  const elems = this.addCheckbox(label, (enabled: boolean) => {
  - const env = getEnv(this._vp.view, aspect);
  - env.display = enabled;
  + const view3d = this._vp.view as ViewState3d;
  + const style = view3d.getDisplayStyle3d();
  + const env = style.environment;
  + env[aspect].display = enabled;
  + view3d.getDisplayStyle3d().environment = env; // setter converts it to JSON
  this.sync();
  });
  const update = (view: ViewState) => {
  const visible = view.is3d();
  elems.div.style.display = visible ? "block" : "none";
  - if (visible)
  - elems.checkbox.checked = getEnv(view, aspect).display;
  + if (visible) {
  + const view3d = view as ViewState3d;
  + const style = view3d.getDisplayStyle3d();
  + elems.checkbox.checked = style.environment[aspect].display;
  + }
  };
  this._updates.push(update);
  