diff --git a/js/AddScanDialog.js b/js/AddScanDialog.js new file mode 100644 index 0000000..4e59ccf --- /dev/null +++ b/js/AddScanDialog.js @@ -0,0 +1,41 @@ +//var shapeResolution=3; +var shapePopup; + +function initScanDialog() { + scanPopup = new Popup($("#popupScan"), $("#popupMask")); + $("#btnScanOk").on("onButtonClick", onBtnScanOk); + $("#btnCloseScan").on("onButtonClick", onBtnCloseScan); +} + +function onBtnCloseScan() { + $('#imgGuide').hide(); + $('#btnCloseScan').hide(); +} + +function onBtnScanOk() { + scanPopup.commit(); +} + +function showScanDialog() { + scanPopup.open(); +} + +function readURL(input) { + + if (input.files && input.files[0]) { + var reader = new FileReader(); + + reader.onload = function (e) { + $('#imgGuide').attr('src', e.target.result); + $('#imgGuide').show(); + $('#btnCloseScan').show(); + scanPopup.commit(); + } + + reader.readAsDataURL(input.files[0]); + } +} + +$("#fileScan").change(function(){ + readURL(this); +}); diff --git a/js/Keyboard.js b/js/Keyboard.js index 825e514..a8c9e10 100644 --- a/js/Keyboard.js +++ b/js/Keyboard.js @@ -66,6 +66,7 @@ function initKeyboard() { case '|': resetTwist(); break; case 't': showWordArtDialog(); break; case 'i': showShapeDialog(); break; + case 'T': showScanDialog(); break; case ';': moveShape(-5,0); break; case '\'': moveShape(5,0); break; diff --git a/js/buttonbehaviors.js b/js/buttonbehaviors.js index 0d935a4..0f0238c 100644 --- a/js/buttonbehaviors.js +++ b/js/buttonbehaviors.js @@ -13,6 +13,7 @@ var btnSettings, btnWordArt; var btnToggleEdit, buttonGroupEdit, btnZoom, btnMove, btnRotate; var btnToggleVerticalShapes, btnHeight, btnTwist, btnShape, btnConv, btnStraight, btnSine, btnDiv; var buttonGroupAdd, popupWordArt; +var btnScan, popupScan; var state; var prevState; @@ -43,8 +44,10 @@ function initButtonBehavior() { buttonGroupAdd = $("#buttonGroupAdd"); btnShape = new Button("#btnShape"); btnWordArt = new Button("#btnWordArt"); + btnScan = new Button("#btnScan"); popupWordArt = $("#popupWordArt"); popupShape = $("#popupShape"); + popupScan = $("#popupScan"); popupMask = $("#popupMask"); logoPanel = $("#logopanel"); btnToggleEdit = new Button("#btnToggleEdit"); @@ -69,6 +72,7 @@ function initButtonBehavior() { btnAdd.on("onButtonClick", onBtnAdd); btnWordArt.on("onButtonClick", onBtnWordArt); btnShape.on("onButtonClick", onBtnShape); + btnScan.on("onButtonClick", onBtnScan); btnPrint.on("onButtonClick", print); btnStop.on("onButtonClick", stopPrint); btnSave.on("onButtonClick", saveSketch); @@ -191,6 +195,11 @@ function initButtonBehavior() { buttonGroupAdd.fadeOut(); } + function onBtnScan(e) { + showScanDialog(); + buttonGroupAdd.fadeOut(); + } + btnSettings.on("onButtonClick", openSettingsWindow); // 29-okt-2013 - we're not doing help for smartphones at the moment diff --git a/js/gcodeGenerating.js b/js/gcodeGenerating.js index 93f4cba..d01a4d3 100644 --- a/js/gcodeGenerating.js +++ b/js/gcodeGenerating.js @@ -218,6 +218,7 @@ function subsituteVariables(gcode) { case "makerbot_replicator2x": printerType = "r2x"; break; case "makerbot_thingomatic": printerType = "t6"; break; case "makerbot_generic": printerType = "r2"; break; + case "_3Dison_plus": printerType = "r2"; break; } var heatedBedReplacement = (heatedbed)? "" : ";"; diff --git a/js/main.js b/js/main.js index 8f8f9b1..1bed917 100644 --- a/js/main.js +++ b/js/main.js @@ -74,6 +74,7 @@ $(function() { // initVerticalShapes(); initWordArt(); initShapeDialog(); + initScanDialog(); disableDragging(); diff --git a/less/base_centerpanel.less b/less/base_centerpanel.less index 56cf46a..2131fee 100644 --- a/less/base_centerpanel.less +++ b/less/base_centerpanel.less @@ -127,4 +127,20 @@ } +#mycanvas { + position: absolute; +} +#imgGuide { + // z-index: -1000; + position: absolute; + // -webkit-filter: contrast(400%); + //-webkit-filter: brightness(100%); + // opacity: 50%; + opacity: 0.4; + filter: alpha(opacity=40); + pointer-events:none; + max-width: 100%; + max-height: 100%; + width: 100%; +} diff --git a/less/buttons.less b/less/buttons.less index 1c4f032..388186d 100644 --- a/less/buttons.less +++ b/less/buttons.less @@ -130,6 +130,16 @@ left: 4px; position: absolute; } + +#btnCloseScan { + top: 4px; + right: 8px; + position: absolute; + display: none; + opacity: 0.7; + filter: alpha(opacity=70); +} + #buttonGroupEdit { position: absolute; top: 5px; @@ -163,10 +173,10 @@ margin-top: -60%; margin-left: 70%; width: 200%; - max-width: 140px; /*fixme: can this grow based on it's content?*/ + max-width: 240px; /*fixme: can this grow based on it's content?*/ padding: 5% 0 5% 5%; - #btnWordArt, #btnShape { - width: 45%; + #btnWordArt, #btnShape, #btnScan { + width: 30%; } } diff --git a/less/popup.less b/less/popup.less index 93646b8..38700d0 100644 --- a/less/popup.less +++ b/less/popup.less @@ -47,6 +47,21 @@ } } +#popupScan { + width: 330px; + height:210px; + margin-left: -165px; + margin-top: -105px; + + input[type="file"] { + width: 98%; + } + #btnScanOk { + float: right; + margin: 15px 0 0 0; + } +} + #popupShape { width: 310px; margin-left: -155px; diff --git a/www/img/buttons/btnClose.png b/www/img/buttons/btnClose.png new file mode 100644 index 0000000..290ae3f Binary files /dev/null and b/www/img/buttons/btnClose.png differ diff --git a/www/img/buttons/btnGuide.png b/www/img/buttons/btnGuide.png new file mode 100644 index 0000000..c64ded2 Binary files /dev/null and b/www/img/buttons/btnGuide.png differ diff --git a/www/img/buttons/btnScan.png b/www/img/buttons/btnScan.png new file mode 100644 index 0000000..3ce983d Binary files /dev/null and b/www/img/buttons/btnScan.png differ diff --git a/www/index.html b/www/index.html index cab8fab..54a2400 100644 --- a/www/index.html +++ b/www/index.html @@ -40,6 +40,7 @@
+
@@ -75,10 +76,12 @@
-
+
+ +
@@ -125,6 +128,15 @@
+ +