s-yadav / patternLock

A light weight plugin to simulate android like pattern lock interface for your hybrid app or website.
MIT License
378 stars 141 forks source link

getpattern should return object or array #6

Closed devmondo closed 9 years ago

devmondo commented 9 years ago

hi, get pattern returns a string of concatenated items, this makes it impossible to get pattern sequence so for example if i have this custom mapped object Object {1: "g2eseuvgqnrbpgb9", 2: "fvfhvwn2eff4unmi", 3: "0nyolfdr5fry66r", 4: "s140yzaojsi9hpvi", 5: "ttzqe3nl95dn29", 6: "v0rdm725pie019k9", 7: "yz9aqdih4p1fw29", 8: "6oghs2o44hrggb9", 9: "hn85fnxflzcnxw29"}

i want to know the sequence user did to get those patterns.

i think join here is the problem for getpattern() https://github.com/s-yadav/patternLock/blob/master/patternLock.js#L299

and here for onDraw() https://github.com/s-yadav/patternLock/blob/master/patternLock.js#L182

if we get the ability to pass separator, or return the pure array without joining it would solve the problem :) thanks in advanced.

s-yadav commented 9 years ago

Added a delimiter option, which will be used to combine pattern sequence.

Usage example

var lock = new PatternLock('#container',{
          delimiter : "$"
});

// then lock.getPattern() will give something like 1$2$5$7
devmondo commented 9 years ago

awesome man , thank you very much :)