diff --git a/.gitignore b/.gitignore index e69de29..6cae44f 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/.vs/ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d85088f --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +DO NOT USE THIS CODE OR LOOK AT IT IF YOU ARE NOT ALLOWED TO +IF YOU DO YOU CAN USE OR TEACH THE KNOWLEAGE YOU ACQUEIRED. diff --git a/README.md b/README.md new file mode 100644 index 0000000..5f624a3 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Skamcraft + +## Start +* Start with live server in VsCode to get full functionnality. +* Start with php : +``` bash + cd /.../Skamcraft + php -S 127.0.0.1:80 +``` + +## Norm +* ``` ; ``` at the end of each line. +* snack_case for functions and variables. +* UpperCamelCase for Classes. +* all in english. diff --git a/img/procurement.png b/assets/contracts/procurement.png similarity index 100% rename from img/procurement.png rename to assets/contracts/procurement.png diff --git a/img/shuttle.png b/assets/contracts/shuttle.png similarity index 100% rename from img/shuttle.png rename to assets/contracts/shuttle.png diff --git a/img/transportation.png b/assets/contracts/transportation.png similarity index 100% rename from img/transportation.png rename to assets/contracts/transportation.png diff --git a/fonts/m42.TTF b/assets/fonts/m42.TTF similarity index 100% rename from fonts/m42.TTF rename to assets/fonts/m42.TTF diff --git a/assets/img/background.jpg b/assets/img/background.jpg new file mode 100644 index 0000000..5d0683d Binary files /dev/null and b/assets/img/background.jpg differ diff --git a/assets/logo/Offre.png b/assets/logo/Offre.png new file mode 100644 index 0000000..70230f5 Binary files /dev/null and b/assets/logo/Offre.png differ diff --git a/img/Skamkraft.png b/assets/logo/logoblanc.png similarity index 100% rename from img/Skamkraft.png rename to assets/logo/logoblanc.png diff --git a/assets/logo/logoblancnotext.png b/assets/logo/logoblancnotext.png new file mode 100644 index 0000000..a48c638 Binary files /dev/null and b/assets/logo/logoblancnotext.png differ diff --git a/assets/logo/logonoir.png b/assets/logo/logonoir.png new file mode 100644 index 0000000..7d4783c Binary files /dev/null and b/assets/logo/logonoir.png differ diff --git a/assets/planets/planetproto.png b/assets/planets/planetproto.png new file mode 100644 index 0000000..3d500b4 Binary files /dev/null and b/assets/planets/planetproto.png differ diff --git a/assets/ressources/ANTIMATTER.png b/assets/ressources/ANTIMATTER.png new file mode 100644 index 0000000..bd8dffe Binary files /dev/null and b/assets/ressources/ANTIMATTER.png differ diff --git a/assets/ressources/medkit.png b/assets/ressources/medkit.png new file mode 100644 index 0000000..4491d9b Binary files /dev/null and b/assets/ressources/medkit.png differ diff --git a/assets/spaceships/spaceship.png b/assets/spaceships/spaceship.png new file mode 100644 index 0000000..acc67df Binary files /dev/null and b/assets/spaceships/spaceship.png differ diff --git a/assets/spaceships/spaceshiporbits.png b/assets/spaceships/spaceshiporbits.png new file mode 100644 index 0000000..344a342 Binary files /dev/null and b/assets/spaceships/spaceshiporbits.png differ diff --git a/assets/systems/galaxie1.png b/assets/systems/galaxie1.png new file mode 100644 index 0000000..e40e2b2 Binary files /dev/null and b/assets/systems/galaxie1.png differ diff --git a/css/animation.css b/css/animation.css new file mode 100644 index 0000000..3207215 --- /dev/null +++ b/css/animation.css @@ -0,0 +1,15 @@ +/* Copyright © 2023 Entreprise SkamKraft */ + + +.ext-modal[open] { + animation: myFadeIn 2.0s ease normal; +} + +@keyframes myFadeIn{ + from { + bottom: 100%; + } + to { + bottom: 0%; + } +} \ No newline at end of file diff --git a/css/auth.css b/css/auth.css deleted file mode 100644 index 5bb0acb..0000000 --- a/css/auth.css +++ /dev/null @@ -1,165 +0,0 @@ -/* Copyright © 2023 Entreprise SkamCraft */ - -/* @font-face { - font-family: M42; - src: url(/fonts/m42.TTF); -} */ - -* { - font-family: "Montserrat", sans-serif; - font-size: 16px; - color: #ffffff; - margin: 0; - padding: 0; - text-decoration: none; - list-style: none; -} - -body { - background-color: #212121; -} - -.logo { - display: flex; - justify-content: center; - align-items: center; -} - -.logo img { - width: 80px; - padding: 20px; -} - -.logo h4 { - font-size: 30px; -} - -.form { - --input-focus: #a37b03; - --font-color: #323232; - --font-color-sub: #666666; - --bg-color: beige; - --main-color: black; - padding: 20px; - background: #eab308; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - text-align: center; - gap: 20px; - border-radius: 20px; - border: 2px solid var(--main-color); - box-shadow: 4px 4px var(--main-color); - width: 20%; - margin: auto; - margin-top: 10%; -} - -.title { - color: var(--font-color); - font-weight: 900; - font-size: 20px; -} - -.title span { - color: var(--font-color-sub); - font-weight: 600; - font-size: 17px; -} - -.input { - width: 250px; - height: 40px; - border-radius: 5px; - border: 2px solid var(--main-color); - background-color: var(--bg-color); - box-shadow: 4px 4px var(--main-color); - font-size: 15px; - font-weight: 600; - color: var(--font-color); - padding: 5px 10px; - outline: none; -} - -.input::placeholder { - color: var(--font-color-sub); - opacity: 0.8; -} - -.input:focus { - border: 2px solid var(--input-focus); -} - -.select * { - color: var(--main-color); -} - -.button-confirm { - width: 120px; - height: 40px; - border-radius: 5px; - border: 2px solid var(--main-color); - background-color: var(--bg-color); - box-shadow: 4px 4px var(--main-color); - font-size: 17px; - font-weight: 600; - color: var(--font-color); - cursor: pointer; -} - -.button-confirm:active { - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); -} - -.link-connection { - position: relative; - display: inline-block; -} - -.link-connection:hover { - cursor: pointer; - text-underline-offset: 2px; - text-decoration: underline; - transform: scale(1.1); - transition: 0.3s; -} - -.alert { - position: fixed; - left: 50%; - transform: translateX(-50%); - bottom: 10%; - border-radius: 0.5rem; - border-width: 0.25rem; - border-color: #ef4444; - background-color: #fee2e2; - padding: 1rem; - width: 300px; - max-width: 90%; - text-align: center; -} - -.alert-inner { - display: flex; - align-items: center; - gap: 0.5rem; - color: #ef4444; -} - -.icon { - height: 1.25rem; - width: 1.25rem; - fill: #d94848; -} - -.message { - color: #d94848; - font-weight: 500; -} - -.content { - margin-top: 0.5rem; - font-size: 0.875rem; - color: #d94848; -} diff --git a/css/global.css b/css/global.css deleted file mode 100644 index 5296ef1..0000000 --- a/css/global.css +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright © 2023 Entreprise SkamCraft */ - -* { - font-family: "Inter", sans-serif; - box-sizing: border-box; - overflow: hidden; - background-color: #272727; -} - -body, -html { - height: 100%; - display: flex; - flex-direction: column; -} - -/* Menu */ -.menu { - display: flex; - align-items: center; - justify-content: space-between; -} - -.title-section { - color: white; - display: flex; - align-items: center; - padding-left: 10px; -} - -.title-section img { - max-width: 80px; - max-height: 50px; -} - -.page-change-button { - padding-left: 10px; -} - -button { - margin: 2px; - color: black; - background-color: white; - border: 2px solid white; - border-radius: 10px; -} - -button:hover { - border-color: #eab308; - background-color: #eab308; - transition: all 1s; -} - -main { - flex: 1; -} - -#credits { - background-color: white; - border: 2px solid white; - border-radius: 10px; - color: black; -} - -/* Footer */ -footer { - color: white; -} - -footer p { - display: flex; - justify-content: center; - margin-bottom: 0px; -} - -/* Modal */ -.modal-content { - color: white; -} - -#exampleModal { - color: white; - background-color: rgba(255, 255, 255, 0.1) -} - -#modal-footer { - background-color: #272727; -} - -#status { - color: orange; -} - -#revenu { - color: white -} \ No newline at end of file diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..1503b8f --- /dev/null +++ b/css/style.css @@ -0,0 +1,195 @@ +/* Copyright © 2023 Entreprise SkamKraft */ + +:root { + --main-back-color: rgb(143, 143, 143); + --second-back-color: black; +} + +@font-face { + font-family: M42; + src: url("/assets/fonts/m42.TTF"); +} + +* { + box-sizing: border-box; +} + +body { + background-image: url("/assets/img/background.jpg"); + font-family: 'M42'; + font-size: 7px; + margin: 0px; + padding: 0px; +} + +/* Main */ +.container { + color: white; + background-color: rgba(0, 0, 0, 0.726); + display: flex; + margin: 10px; + width: fit-content; + margin: auto; + margin-top: 10px; margin-bottom: 30px; + flex-direction: column; + align-items: center; + border: 4px solid rgba(68, 68, 68, 0.575); +} + +.max-container { + background-color: rgba(0, 0, 0, 0.726); + color: white; + display: flex; + margin: 10px; + width: 95%; + margin: auto; + margin-top: 10px; margin-bottom: 30px; + flex-direction: column; + align-items: center; + border: 4px solid rgba(68, 68, 68, 0.575); +} + +.con-title { + font-size: 15px; + border-bottom: 2px solid black; +} + +.btn { + padding: 10px; + font-size: 8px; + font-family: 'M42'; + color: white; + border: none; + border-radius: 10px; +} + +.btn-val { + background-color: rgba(0, 0, 255, 0.637); +} + +.btn-cancel { + background-color: rgba(255, 0, 0, 0.699); +} + +/*footer*/ +footer { + position: fixed; + width: 100%; + bottom: 0; + display: flex; + justify-content: center; + background-color: var(--second-back-color); + color: white; +} + +/*nav bar*/ +.nav-nav { + --nav-img-width: 100px; + background-color: var(--second-back-color); + display: flex; + justify-content: space-between; + align-items: center; +} + +.nav-nav .nav-brand { + display: flex; + justify-content: center; + align-items: center; +} + +.nav-nav .nav-brand img { + width: var(--nav-img-width); +} + +.nav-nav .nav-links { + --links-color: rgb(0,0,0); + --links-backcolor: rgb(255, 123, 71); + --links-border-color: rgb(255, 173, 118); + height: 70%; + display: flex; + justify-content: space-between; +} + +.nav-link { + margin-right: 10px; + background-color: var(--links-backcolor); + color: var(--links-color); + border: 4px solid var(--links-border-color); + list-style: none; + display: flex; + justify-content: center; + align-items: center; + box-shadow: 3px 2px white; +} + +.stats { + color: white; +} + +/* General */ +.smooth { + padding: 5px; + padding-left: 10px; + padding-right: 10px; + border-radius: 5px; +} + +.in-big { + font-family: 'M42'; + font-size: 6px; + padding: 5px; + width: 100%; + margin-bottom: 10px; + border-radius: 5px; + border: none; +} + +.errors p { + background-color: rgba(255, 56, 56, 0.733); + border: 3px solid rgb(255, 111, 111); + padding: 10px; + color: white; + border-radius: 5px; + text-align: center; +} + +/* Modal */ +.ext-modal { + background-color: rgba(255, 255, 255, 0.767); + border-radius: 10px; + padding: 50px; +} + +.my-modal { + display: flex; + flex-direction: column; + align-items: center; +} + +.modal-title { + font-size: 15px; + margin-bottom: 40px; +} + +.show-token { + width: fit-content; + border: 2px solid black; + border-radius: 10px; + padding: 30px; + font-size: 5px; + white-space:pre-wrap; + word-break:break-word; +} + +.my-modal #timer { + text-align: center; + border: 1px solid black; + border-radius: 10px; + width: 10%; + padding: 5px; + margin-bottom: 10px; +} + +#canvas { + border-radius: 10px; +} \ No newline at end of file diff --git a/css/ui.css b/css/ui.css new file mode 100644 index 0000000..085f1e5 --- /dev/null +++ b/css/ui.css @@ -0,0 +1,11 @@ +/* Copyright © 2023 Entreprise SkamKraft */ + +#block-content { + margin: 0; + padding: 0; +} + +.modal-disable::backdrop { + background-color: rgba(0, 0, 0, 0.493); +} + diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..b78bc3c Binary files /dev/null and b/favicon.ico differ diff --git a/html/template.html b/html/template.html new file mode 100644 index 0000000..9821bca --- /dev/null +++ b/html/template.html @@ -0,0 +1,16 @@ + + + + diff --git a/html/templates/auth/login.html b/html/templates/auth/login.html new file mode 100644 index 0000000..81974a4 --- /dev/null +++ b/html/templates/auth/login.html @@ -0,0 +1,11 @@ + + +
Login
+ +Login success
+New Agent
+ + +Login success
+ +Bienvenue sur SkamCraft
+Application client pour l'API Space Tarders.
+Systems
+ +${err}
+ `); + }); + }); + + auth.relog(); +} \ No newline at end of file diff --git a/js/controllers/menu_mod.js b/js/controllers/menu_mod.js new file mode 100644 index 0000000..6287759 --- /dev/null +++ b/js/controllers/menu_mod.js @@ -0,0 +1,45 @@ +import { My } from "../skama_code/api/agent.js"; +import login from "./login.js"; +import reg from "./reg.js"; +import home from "./home.js"; +import { systems } from "./systems.js"; + +function init_menu(temp_engine) { + temp_engine.add_event("#reg-link", "click", () => { + reg(temp_engine); + }); + temp_engine.add_event("#login-link", "click", () => { + login(temp_engine); + }); + temp_engine.add_event("#systems-link", "click", () => { + systems(temp_engine); + }) + temp_engine.add_event(".nav-brand", "click", () => { + home(temp_engine); + }); +} + +function loged_links() { + $(".nav-links").prepend(` +Agent name : ${My.agent.name}
+Credits : ${My.agent.credits}
+Ships : ${My.agent.ships_cpt}
+Faction : ${My.agent.faction}
+HQ : ${My.agent.hq}
+ `); +} + +export default function menu_mod(temp_engine) { + init_menu(temp_engine); + if(My.agent) { + show_stats(); + loged_links(); + } +} \ No newline at end of file diff --git a/js/controllers/reg.js b/js/controllers/reg.js new file mode 100644 index 0000000..a8b8425 --- /dev/null +++ b/js/controllers/reg.js @@ -0,0 +1,64 @@ +import { Modal } from "../skama_code/ui/modal.js"; +import { Auth } from "../skama_code/auth/auth.js"; +import { My } from "../skama_code/api/agent.js"; +import home from "./home.js"; +import menu_mod from "./menu_mod.js"; + +export default function reg(temp_engine) { + let active = false; + let auth = new Auth(true); + let modal = new Modal("reg-modal", temp_engine); + + function render_reg() { + temp_engine.render(`templates/auth/reg.html`); + modal.load("templates/auth/reg_modal.html") + } + + modal.add_class("ext-modal"); + temp_engine.after_render(menu_mod); + + render_reg(); + + temp_engine.add_event("#ok", "click", () => { + home(temp_engine); + }); + + temp_engine.add_event("#forget_reg", "click", () => { + My.agent = null; + auth.unload_token(); + modal.close(); + render_reg(); + }); + + temp_engine.add_event("#val", "click", () => { + if (!active) { + active = true; + let name = $("#in-name").val(); + let faction = $("#in-faction").val(); + auth.register({ + name: name, + faction: faction + }); + } + }); + + temp_engine.add_event("#cancel", "click", () => { + $("#in-name").val(""); + $("#in-faction").val(""); + }); + + auth.done((agent) => { + $(".show-token").text(agent.token); + modal.show(); + My.agent = agent; + active = false; + }).fail((errs) => { + $(".errors").html(""); + errs.forEach(err => { + $(".errors").append(` +${err}
+ `); + }); + active = false; + }); +} \ No newline at end of file diff --git a/js/controllers/system.js b/js/controllers/system.js new file mode 100644 index 0000000..915227f --- /dev/null +++ b/js/controllers/system.js @@ -0,0 +1,100 @@ +import { SystemBuilder } from "../skama_code/api/system.js"; +import { Position } from "../skama_code/commun/position.js"; +import menu_mod from "./menu_mod.js" + +let canvas; +let last_target; + +let offset = { + x: 2, + y: 2 +}; +let max = 100; +let w = (window.innerWidth/10)*9; +let h = (window.innerHeight/4)*3; + +function animate() { + canvas.renderAll(); + setTimeout(animate, 1000); +} + +function draw_planet(planet) { + let shadow = new fabric.Shadow({ + color: "white", + blur: 5, + offsetX: 0, + offsetY: 0, + }); + + fabric.Image.fromURL('/assets/planets/planetproto.png', function(img_planet) { + //FABRICJS + img_planet.set({ + selectable: false, + shadow: shadow, + left: planet.position.x/offset.x + w/2, + top: planet.position.y/offset.y+ h/2, + name: planet.name, + type: planet.type + }); + canvas.add(img_planet); + }); +} + +function offsetOrbit(planet) { + if (planet.orbits) { + console.log("Orbits"); + let x = Math.floor(Math.random() * max - Math.random() * max); + let y = Math.floor(Math.random() * max - Math.random() * max); + planet.position.move(new Position(x, y)); + } +} + +export default function system(system, temp_engine) { + temp_engine.after_render((temp_engine) => { + $("#sys-name").text(system); + menu_mod(temp_engine); + canvas = new fabric.Canvas("canvas",{ + width: w, + height: h, + backgroundColor:"rgb(7, 18, 41)", + renderOnAddRemove: false, + hoverCursor :'pointer' + }); + SystemBuilder.get(system, (system) => { + system.list_all((planets) => { + planets.forEach(planet => { + offsetOrbit(planet); + draw_planet(planet); + }); + animate(); + }, (err) => { + console.log(err); + }); + }); + canvas.on('mouse:up', (e) => { + if(e.target.shadow.color == "red"){ + e.target.shadow.color = "white" + } + else{ + e.target.shadow.color = "red" + } + if (last_target) last_target.shadow.color = "white"; + last_target = e.target; + canvas.renderAll(); + }); + $(window).on("resize", () => { + canvas.setWidth((window.innerWidth/10)*9); + canvas.setHeight((window.innerHeight/4)*3); + canvas.renderAll(); + }); + canvas.on("mouse:wheel", (opt) => { + let scale = 1.1; + if (opt.e.deltaY < 0) { + canvas.zoomToPoint(new fabric.Point(canvas.width / 2, canvas.height / 2), canvas.getZoom() * scale); + } else if (opt.e.deltaY > 0) { + canvas.zoomToPoint(new fabric.Point(canvas.width / 2, canvas.height / 2), canvas.getZoom() / scale); + } + }); + }); + temp_engine.render("templates/systems/system.html"); +} \ No newline at end of file diff --git a/js/controllers/systems.js b/js/controllers/systems.js new file mode 100644 index 0000000..10e050f --- /dev/null +++ b/js/controllers/systems.js @@ -0,0 +1,80 @@ +import { SystemBuilder } from "../skama_code/api/system.js"; +import menu_mod from "./menu_mod.js" +import system from "./system.js" + +let canvas; +let last_target; + +let offset = { + x: 2, + y: 2 +}; +let max = 100; +let w = (window.innerWidth/10)*9; +let h = (window.innerHeight/4)*3; + +function animate() { + canvas.renderAll(); + setTimeout(animate, 1000); +} + +function draw_system(system) { + let shadow = new fabric.Shadow({ + color: "white", + blur: 5, + offsetX: 0, + offsetY: 0, + }); + + fabric.Image.fromURL('/assets/systems/galaxie1.png', function(img_planet) { + + img_planet.set({ + selectable: false, + scaleX: 0.05, + scaleY: 0.05, + shadow: shadow, + left: system.position.x/offset.x + w/2, + top: system.position.y/offset.y+ h/2, + name: system.name, + type: system.type + }); + canvas.add(img_planet); + }); +} + +export function systems(temp_engine) { + temp_engine.after_render((temp_engine) => { + menu_mod(temp_engine); + canvas = new fabric.Canvas("canvas",{ + width: w, + height: h, + backgroundColor:"rgb(7, 18, 41)", + renderOnAddRemove: false, + hoverCursor :'pointer' + }); + SystemBuilder.list_all((systems) => { + systems.forEach(system => { + draw_system(system); + }); + animate(); + }); + canvas.on('mouse:up', (e) => { + if (e.target) system(e.target.name, temp_engine); + }); + $(window).on("resize", () => { + canvas.setWidth((window.innerWidth/10)*9); + canvas.setHeight((window.innerHeight/4)*3); + canvas.renderAll(); + }); + canvas.on("mouse:wheel", (opt) => { + console.log(opt.e.clientX); + let scale = 1.1; + if (opt.e.deltaY < 0) { + canvas.zoomToPoint(new fabric.Point(opt.e.clientX / canvas.getZoom(), opt.e.clienY / canvas.getZoom()), canvas.getZoom() * scale); + } else if (opt.e.deltaY > 0) { + canvas.zoomToPoint(new fabric.Point(canvas.width / 2, canvas.height / 2), canvas.getZoom() / scale); + } + }); + }); + temp_engine.render("templates/systems/systems.html"); +} \ No newline at end of file diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..886d57b --- /dev/null +++ b/js/index.js @@ -0,0 +1,9 @@ +// Copyright © 2023 Entreprise SkamKraft +'use strict'; +import { TemplateEngine } from "./skama_code/ui/templeting_engine.js"; +import home from "./controllers/home.js"; + +let temp_engine = new TemplateEngine("html"); +home(temp_engine); + + diff --git a/js/lib/fabric.js b/js/lib/fabric.js new file mode 100644 index 0000000..f679aff --- /dev/null +++ b/js/lib/fabric.js @@ -0,0 +1 @@ +var fabric=fabric||{version:"5.3.0"};if("undefined"!=typeof exports?exports.fabric=fabric:"function"==typeof define&&define.amd&&define([],function(){return fabric}),"undefined"!=typeof document&&"undefined"!=typeof window)document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?fabric.document=document:fabric.document=document.implementation.createHTMLDocument(""),fabric.window=window;else{var jsdom=require("jsdom"),virtualWindow=new jsdom.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;fabric.document=virtualWindow.document,fabric.jsdomImplForWrapper=require("jsdom/lib/jsdom/living/generated/utils").implForWrapper,fabric.nodeCanvas=require("jsdom/lib/jsdom/utils").Canvas,fabric.window=virtualWindow,DOMParser=fabric.window.DOMParser}function resizeCanvasIfNeeded(t){var e=t.targetCanvas,i=e.width,r=e.height,n=t.destinationWidth,s=t.destinationHeight;i===n&&r===s||(e.width=n,e.height=s)}function copyGLTo2DDrawImage(t,e){var i=t.canvas,r=e.targetCanvas,n=r.getContext("2d");n.translate(0,r.height),n.scale(1,-1);var s=i.height-r.height;n.drawImage(i,0,s,r.width,r.height,0,0,r.width,r.height)}function copyGLTo2DPutImageData(t,e){var i=e.targetCanvas.getContext("2d"),r=e.destinationWidth,n=e.destinationHeight,s=r*n*4,o=new Uint8Array(this.imageBuffer,0,s),a=new Uint8ClampedArray(this.imageBuffer,0,s);t.readPixels(0,0,r,n,t.RGBA,t.UNSIGNED_BYTE,o);var c=new ImageData(a,r,n);i.putImageData(c,0,0)}fabric.isTouchSupported="ontouchstart"in fabric.window||"ontouchstart"in fabric.document||fabric.window&&fabric.window.navigator&&0