-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
Signed-off-by: Maksim Suslov <maksim.suslov@actionengine.com>
src/layers/base-layer.ts
Outdated
export type VisualChannelDomain = number[] | string[]; | ||
export type VisualChannelField = Field | null; | ||
|
||
export type LayerConfig = { |
There was a problem hiding this comment.
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
src/layers/base-layer.ts
Outdated
@@ -350,7 +444,7 @@ class Layer { | |||
* @param field - Selected field | |||
* @returns {{}} - Column config | |||
*/ | |||
assignColumn(key, field) { | |||
assignColumn(key: string, field): LayerColumns { |
There was a problem hiding this comment.
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
src/utils/layer-utils.js
Outdated
@@ -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); |
There was a problem hiding this comment.
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>
src/layers/base-layer.ts
Outdated
@@ -523,7 +613,7 @@ class Layer { | |||
} | |||
|
|||
getLayerColumns() { | |||
const columnValidators = this.columnValidators || {}; | |||
const columnValidators = {}; |
There was a problem hiding this comment.
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>
Signed-off-by: Maksim Suslov <maksim.suslov@actionengine.com>
No description provided.