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

Refactor to create StyleProperty class #2739

Closed
lucaswoj opened this issue Jun 14, 2016 · 1 comment · Fixed by #5682
Closed

Refactor to create StyleProperty class #2739

lucaswoj opened this issue Jun 14, 2016 · 1 comment · Fixed by #5682

Comments

@lucaswoj
Copy link
Contributor

lucaswoj commented Jun 14, 2016

There are many methods within StyleLayer that only operate on a single style property.

  • setLayoutProperty
  • getLayoutProperty
  • getLayoutValue
  • setPaintProperty
  • getPaintProperty
  • getPaintValue
  • getPaintValueStopZoomLevels
  • getPaintInterpolationT
  • isPaintValueFeatureConstant
  • isLayoutValueFeatureConstant
  • isPaintValueZoomConstant
  • ...

A cleaner design would be to have a StyleProperty object per property with all of these methods

type StyleValue<T> {
  isZoomConstant: boolean;
  isFeatureConstant: boolean;
  calculate(zoom:number, featureProperties: {}) => T;
  getInterpolationT(zoom: number) =>;
  ...
}

At the same time we might make StyleTransition conform to the same interface as StyleProperty

ref #2629 (comment)

@jfirebaugh
Copy link
Contributor

👍 -- what gl-native does might serve as a model here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants