src/pages/project/pageadmin.js
function (id, type) {
    if (this.state.sourcePageID !== id) {
      var selectedPage;

      this.state.pages.forEach(function (page) {
        if (parseInt(page.id, 10) === parseInt(id, 10)) {
          selectedPage = page;
        }
      });

      if (!selectedPage) {
        console.warn('Page not found.');
        return;
      }

      var currentZoom = this.state.matrix[0];
      var {x, y} = this.cartesian.getFocusTransform(selectedPage.coords, this.state.matrix[0]);
      var newState = {
        matrix: [currentZoom, 0, 0, currentZoom, x, y]
      };

      if (type === 'selected') {
        newState.selectedEl = id;
      } else if (type === 'source') {
        newState.sourcePageID = id;
      }

      this.setState(newState);
    }
  }
function (id, type) {
    if (this.state.sourcePageID !== id) {
      var selectedPage;

      this.state.pages.forEach(function (page) {
        if (parseInt(page.id, 10) === parseInt(id, 10)) {
          selectedPage = page;
        }
      });

      if (!selectedPage) {
        console.warn('Page not found.');
        return;
      }

      var currentZoom = this.state.matrix[0];
      var {x, y} = this.cartesian.getFocusTransform(selectedPage.coords, this.state.matrix[0]);
      var newState = {
        matrix: [currentZoom, 0, 0, currentZoom, x, y]
      };

      if (type === 'selected') {
        newState.selectedEl = id;
      } else if (type === 'source') {
        newState.sourcePageID = id;
      }

      this.setState(newState);
    }
  }
function ( id , type ) { if ( this . state . sourcePageID !== id ) { var selectedPage ; this . state . pages . forEach ( function ( page ) { if ( parseInt ( page . id , 10 ) === parseInt ( id , 10 ) ) { selectedPage = page ; } } ) ; if ( ! selectedPage ) { console . warn ( 'Page not found.' ) ; return ; } var currentZoom = this . state . matrix [ 0 ] ; var { x , y } = this . cartesian . getFocusTransform ( selectedPage . coords , this . state . matrix [ 0 ] ) ; var newState = { matrix : [ currentZoom , 0 , 0 , currentZoom , x , y ] } ; if ( type === 'selected' ) { newState . selectedEl = id ; } else if ( type === 'source' ) { newState . sourcePageID = id ; } this . setState ( newState ) ; } }
Highlight a page in the UI and move camera to center it
@param  {Number|String} id ID of page
@param  {Number|String} type Type of highlight ("selected", "source")
Highlight a page in the UI and move camera to center it