react-konva

Konvajs: How to change position of group of texts

我是研究僧i 提交于 2020-04-30 06:25:04
问题 I'm using Konvajs, I have group of texts, and I want don't allow drag group outside of the canvas, I'm tried solved that using dragBoundFunc, but that don't help me, now I just try change group position during dragmove, but setPosition, setAbsloutePosition, nothing allow me to change group position stage.on('dragmove', (e) => stageOnDragMove(e, layer)); const stageOnDragMove = (e: Konva.KonvaEventObject<any>, layer: Konva.Layer) => { const selectionGroup = layer.findOne('#selection-group');

How to add corner radius on konva group using clip function?

房东的猫 提交于 2019-12-31 05:32:29
问题 I'm struggling to apply corner radius (on all sides) in a group shape using a custom clip function. Here's my codesandbox: https://codesandbox.io/s/w28nrrj885 回答1: I copied your clipSquare function into the plain JS snippet below to test your assumptions. It's all good. Looking further into your code the issue is that you are using the same x,y,w,h values in the definition of the group clip function as you use for the definition of the canvas. This has the effect of making the group overflow

Flip Image with react-konva

帅比萌擦擦* 提交于 2019-12-14 03:07:43
问题 With https://github.com/lavrton/react-konva How can I flip an image (horizontally or vertically) I am using this function, but it is not working: flip = direction => { this.setState({ width: -this.state.width }) } 回答1: It is better to use scale property: <Image image={this.state.image} scaleY={-1} y={200}/> So in your state, you should store scale property with 1 or -1 values, https://codesandbox.io/s/v6yk2j2w0l 来源: https://stackoverflow.com/questions/50690175/flip-image-with-react-konva