Last active
August 9, 2017 21:37
-
-
Save alexburner/10d651798d7b5286fd05ec5a3a8c8d40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ActivityMapFrame.tsx | |
componentWillReceiveProps(nextProps: Props) { | |
// Destroy & re-create with config opts if they've changed | |
if (this.props.is3D !== nextProps.is3D) { | |
this.map.destroy(); | |
this.loadMap(nextProps); | |
return; | |
} | |
// Update edges/devices if they've changed | |
if ( | |
this.props.edges !== nextProps.edges || | |
this.props.devicesById !== nextProps.devicesById | |
) { | |
this.map.update(nextProps.edges, nextProps.devicesById); | |
} | |
// Update theme key if it's changed | |
if (this.props.themeKey !== nextProps.themeKey) { | |
this.map.setTheme({ themeKey }); | |
} | |
} | |
// ActivityMap.ts | |
setTheme(themeKey: ThemeKey) { | |
this.model ...etc | |
this.drawing ...etc | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment