Skip to content

Update index.html #10

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion dist/patternlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
var dots = svg.find('.lock-dots circle');
var lines = svg.find('.lock-lines');
var actives = svg.find('.lock-actives');
var code_display = svg.find('.code_display');
var pt = root.createSVGPoint();
var code = [];
var code_numbers = [];
var currentline = void 0;
var currenthandler = void 0;

Expand Down Expand Up @@ -109,6 +111,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
svg.removeClass('success error');
lines.empty();
actives.empty();
code_display.innerHTML = '';
}

function preventDefault(e) {
Expand Down Expand Up @@ -182,6 +185,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
var cy = target.getAttribute('cy');
if (isAvailable(target) && !isUsed(target)) {
stopTrack(currentline, target);
updateTextForm(target);
currentline = beginTrack(target);
}
}
Expand All @@ -198,6 +202,15 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
line.setAttribute('y2', y);
}

function updateTextForm(target) {
var x = (target.getAttribute('cx') - 20) / 30; // 20 = 0, 50 = 1, 80 = 2
var y = (target.getAttribute('cy') - 20) / 30;

code_numbers.push(1+x+(y * 3)); // 1 = 1 + 0 + 0; 2 = 1 + 1 + 0; 3 = 1 + 2 + 0; 4 = 1 + 0 + 3; 5 = 1 + 1 + 3; 6 = 1 + 2 + 3; 7 = 1 + 0 + 6; 8 = 1 + 1 + 6; 9 = 1 + 2 + 6

text.
}

function beginTrack(target) {
code.push(target);
var x = target.getAttribute('cx');
Expand Down Expand Up @@ -257,4 +270,4 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
};

return PatternLock;
});
});
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ <h1>pattern-lock-js</h1>
<circle cx="50" cy="80" r="2"/>
<circle cx="80" cy="80" r="2"/>
</g>
<p class="code_display"></p>
<svg>
</div>

Expand All @@ -103,4 +104,4 @@ <h1>pattern-lock-js</h1>
</script>
</body>

</html>
</html>