Code Monkey home page Code Monkey logo

Comments (4)

larsrinn avatar larsrinn commented on August 30, 2024

Don't you attach the event handler to a vue-draggable-resizable? If you do that, you should automatically know which component got resized and can pass that to your event handling function.

from vue-draggable-resizable.

mauricius avatar mauricius commented on August 30, 2024

@ScorpioX you can use function composition to achieve your purpose. Take a look at this example.

<template>
  <div id="app">
    <div style="height: 500px; width: 500px; margin: 20px; border: 1px solid red; position: relative;">
      <template v-for="element in elements">
        <vue-draggable-resizable :parent="true" :resizable="true" :x="element.x" :y="element.y" style="border: 1px solid" @resizing="(left, top, width, height) => onResizing(element.id, left, top, width, height)">
          <p>{{ element.id }}</p>
        </vue-draggable-resizable>
      </template>
    </div>
    <button @click="change">Cambia posizione</button>
  </div>
</template>
export default {
  data () {
    return {
      elements: [
        {
          id: 'one',
          x: 0,
          y: 0
        },
        {
          id: 'two',
          x: 100,
          y: 0
        },
        {
          id: 'three',
          x: 0,
          y: 100
        }
      ]
    }
  },
  methods: {
    onResizing (id, left, top, width, height) {
      console.log(id, left, top, width, height)
    }
  }
}

from vue-draggable-resizable.

ScorpioX avatar ScorpioX commented on August 30, 2024

@mauricius I've made a quick and dirty hack of your original version here which uses a cfg object to simplify props and params exchange without events. It's for an PowerPoint like editor which shall support dozens of objects with lots defaults (parent, resizable, e.g.) pre-set.

Anyway, thanks a lot for your brilliant work without which our project would not be possible. Drop me a note anytime in case you need further details on my project 8>

from vue-draggable-resizable.

mauricius avatar mauricius commented on August 30, 2024

Anyway, thanks a lot for your brilliant work without which our project would not be possible. Drop me a note anytime in case you need further details on my project 8>

Sure! I would love to see where the component is used. Feel free to ping me when you have something available. Thanks!

from vue-draggable-resizable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.