konvajs - How can I drag stage only x axis in Konva.js
问题描述
When I drag a stage, stage moves only x-axis.
But konva.js docs doesn't have explanation about it..
Just modify Konva.js sources about drag and i use it?
Or I missed something?
解决方案
我已经找到了。。
var stage = new Konva.Stage({
container: 'container',
width: window.innerWidth,
height: window.innerHeight,
draggable: true,
dragBoundFunc: (pos) => {
return {
x : pos.x,
y : 0
}
}
});
完成。
推荐阅读
- amazon-web-services - AWS CDK:为什么 S3 存储桶策略发生错误
- reactjs - 无法在 React 组件中触发 click 事件
- javascript - 从服务器 php javascript 更新动态表单,但需要保持在浏览器的同一页面上
- javascript - 如何在javascript中按值删除数组内的数组
- python - python导入错误,因为sys.path引用了另一个目录
- ios - 它是哪种图形类型?
- django - 为什么 date_joined 为空?
- python - 如果发生错误以使用不同的 URL,则 Python 异常 - openrouteservice
- django - 使用 django 从数据库中删除/重置一个/多个(指定)模型
- enums - 如何从 Hasura 创建一个 get-graphql-schema 枚举?