Skip to content

Commit e2a5941

Browse files
committed
Fix broken toolbar and zoom button in 0.11.8
1 parent 7c85b8a commit e2a5941

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

assets/js/main.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -720,14 +720,14 @@ function createPaperScript(element) {
720720
}).on({
721721
mousedown: function(event) {
722722
if (event.modifiers.space) {
723-
lastPoint = paper.view.projectToView(event.point);
723+
lastPoint = scope.view.projectToView(event.point);
724724
return;
725725
}
726726
var factor = 1.25;
727727
if (event.modifiers.alt)
728728
factor = 1 / factor;
729-
paper.view.zoom *= factor;
730-
paper.view.center = event.point;
729+
scope.view.zoom *= factor;
730+
scope.view.center = event.point;
731731
},
732732
keydown: function(event) {
733733
if (event.key === 'alt') {
@@ -750,9 +750,9 @@ function createPaperScript(element) {
750750
// dragging, we need to convert coordinates to view space,
751751
// and then back to project space after the view space has
752752
// changed.
753-
var point = paper.view.projectToView(event.point),
754-
last = paper.view.viewToProject(lastPoint);
755-
paper.view.scrollBy(last.subtract(event.point));
753+
var point = scope.view.projectToView(event.point),
754+
last = scope.view.viewToProject(lastPoint);
755+
scope.view.scrollBy(last.subtract(event.point));
756756
lastPoint = point;
757757
}
758758
},
@@ -771,10 +771,11 @@ function createPaperScript(element) {
771771
function setupTools() {
772772
var activeClass = ($('.tool.active', toolsContainer).attr('class') || '')
773773
.replace(/\b(button|tool|active)\b/g, '').trim(),
774+
tools = scope.tools,
774775
// Activate first tool by default, so it gets highlighted too
775-
activeTool = paper.tools[0];
776+
activeTool = tools[0];
776777
$('.tool', toolsContainer).remove();
777-
for (var i = paper.tools.length - 1; i >= 0; i--) {
778+
for (var i = tools.length - 1; i >= 0; i--) {
778779
// Use an iteration closure so we have private variables.
779780
(function(tool) {
780781
var title = tool.buttonTitle || '',
@@ -799,7 +800,7 @@ function createPaperScript(element) {
799800
activeTool = tool;
800801
activeClass = null;
801802
}
802-
})(paper.tools[i]);
803+
})(tools[i]);
803804
}
804805
if (activeTool)
805806
activeTool.activate();
@@ -869,7 +870,7 @@ function createPaperScript(element) {
869870
});
870871

871872
$('.button.canvas-clear', element).click(function() {
872-
if (!paper.project.isEmpty() && confirm(
873+
if (!scope.project.isEmpty() && confirm(
873874
'This clears the whole canvas.\nAre you sure to proceed?')) {
874875
scope.project.clear();
875876
new Layer();

0 commit comments

Comments
 (0)