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] Pinch zoom gesture causes an exception #279

Open
ultrapoci opened this issue Dec 18, 2023 · 0 comments
Open

[BUG] Pinch zoom gesture causes an exception #279

ultrapoci opened this issue Dec 18, 2023 · 0 comments

Comments

@ultrapoci
Copy link

I've copy pasted this code from the example directory:

Chart(
    data: scatterData,
    variables: {
      '0': Variable(
        accessor: (List datum) => datum[0] as num,
      ),
      '1': Variable(
        accessor: (List datum) => datum[1] as num,
      ),
      '2': Variable(
        accessor: (List datum) => datum[2] as num,
      ),
      '4': Variable(
        accessor: (List datum) => datum[4].toString(),
      ),
    },
    marks: [
      PointMark(
        size: SizeEncode(variable: '2', values: [5, 20]),
        color: ColorEncode(
          variable: '4',
          values: Defaults.colors10,
          updaters: {
            'choose': {true: (_) => Colors.red}
          },
        ),
        shape: ShapeEncode(variable: '4', values: [
          CircleShape(hollow: true),
          SquareShape(hollow: true),
        ]),
      )
    ],
    axes: [
      Defaults.horizontalAxis,
      Defaults.verticalAxis,
    ],
    coord: RectCoord(
      horizontalRange: [0.05, 0.95],
      verticalRange: [0.05, 0.95],
      horizontalRangeUpdater: Defaults.horizontalRangeEvent,
      verticalRangeUpdater: Defaults.verticalRangeEvent,
    ),
    selections: {'choose': PointSelection(toggle: true)},
    tooltip: TooltipGuide(
      anchor: (_) => Offset.zero,
      align: Alignment.bottomRight,
      multiTuples: true,
    ),
  ),
),

It is supposed to handle zoom and panning, and it works, but the moment I do a somewhat "extreme" gesture (like zooming too much or doing a rotation with the two fingers of 360°) the program crashes due to an exception: [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RangeError (index): Invalid value: Not in inclusive range 0..99: -1.

I have no idea how to solve this issue.

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

No branches or pull requests

1 participant