From e98c30cf110852d332fd7169a82b8756c475761f Mon Sep 17 00:00:00 2001 From: Teja Date: Mon, 9 Feb 2015 18:00:58 +0100 Subject: [PATCH] fixed state of add design buttons --- .../plugins/svgtogcode/static/js/working_area.js | 9 +++++++++ .../plugins/svgtogcode/templates/override_index.jinja2 | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/octoprint/plugins/svgtogcode/static/js/working_area.js b/src/octoprint/plugins/svgtogcode/static/js/working_area.js index 22fd5848..c5a585d8 100644 --- a/src/octoprint/plugins/svgtogcode/static/js/working_area.js +++ b/src/octoprint/plugins/svgtogcode/static/js/working_area.js @@ -140,6 +140,15 @@ $(function(){ self.mm2svgUnits = function(val){ return val * self.svgDPI()/25.4; }; + + self.isPlaced = function(file){ + if(file === undefined) return false; + + var filePlaced = ko.utils.arrayFirst(this.placedDesigns(), function(d) { + return d.name === file.name; + }); + return filePlaced; + }; self.placeGcode = function(file){ var previewId = self.getEntryId(file); diff --git a/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 b/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 index 8b557e00..f02eec9a 100644 --- a/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 +++ b/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 @@ -382,9 +382,9 @@
-
+ -
+
@@ -397,8 +397,8 @@
-
-
+ +