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

[Bug] TransformMode "Error: coordinates must contain numbers" when selectedIndexes is empty array. #146

Open
1 of 8 tasks
lawrencenika opened this issue Oct 15, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@lawrencenika
Copy link

Module

  • deck.gl-community/arrow-layers
  • deck.gl-community/bing-maps
  • deck.gl-community/editable-layers
  • deck.gl-community/experimental
  • deck.gl-community/graph-layers
  • deck.gl-community/layers
  • deck.gl-community/react
  • deck.gl-community/react-graph-layer

Description

simply turning on mode to compositemode with transformmode inside will cause it to throw error:

app-index.js:33 deck: initialization of EditableGeoJsonLayer({id: 'EditableGeoJsonLayer'}): coordinates must contain numbers Error: coordinates must contain numbers
    at point (index.js:206:15)
    at RotateMode.getGuides (rotate-mode.js:82:82)
    at TransformMode.getGuides (composite-mode.js:48:36)
    at TransformMode.getGuides (transform-mode.js:57:37)
    at CompositeMode.getGuides (composite-mode.js:48:36)
    at EditableGeoJsonLayer.createGuidesLayers (editable-geojson-layer.js:376:29)
    at EditableGeoJsonLayer.renderLayers (editable-geojson-layer.js:260:37)
    at EditableGeoJsonLayer._postUpdate (composite-layer.js:202:40)
    at EditableGeoJsonLayer._update (layer.js:815:18)
    at EditableGeoJsonLayer._initialize (layer.js:755:14)
    at LayerManager._initializeLayer (layer-manager.js:300:19)
    at LayerManager._updateSublayersRecursively (layer-manager.js:267:26)
    at LayerManager._updateLayers (layer-manager.js:234:14)
    at LayerManager.setLayers (layer-manager.js:174:14)
    at LayerManager.updateLayers (layer-manager.js:185:18)
    at Deck._onRenderFrame (deck.js:743:27)
    at AnimationLoop._renderFrame (animation-loop.js:263:20)
    at AnimationLoop.redraw (animation-loop.js:161:14)
    at AnimationLoop._animationFrame (animation-loop.js:251:14)
    "@deck.gl-community/editable-layers": "^9.0.3"
    "@deck.gl/layers": "^9.0.28"
    "@deck.gl/react": "^9.0.28",

Expected Behavior

no error

Steps to Reproduce

use the following mode:

            new CompositeMode([
                new TransformMode(),
                new ViewMode(),
            ]),

Environment

  • Framework version: nextjs
  • Browser: arc
  • OS: mac

Logs

No response

@lawrencenika lawrencenika added the bug Something isn't working label Oct 15, 2024
@xinaesthete
Copy link
Collaborator

Yes I'd noticed this before as well and have been meaning to dig a bit deeper and possibly make a PR - there are some other issues with other modes as well, this one slipped my mind.

It attempts to make a bounding-box of an empty array and ends up with NaNs etc. When selectedIndexes is not empty it works.

@xinaesthete xinaesthete changed the title [Bug] [Bug] TransformMode "Error: coordinates must contain numbers" when selectedIndexes is empty array. Oct 17, 2024
@lawrencenika
Copy link
Author

I see, can you point me the line of code? I see if I can help in anyway or figure out a hack (e.g. maybe set selectedIndexes to non empty)

@giangbv1984
Copy link
Contributor

giangbv1984 commented Dec 18, 2024

I see, can you point me the line of code? I see if I can help in anyway or figure out a hack (e.g. maybe set selectedIndexes to non empty)

Hi @lawrencenika
You can set selectedFeatureIndexes: [0]. Or you should check the selectedIndexes is not empty (length > 0), you can use the TransformMode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants