Selaa lähdekoodia

Finalized experimental Pain Module

tobychui 3 vuotta sitten
vanhempi
commit
42b305b1fc

+ 0 - 0
web/Office Viewer/img/desktop_icon.png → legacy/Office Viewer/img/desktop_icon.png


+ 0 - 0
web/Office Viewer/img/desktop_icon.psd → legacy/Office Viewer/img/desktop_icon.psd


+ 0 - 0
web/Office Viewer/img/icon.png → legacy/Office Viewer/img/icon.png


+ 0 - 0
web/Office Viewer/img/icon.psd → legacy/Office Viewer/img/icon.psd


+ 0 - 0
web/Office Viewer/index.html → legacy/Office Viewer/index.html


+ 0 - 0
web/Office Viewer/init.agi → legacy/Office Viewer/init.agi


+ 0 - 0
web/Office Viewer/viewer.html → legacy/Office Viewer/viewer.html


+ 83 - 12
web/Paint/index.html

@@ -4,22 +4,93 @@
     <meta charset="UTF-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <link rel="stylesheet" href="style.css">
     <script src="../script/jquery.min.js"></script>
     <script src="../script/ao_module.js"></script>
     <title>Paint</title>
 </head>
 <body>
-    <canvas id="canvas"></canvas>
-    <div class="nav">
-        <div class="clr" data-clr="#000"></div>
-        <div class="clr" data-clr="#EF626C"></div>
-        <div class="clr" data-clr="#fdec03"></div>
-        <div class="clr" data-clr="#24d102"></div>
-        <div class="clr" data-clr="#fff"></div>
-        <button class="clear">clear</button>
-        <button class="save">save</button>
-    </div>
-    <script src="main.js"></script>
+    <script src="./js/painterro-1.2.66.min.js"></script>
+    <script>
+    var saveFilename = "";
+    var saveFilepath = "";
+    var savePendingBlob = null;
+    //Initiate the Painterro Object
+    var painterroObject = Painterro({
+        onClose: function(){
+            ao_module_close();
+        },
+        saveHandler: function(drawing, callback){
+            //window.open(drawing.asDataURL());
+            var blob = drawing.asBlob();
+            if (saveFilepath == ""){
+                //Popup file save selector
+                savePendingBlob = blob;
+                ao_module_openFileSelector(fileSelected, "user:/Desktop", "new" ,false,{
+                    defaultName: "Untitled.png",
+                });
+                callback();
+            }else{
+                //Convert the image to file
+                var imageFile = ao_module_utils.blobToFile(blob, saveFilename);
+                //Write to source
+                ao_module_uploadFile(imageFile, saveFilepath, function(){
+                    callback();
+                });
+            }
+            console.log(drawing);
+            
+            
+        }
+    });
+
+    function fileSelected(filedata){
+        for (var i=0; i < filedata.length; i++){
+            var filename = filedata[i].filename;
+            var filepath = filedata[i].filepath;
+            //Save the temp blob to there
+            if (savePendingBlob != null){
+                //Extract filepath dirname
+                saveFilepath = filepath;
+                saveFilepath = saveFilepath.split("/");
+                saveFilepath.pop();
+                saveFilepath = saveFilepath.join("/");
+                saveFilename = filename;
+
+                //Convert the save pending blob to 
+                let imageFile = ao_module_utils.blobToFile(savePendingBlob, filename);
+                //Save to server
+                ao_module_uploadFile(imageFile, saveFilepath, function(){
+                    //Reset the savePendingFile
+                    savePendingBlob = null;
+                });
+
+              
+            }
+        }
+    }
+
+    //Check if there are any file loading from ao_module
+    var inputFiles = ao_module_loadInputFiles();
+    if (inputFiles == null){
+        //Nothing is loaded. Use blank canvas
+        painterroObject.show()
+    }else{
+        //Something is loaded. Use the first image to load
+        var openingFile = inputFiles[0];
+        var filename = openingFile.filename;
+        saveFilename = filename;
+
+        //Filter out the filepath to get its parent dir
+        var filepath = openingFile.filepath;
+        saveFilepath = filepath;
+        saveFilepath = saveFilepath.split("/");
+        saveFilepath.pop();
+        saveFilepath = saveFilepath.join("/");
+
+        painterroObject.show("../media?file=" + filepath);
+    }
+    
+    
+    </script>
 </body>
 </html>

+ 1 - 1
web/Paint/init.agi

