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

[Chore]: Technical: Translate base-layer #1746

Merged
merged 6 commits into from
Mar 21, 2022

Conversation

HeimEndyd
Copy link
Collaborator

No description provided.

Signed-off-by: Maksim Suslov <maksim.suslov@actionengine.com>
export type VisualChannelDomain = number[] | string[];
export type VisualChannelField = Field | null;

export type LayerConfig = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's rename this constant from LayerConfig to LayerBaseConfig. And remove all the VisualChannel properties (colorField, colorDomain, colorScale, heightField, heightDomain, heightScale, sizeDomain, sizeScale, sizeField)

Visual channels various per layer, some layer have colorField and strokeColorField, and radiusField, some doesn't have any channels. We can add individual visual channel configs in each layer type. E.g. Point layer can be:

type PointVisualChannelConfig = {
  colorField: VisualChannelField;
  colorScale: VisualChannelScale;
  colorDomain: VisualChannelDomain;
  strokeColorField: VisualChannelField;
  strokeColorScale:  VisualChannelScale;
  strokeColorDomain: VisualChannelDomain;
  sizeField: VisualChannelField;
  sizeScale: VisualChannelScale;
  sizeDomain: VisualChannelDomain;
}
type PointLayer = BaseLayerConfig & PointVisualChannelConfig

You can look at each layer's get visualChannels method to see which visual channel this layer has

       field: 'strokeColorField',
        scale: 'strokeColorScale',
        domain: 'strokeColorDomain',

means this layer will have strokeColorField, strokeColorScale, strokeColorDomain in its config

@@ -350,7 +444,7 @@ class Layer {
* @param field - Selected field
* @returns {{}} - Column config
*/
assignColumn(key, field) {
assignColumn(key: string, field): LayerColumns {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(key: string, field: Field): LayerColumns

@@ -99,10 +99,11 @@ export function getLayerHoverProp({
return null;
}
const {dataContainer, fields} = datasets[dataId];
const data = layer.getHoverData(object, dataContainer, fields);
const data = layer.getHoverData(object, dataContainer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fields should be added to base-layer getHoverData method, instead of removing it here

Signed-off-by: Maksim Suslov <maksim.suslov@actionengine.com>
Signed-off-by: Maksim Suslov <maksim.suslov@actionengine.com>
@@ -523,7 +613,7 @@ class Layer {
}

getLayerColumns() {
const columnValidators = this.columnValidators || {};
const columnValidators = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.columnValidators shouldn't be removed. instead can we add it to base layer?

type ColumnValidator = (
  column: LayerConfigColumn,
  columns: LayerColumns,
  allFields: Field[]
) => boolean;

get columnValidators(): {[key: string]: ColumnValidator}

Signed-off-by: Maksim Suslov <maksim.suslov@actionengine.com>
@HeimEndyd HeimEndyd merged commit dd14702 into master Mar 21, 2022
@delete-merged-branch delete-merged-branch bot deleted the ms/js_to_ts_convertion/layers/base-layer branch March 21, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants