Closed kaysaith1900 closed 4 years ago
Hi @kaysaith1900, thank you for the comment. Sorry, my English is poor. Do you mean that you want to move the element to specific position?
Hi @anseki
for example:
const myElement = document.getElementById('myElement') const draggable = new PlainDraggable(myElement)
/ this is my custom code / let startPoint = {} document.addEvenListener('mousedown', (event) => { startPoint.x = event.clientX startPoint.y = event.clientY })
document.addEvenListener('mousemove', (event) => { // resize to big in negative side myElement.width = startPoint.x - event.clientX myElement.left = startPoint.x - (startPoint.x - event.clientX) })
document.addEvenListener('mouseup', () => { removeEventListener() }) // now in the view
i drag myElement first , i fund
myElement.style.transfrom = 'translate(movedValue, movedValue)'
when i resize with my function it will cause my view in an wrong position ,and i can't clear this translate value.
You can use left
/ top
options instead.
Hi @anseki ,
i used 'left / top options' function ,i fund it won't be update in a strange value.
Could you show me your code by using e.g. https://jsfiddle.net/ ?
Hi @anseki ,
jsfidle is very slow here, https://kaysaith1900.github.io/ i put the demo in my github page, you can vist and check the code in chrome dev tool,
thank you agin !
Hi @anseki , It Worked!! thank you a lot . btw, can i have your email? and keep it touch . : )
Hello @anseki , I would still like to have your email
@kaysaith1900, I'm glad if I could help you. :smile: Of course we can contact each other via GitHub. So, could you close this issue if it was solved?
Hello @nSanhuezaKrino, thank you for your comment. Could you make new issue if you have it? This is @kaysaith1900's issue.
@nSanhuezaKrino Is there a function that changes a component's div or do you only handle the x and y?
@nSanhuezaKrino, Could you make new issue? This is @kaysaith1900's issue.
@anseki okay
FYI; You can use PlainDraggable for handles also. Then the code becomes simple. For example: https://jsfiddle.net/10y3tumk/
Hello anseki, i like this library very much, and thank you first.
this is my question, when i modified an element top and left value, after i dragged this element with plain-draggable, i fund the transfrom translate value won't be clear, It could cause drift issues when setting the top value.