@@ -14,7 +14,7 @@ var moduleLaunchInfo = {
 	SupportFW: true,
 	LaunchFWDir: "Paint/index.html",
 	SupportEmb: false,
-	InitFWSize: [640, 480]
+	InitFWSize: [870, 530]
 }
 
 //Register the module

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
web/Paint/js/painterro-1.2.66.min.js


+ 0 - 53
web/Paint/main.js

@@ -1,53 +0,0 @@
-let canvas = document.getElementById("canvas")
-canvas.height = window.innerHeight
-canvas.width = window.innerWidth
-let ctx = canvas.getContext("2d")
-ctx.lineWidth = 5
-
-let prevX = null
-let prevY = null
-
-let draw = false
-
-let clrs = document.querySelectorAll(".clr")
-clrs = Array.from(clrs)
-clrs.forEach(clr => {
-    clr.addEventListener("click", () => {
-        ctx.strokeStyle = clr.dataset.clr
-    })
-})
-
-let clearBtn = document.querySelector(".clear")
-clearBtn.addEventListener("click", () => {
-    ctx.clearRect(0, 0, canvas.width, canvas.height)
-})
-
-let saveBtn = document.querySelector(".save")
-saveBtn.addEventListener("click", () => {
-    let data = canvas.toDataURL("imag/png")
-    let a = document.createElement("a")
-    a.href = data
-    a.download = "sketch.png"
-    a.click()
-})
-
-window.addEventListener("mousedown", (e) => draw = true)
-window.addEventListener("mouseup", (e) => draw = false)
-
-window.addEventListener("mousemove", function(e){
-    if(prevX == null || prevY == null || !draw){
-        prevX = e.clientX
-        prevY = e.clientY
-        return
-    }
-
-    let mouseX = e.clientX
-    let mouseY = e.clientY
-    ctx.beginPath()
-    ctx.moveTo(prevX, prevY)
-    ctx.lineTo(mouseX, mouseY)
-    ctx.stroke()
-
-    prevX = e.clientX
-    prevY = e.clientY
-})

+ 0 - 65
web/Paint/style.css

@@ -1,65 +0,0 @@
-*{
-    margin: 0;
-    padding: 0;
-}
-
-body{
-    background-color: white;
-    overflow: hidden;
-}
-
-.nav{
-    width: 310px;
-    height: 50px;
-    position: fixed;
-    top: 0;
-    left: 50%;
-    transform: translateX(-50%);
-    display: flex;
-    align-items: center;
-    justify-content: space-around;
-    opacity: .3;
-    transition: opacity .5s;
-}
-.nav:hover{
-    opacity: 1;
-}
-
-.clr{
-    height: 30px;
-    width: 30px;
-    background-color: blue;
-    border-radius: 50%;
-    border: 3px solid rgb(214, 214, 214);
-    transition: transform .5s;
-}
-.clr:hover{
-    transform: scale(1.2);
-}
-.clr:nth-child(1){
-    background-color: #000;
-}
-.clr:nth-child(2){
-    background-color: #EF626C;
-}
-.clr:nth-child(3){
-    background-color: #fdec03;
-}
-.clr:nth-child(4){
-    background-color: #24d102;
-}
-.clr:nth-child(5){
-    background-color: #fff;
-}
-
-button{
-    border: none;
-    outline: none;
-    padding: .6em 1em;
-    border-radius: 3px;
-    background-color: #03bb56;
-    color: #fff;
-}
-.save{
-    background-color: #0f65d4;
-}

+ 21 - 0
web/SystemAO/info/license/Painterro.txt

@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2017 Ivan Borshchov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

+ 1 - 1
web/desktop.system

@@ -2669,7 +2669,7 @@
                 for (var i = 0; i < currentBackgroundList.length; i++) {
                     var id = "dbg" + i;
                     var thisImage = "img/desktop/bg/" + currentUserTheme + "/" + currentBackgroundList[i];
-                    $("#bgwrapper").append('<img id="' + id + '" rel="preload" draggable="false" style="background-image:url(\'' + thisImage + '\');" class="backgroundFrame"></img>');
+                    $("#bgwrapper").append('<img id="' + id + '" rel="preload" draggable="false" onclick="this.focus();" style="background-image:url(\'' + thisImage + '\');" class="backgroundFrame"></img>');
                 }
                 setTimeout(function() {
                     $("#dbg0").addClass("showBackground");

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä