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

How to deal with sequence of scale and drag actions #933

Open
sunecosuri opened this issue May 29, 2023 · 3 comments
Open

How to deal with sequence of scale and drag actions #933

sunecosuri opened this issue May 29, 2023 · 3 comments
Labels
bug Something isn't working complete
Milestone

Comments

@sunecosuri
Copy link

Environments

  • Framework name: VueMoveable
  • Framework version: 2.0.0-beta57
  • Moveable Component version: 0.43.1
  • Testable Address(optional):

Description

const transform = translate(${translate[0]}px, ${translate[1]}px) rotate(${rotate}deg) scale(${scale[0]}, ${scale[1]});

I would like to move and scale in succession similar to this issue.
I would like to use translate without using helper, how can I get the 'translate[]' and 'scale[]' value?
I could not find the above state even with movable.getRect() or onDragEvent.
A sample code of how to get it would be great!

@sunecosuri
Copy link
Author

sunecosuri commented May 31, 2023

reproduce step

Prerequisite

<template>
  <VueMoveable
    ref="moveable"
    :target="targets"
    :resizeable="true"
    :draggable="true"
    :scalable="true"
    :snappable="true"
    :snap-gap="true"
    :snap-digit="0"
    :is-display-snap-digit="true"
    :snap-threshold="5"
    :keep-ratio="false"
    :element-guidelines="targets.map((_, i) => `.target${i}`)"
    :snap-directions="{
      top: true,
      right: true,
      bottom: true,
      left: true,
    }"
    :element-snap-directions="{
      top: true,
      right: true,
      bottom: true,
      left: true,
    }"
    @scale="onScale"
  />
</template>

<script lang="ts">
export default defineComponent({
  setup() {
    const targets = []
    const onScale = (event: OnScale) => {
      console.log(event)
    }
    return {
      targets,
      onScale
    }
  }
})
</script>
  1. Scaling in Y-axis direction
  2. Scaling in X-axis direction
  3. In the case of consecutive events, the value of event.cssText (ex: "transform: translate(NaNpx, NaNpx) scale(NaN, NaN);") is include NaN, and the frame moves to the upper left corner.
2023-05-31.9.43.20.mov

@daybrush daybrush added the bug Something isn't working label May 31, 2023
@daybrush daybrush added this to the 0.48.0 milestone May 31, 2023
@daybrush
Copy link
Owner

daybrush commented Jun 2, 2023

@sunecosuri

Is there an address I can test on?

It is difficult to reproduce the cause of the problem.

Also I will return a transform object from the render event in the next version.

onRender(e) {
     e.transformObject.translate,
     e.transformObject.scale,
}

@daybrush
Copy link
Owner

daybrush commented Jun 4, 2023

@sunecosuri

  • croact-moveable 0.4.0
  • @moveable/helper 0.1.2
  • lit-moveable 0.25.0
  • moveable 0.48.0
  • preact-moveable 0.50.0
  • react-moveable 0.51.0
  • svelte-moveable 0.40.0
  • vue-moveable 2.0.0-beta.76
  • vue3-moveable 0.23.0
  • ngx-moveable 0.45.0

moveable's new version is released.

onRender(e) {
     e.transformObject.translate,
     e.transformObject.scale,
}

You can use the transformObject property in the render event.
rotate is a number and everything else is an array of numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working complete
Projects
None yet
Development

No branches or pull requests

2 participants