Bladeren bron

add contextHash to SizeTheme

Alexander Rose 1 jaar geleden
bovenliggende
commit
ba12a8bbee
2 gewijzigde bestanden met toevoegingen van 4 en 2 verwijderingen
  1. 1 0
      CHANGELOG.md
  2. 3 2
      src/mol-theme/size.ts

+ 1 - 0
CHANGELOG.md

@@ -8,6 +8,7 @@ Note that since we don't clearly distinguish between a public and private interf
 
 - Add `inverted` option to `xrayShaded` parameter
 - Model-export extension: Add ability to set a file name for structures
+- Add `contextHash` to `SizeTheme`
 
 ## [v3.36.1] - 2023-06-11
 

+ 3 - 2
src/mol-theme/size.ts

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ * Copyright (c) 2018-2023 mol* contributors, licensed under MIT, See LICENSE file for more info.
  *
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
@@ -19,6 +19,7 @@ interface SizeTheme<P extends PD.Params> {
     readonly granularity: SizeType
     readonly size: LocationSize
     readonly props: Readonly<PD.Values<P>>
+    readonly contextHash?: number
     readonly description?: string
 }
 namespace SizeTheme {
@@ -28,7 +29,7 @@ namespace SizeTheme {
     export const Empty: SizeTheme<{}> = { factory: EmptyFactory, granularity: 'uniform', size: () => 1, props: {} };
 
     export function areEqual(themeA: SizeTheme<any>, themeB: SizeTheme<any>) {
-        return themeA.factory === themeB.factory && deepEqual(themeA.props, themeB.props);
+        return themeA.contextHash === themeB.contextHash && themeA.factory === themeB.factory && deepEqual(themeA.props, themeB.props);
     }
 
     export interface Provider<P extends PD.Params = any, Id extends string = string> extends ThemeProvider<SizeTheme<P>, P, Id> { }