【问题标题】:allowTouchScrolling: true not working for my fabricjs canvasallowTouchScrolling:真的不适用于我的 fabricjs 画布
【发布时间】:2021-06-13 15:31:48
【问题描述】:

我有一个想要在移动设备上滚动的画布。

所以我将它添加到画布实例中:allowTouchScrolling: true。像这样:

var canvas = new fabric.Canvas('c', {
    allowTouchScrolling: true
});
canvas.allowTouchScrolling = true;

我知道这是双重的,但我想我会尝试两种方式,不幸的是两种方式都行不通。

画布的代码笔:https://codepen.io/twan2020/pen/dyOLJOz

您可以滚动滚动条,但不能在画布内滚动或拖动。为什么?

【问题讨论】:

    标签: javascript canvas fabricjs


    【解决方案1】:

    如果您使用的是版本 2 或更高版本(我使用的是 4.5.0),那么您应该更新 fabric js 库。 enter image description here

    enter image description here

    来源:-https://github.com/fabricjs/fabric.js/pull/5904/commits/50962efe6bbd77174cda2e9bd169c19d301edb7a

    【讨论】:

    • 抱歉这个愚蠢的问题,但是究竟如何更新fabric js库?
    猜你喜欢
    • 1970-01-01
    • 2021-06-13
    • 1970-01-01
    • 2016-09-30
    • 1970-01-01
    • 1970-01-01
    • 2017-07-18
    • 1970-01-01
    • 2021-01-01
    相关资源
    最近更新 更多