Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

130
Visualizações
Smooth scrolling in chart pane gesture

I set a pane gesture on chart to make chart horizontal scroll , but the problem is when user move quickly the gesture will move the chart by a very small percentage , how can I make smoothing scroll , so that if the user moves fast, the graph moves quickly as well .

Note that : drawChart() will scroll chart to event.x pixel and redraw the chart .

Here is my pan gesture code :

    private mobileHandleEvent(event: WindowEvent): boolean {
        let pos = this._lastPoint = {x: event.pointerPosition.x, y: event.pointerPosition.y};

        switch (event.evt.type) {
            case TouchEvent.START: {
                if (this._checkButton(event) && this._checkHit(event)) {
                    this._prevPoint = {x: pos.x, y: pos.y};
                    this._which = event.evt.type === TouchEvent.START ? 1 : event.evt.which;
                    this._state = GestureState.STARTED;
                    this.drawChart();

                    return true;
                }
                break;
            }
            case TouchEvent.MOVE: {
                let offset = this.moveOffset;
                if (this.isActive()) {
                    offset.x = 1.5 * (pos.x - this._prevPoint.x);
                    offset.y = 1.5 * (pos.y - this._prevPoint.y);

                    let minMoveDistance = this.minMoveDistance;
                    if ((this.horizontalMoveEnabled && Math.abs(offset.x) >= minMoveDistance) ||
                        (this.verticalMoveEnabled && Math.abs(offset.y) >= minMoveDistance)) {
                        
                        this._state = GestureState.CONTINUED;
                       
                                this.drawChart();
                        }}
                    return true;
                }
                break;
            }
            case TouchEvent.END: {
                if (this.isActive()) {
                    this._state = GestureState.FINISHED;
                    this.drawChart();

                    return true;
                }
                break;
            }
        }

        return false;
    }
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda