Code Monkey home page Code Monkey logo

Comments (11)

ibrierley avatar ibrierley commented on June 15, 2024

If you look here, I did a plugin for it... http://svg.dabbles.info/snaptut-drag-limittransform

from snap.svg.

kevinG73 avatar kevinG73 commented on June 15, 2024

@ibrierley i tried to use this plugin but it doesn't work with my projet , the code I posted here is just a quick snapshot .
I don't know if there are other method without use viewbox

from snap.svg.

ibrierley avatar ibrierley commented on June 15, 2024

Can you clarify "doesnt work", do you get an error or something ? Can you post a jsfiddle ?

from snap.svg.

kevinG73 avatar kevinG73 commented on June 15, 2024

https://jsfiddle.net/f3gjw576/3/

@ibrierley i don't know why i can't move any where in the area of the viewbox , can you chekout ?

from snap.svg.

ibrierley avatar ibrierley commented on June 15, 2024

from snap.svg.

kevinG73 avatar kevinG73 commented on June 15, 2024

I do not understand what you mean ?
I can always drag and drop even on the code I sent you , it's just how to limit the drag and drop that i look for

from snap.svg.

ibrierley avatar ibrierley commented on June 15, 2024

The drag and drop on the original doesn't work correctly. If you drag it 100px, it only moves 50px (roughly).

from snap.svg.

ibrierley avatar ibrierley commented on June 15, 2024

Btw you can probably hack/fix it like the example, but you may find you have later issues with different setups, not sure. If you don't mind that, then you just need to add basic collision detection in your move handler.

from snap.svg.

kevinG73 avatar kevinG73 commented on June 15, 2024

I worked on it , but i have still the same issue
https://jsfiddle.net/ncL94f5v/3/

from snap.svg.

ibrierley avatar ibrierley commented on June 15, 2024

Sorry, I haven't had chance to look at this, and may not for a while currently. The transform stuff I did back in those days may be overcomplicated stuff, I'm really not sure without a bit of time to sit down and check if it really should work for this case actually...I note this old (potentially buggier if nested transforms are used) but simpler plugin version feels better possibly... http://svg.dabbles.info/snaptut-drag-limit it feels like it just needs bounding check offset minus the starting position or something.

Sorry I haven't had any real time to check, I like this stuff, it's possible I may get a bit more time in the future, but I can't guarantee anything atm.

from snap.svg.

kevinG73 avatar kevinG73 commented on June 15, 2024

thank you , it works now , problem solved . @ibrierley

from snap.svg.

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.