Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 2.0 KiB |
@ -1,25 +0,0 @@ |
||||
<!DOCTYPE html> |
||||
<html lang="zh-CN"> |
||||
|
||||
<head> |
||||
<meta charset="UTF-8" /> |
||||
<script> |
||||
var __UniViewStartTime__ = Date.now(); |
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || |
||||
CSS.supports('top: constant(a)')) |
||||
document.write( |
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + |
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />') |
||||
</script> |
||||
<title>View</title> |
||||
<link rel="stylesheet" href="view.css" /> |
||||
</head> |
||||
|
||||
<body> |
||||
<div id="app"></div> |
||||
<script src="__uniappes6.js"></script> |
||||
<script src="view.umd.min.js"></script> |
||||
<script src="app-view.js"></script> |
||||
</body> |
||||
|
||||
</html> |
@ -1,154 +0,0 @@ |
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // install a JSONP callback for chunk loading
|
||||
/******/ function webpackJsonpCallback(data) { |
||||
/******/ var chunkIds = data[0]; |
||||
/******/ var moreModules = data[1]; |
||||
/******/ var executeModules = data[2]; |
||||
/******/ |
||||
/******/ // add "moreModules" to the modules object,
|
||||
/******/ // then flag all "chunkIds" as loaded and fire callback
|
||||
/******/ var moduleId, chunkId, i = 0, resolves = []; |
||||
/******/ for(;i < chunkIds.length; i++) { |
||||
/******/ chunkId = chunkIds[i]; |
||||
/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) { |
||||
/******/ resolves.push(installedChunks[chunkId][0]); |
||||
/******/ } |
||||
/******/ installedChunks[chunkId] = 0; |
||||
/******/ } |
||||
/******/ for(moduleId in moreModules) { |
||||
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { |
||||
/******/ modules[moduleId] = moreModules[moduleId]; |
||||
/******/ } |
||||
/******/ } |
||||
/******/ if(parentJsonpFunction) parentJsonpFunction(data); |
||||
/******/ |
||||
/******/ while(resolves.length) { |
||||
/******/ resolves.shift()(); |
||||
/******/ } |
||||
/******/ |
||||
/******/ // add entry modules from loaded chunk to deferred list
|
||||
/******/ deferredModules.push.apply(deferredModules, executeModules || []); |
||||
/******/ |
||||
/******/ // run deferred modules when all chunks ready
|
||||
/******/ return checkDeferredModules(); |
||||
/******/ }; |
||||
/******/ function checkDeferredModules() { |
||||
/******/ var result; |
||||
/******/ for(var i = 0; i < deferredModules.length; i++) { |
||||
/******/ var deferredModule = deferredModules[i]; |
||||
/******/ var fulfilled = true; |
||||
/******/ for(var j = 1; j < deferredModule.length; j++) { |
||||
/******/ var depId = deferredModule[j]; |
||||
/******/ if(installedChunks[depId] !== 0) fulfilled = false; |
||||
/******/ } |
||||
/******/ if(fulfilled) { |
||||
/******/ deferredModules.splice(i--, 1); |
||||
/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); |
||||
/******/ } |
||||
/******/ } |
||||
/******/ |
||||
/******/ return result; |
||||
/******/ } |
||||
/******/ |
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {}; |
||||
/******/ |
||||
/******/ // object to store loaded and loading chunks
|
||||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
||||
/******/ // Promise = chunk loading, 0 = chunk loaded
|
||||
/******/ var installedChunks = { |
||||
/******/ "app-config": 0 |
||||
/******/ }; |
||||
/******/ |
||||
/******/ var deferredModules = []; |
||||
/******/ |
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) { |
||||
/******/ |
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) { |
||||
/******/ return installedModules[moduleId].exports; |
||||
/******/ } |
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = { |
||||
/******/ i: moduleId, |
||||
/******/ l: false, |
||||
/******/ exports: {} |
||||
/******/ }; |
||||
/******/ |
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
||||
/******/ |
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true; |
||||
/******/ |
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports; |
||||
/******/ } |
||||
/******/ |
||||
/******/ |
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules; |
||||
/******/ |
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules; |
||||
/******/ |
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) { |
||||
/******/ if(!__webpack_require__.o(exports, name)) { |
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
||||
/******/ } |
||||
/******/ }; |
||||
/******/ |
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) { |
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
||||
/******/ } |
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
||||
/******/ }; |
||||
/******/ |
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) { |
||||
/******/ if(mode & 1) value = __webpack_require__(value); |
||||
/******/ if(mode & 8) return value; |
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
||||
/******/ var ns = Object.create(null); |
||||
/******/ __webpack_require__.r(ns); |
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
||||
/******/ return ns; |
||||
/******/ }; |
||||
/******/ |
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) { |
||||
/******/ var getter = module && module.__esModule ? |
||||
/******/ function getDefault() { return module['default']; } : |
||||
/******/ function getModuleExports() { return module; }; |
||||
/******/ __webpack_require__.d(getter, 'a', getter); |
||||
/******/ return getter; |
||||
/******/ }; |
||||
/******/ |
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
||||
/******/ |
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "/"; |
||||
/******/ |
||||
/******/ var jsonpArray = this["webpackJsonp"] = this["webpackJsonp"] || []; |
||||
/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); |
||||
/******/ jsonpArray.push = webpackJsonpCallback; |
||||
/******/ jsonpArray = jsonpArray.slice(); |
||||
/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); |
||||
/******/ var parentJsonpFunction = oldJsonpFunction; |
||||
/******/ |
||||
/******/ |
||||
/******/ // run deferred modules from other chunks
|
||||
/******/ checkDeferredModules(); |
||||
/******/ }) |
||||
/************************************************************************/ |
||||
/******/ ([]); |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 110 B |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.0 KiB |
@ -1,119 +0,0 @@ |
||||
<!DOCTYPE html> |
||||
<html lang="zh"> |
||||
|
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> |
||||
<title></title> |
||||
<style type="text/css"> |
||||
html, |
||||
body, |
||||
canvas { |
||||
padding: 0; |
||||
margin: 0; |
||||
width: 100%; |
||||
height: 100%; |
||||
overflow-y: hidden; |
||||
background-color: transparent; |
||||
} |
||||
</style> |
||||
</head> |
||||
|
||||
<body> |
||||
<canvas id="lime-painter"></canvas> |
||||
<script type="text/javascript" src="./uni.webview.1.5.3.js"></script> |
||||
<script type="text/javascript" src="./painter.js"></script> |
||||
<script> |
||||
var cache = []; |
||||
var painter = null; |
||||
var canvas = null; |
||||
var context = null; |
||||
var timer = null; |
||||
var pixelRatio = 1; |
||||
console.log = function (...args) { |
||||
postMessage(args); |
||||
}; |
||||
// function stringify(key, value) { |
||||
// if (typeof value === 'object' && value !== null) { |
||||
// if (cache.indexOf(value) !== -1) { |
||||
// return; |
||||
// } |
||||
// cache.push(value); |
||||
// } |
||||
// return value; |
||||
// }; |
||||
|
||||
function emit(event, data) { |
||||
postMessage({ |
||||
event, |
||||
data: (typeof data !== 'object' && data !== null ? data : JSON.stringify(data)) |
||||
}); |
||||
cache = []; |
||||
}; |
||||
function postMessage(data) { |
||||
uni.postMessage({ |
||||
data |
||||
}); |
||||
}; |
||||
|
||||
function init(dpr) { |
||||
canvas = document.querySelector('#lime-painter'); |
||||
context = canvas.getContext('2d'); |
||||
pixelRatio = dpr || window.devicePixelRatio; |
||||
painter = new Painter({ |
||||
id: 'lime-painter', |
||||
context, |
||||
canvas, |
||||
pixelRatio, |
||||
width: canvas.offsetWidth, |
||||
height: canvas.offsetHeight, |
||||
listen: { |
||||
onProgress(v) { |
||||
emit('progressChange', v); |
||||
}, |
||||
onEffectFail(err) { |
||||
//console.error(err) |
||||
emit('fail', err); |
||||
} |
||||
} |
||||
}); |
||||
emit('inited', true); |
||||
}; |
||||
function save(args) { |
||||
delete args.success; |
||||
delete args.fail; |
||||
clearTimeout(timer); |
||||
timer = setTimeout(() => { |
||||
const path = painter.save(args); |
||||
if (typeof path == 'string') { |
||||
const index = Math.ceil(path.length / 8); |
||||
for (var i = 0; i < 8; i++) { |
||||
if (i == 7) { |
||||
emit('success', path.substr(i * index, index)); |
||||
} else { |
||||
emit('file', path.substr(i * index, index)); |
||||
} |
||||
}; |
||||
} else { |
||||
// console.log('canvas no data') |
||||
emit('fail', 'canvas no data'); |
||||
}; |
||||
}, 30); |
||||
}; |
||||
async function source(args) { |
||||
let size = await painter.source(args); |
||||
emit('layoutChange', size); |
||||
if(!canvas.height) { |
||||
console.log('canvas no size') |
||||
emit('fail', 'canvas no size'); |
||||
} |
||||
painter.render().catch(err => { |
||||
// console.error(err) |
||||
emit('fail', err); |
||||
}); |
||||
}; |
||||
</script> |
||||
</body> |
||||
|
||||
</html> |