Skip to content

Commit

Permalink
Update extension classes to leverage new default props behavior (visg…
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress authored Jan 6, 2023
1 parent e11a615 commit e20d7c7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
11 changes: 0 additions & 11 deletions modules/extensions/src/brushing/brushing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ export default class BrushingExtension extends LayerExtension {
brushingTargets: {
size: 2,
accessor: 'getBrushingTarget',
// Hack: extension's defaultProps is not merged with the layer's defaultProps,
// So we can't use the standard accessor when the prop is undefined
// TODO - move to an option
// eslint-disable-next-line @typescript-eslint/unbound-method
update: this.props.getBrushingTarget ? undefined : extension.useConstantTargetPositions,
shaderAttributes: {
brushingTargets: {
divisor: 0
Expand Down Expand Up @@ -111,10 +106,4 @@ export default class BrushingExtension extends LayerExtension {
});
}
}

useConstantTargetPositions(attribute) {
attribute.constant = true;
attribute.value = new Float32Array(2);
return;
}
}
4 changes: 2 additions & 2 deletions modules/extensions/src/clip/clip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ export default class ClipExtension extends LayerExtension {
}

/* eslint-disable camelcase */
draw(this: Layer<ClipExtensionProps>, {uniforms}: any): void {
const {clipBounds = defaultProps.clipBounds} = this.props;
draw(this: Layer<Required<ClipExtensionProps>>, {uniforms}: any): void {
const {clipBounds} = this.props;
if (this.state.clipByInstance) {
uniforms.clip_bounds = clipBounds;
} else {
Expand Down
4 changes: 2 additions & 2 deletions modules/extensions/src/mask/mask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export default class MaskExtension extends LayerExtension {
}

/* eslint-disable camelcase */
draw(this: Layer<MaskExtensionProps>, {uniforms, context, moduleParameters}: any) {
draw(this: Layer<Required<MaskExtensionProps>>, {uniforms, context, moduleParameters}: any) {
uniforms.mask_maskByInstance = this.state.maskByInstance;
const {maskId = '', maskInverted = false} = this.props;
const {maskId, maskInverted} = this.props;
const {maskChannels} = moduleParameters;
const {viewport} = context;
if (maskChannels && maskChannels[maskId]) {
Expand Down

0 comments on commit e20d7c7

Please sign in to comment.