mirror of
https://github.com/Karaka-Management/oms-Draw.git
synced 2026-01-27 05:18:40 +00:00
Make es6 adjustments
This commit is contained in:
parent
3a43f30c97
commit
23204c884c
|
|
@ -1,5 +1,7 @@
|
|||
(function (jsOMS) {
|
||||
"use strict";
|
||||
/** @namespace jsOMS.Modules */
|
||||
jsOMS.Autoloader.defineNamespace('jsOMS.Modules');
|
||||
|
||||
jsOMS.Modules.Draw = function (app) {
|
||||
this.app = app;
|
||||
|
|
@ -7,7 +9,7 @@
|
|||
};
|
||||
|
||||
jsOMS.Modules.Draw.prototype.bind = function (id) {
|
||||
var temp = null;
|
||||
let temp = null;
|
||||
|
||||
if (typeof id !== 'undefined') {
|
||||
temp = new jsOMS.Modules.Draw.Editor(document.getElementById(id));
|
||||
|
|
@ -15,12 +17,13 @@
|
|||
|
||||
this.editors.push(temp);
|
||||
} else {
|
||||
var canvas = document.getElementsByClassName('m-draw');
|
||||
const canvas = document.getElementsByClassName('m-draw'),
|
||||
length = canvas.length;
|
||||
|
||||
this.editors = [];
|
||||
|
||||
/* Handle media forms */
|
||||
for (var c = 0; c < canvas.length; c++) {
|
||||
for (let c = 0; c < canvas.length; c++) {
|
||||
temp = new jsOMS.Modules.Draw.Editor(canvas[c]);
|
||||
temp.bind();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,15 @@
|
|||
*
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @copyright 2013 Dennis Eichhorn
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0 * @since 1.0.0
|
||||
*/
|
||||
(function (jsOMS)
|
||||
{
|
||||
"use strict";
|
||||
/** @namespace jsOMS.Modules.Draw */
|
||||
jsOMS.Autoloader.defineNamespace('jsOMS.Modules.Draw');
|
||||
|
||||
jsOMS.Modules.Draw.DrawTypeEnum = Object.freeze({
|
||||
DRAW: 0,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
(function (jsOMS)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
/** @namespace jsOMS.Modules.Draw */
|
||||
jsOMS.Autoloader.defineNamespace('jsOMS.Modules.Draw');
|
||||
|
||||
jsOMS.Modules.Draw.Editor = function (editor)
|
||||
{
|
||||
this.editor = editor;
|
||||
|
|
@ -9,8 +11,8 @@
|
|||
this.canvasContainer = this.canvas.parentElement;
|
||||
this.ctx = this.canvas.getContext("2d");
|
||||
|
||||
var canvasStyle = window.getComputedStyle(this.canvas, null);
|
||||
var canvasContainerStyle = window.getComputedStyle(this.canvasContainer, null);
|
||||
const canvasStyle = window.getComputedStyle(this.canvas, null),
|
||||
canvasContainerStyle = window.getComputedStyle(this.canvasContainer, null);
|
||||
|
||||
this.resize({
|
||||
width: parseFloat(canvasContainerStyle.width) - parseFloat(canvasContainerStyle.paddingLeft) - parseFloat(canvasContainerStyle.paddingRight) - parseFloat(canvasContainerStyle.borderLeftWidth) - parseFloat(canvasStyle.borderLeftWidth),
|
||||
|
|
@ -36,7 +38,7 @@
|
|||
|
||||
jsOMS.Modules.Draw.Editor.prototype.bind = function ()
|
||||
{
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
// Handle draw and resize
|
||||
this.canvas.addEventListener('mousemove', function (evt)
|
||||
|
|
@ -154,7 +156,7 @@
|
|||
|
||||
jsOMS.Modules.Draw.Editor.prototype.toImage = function (callback)
|
||||
{
|
||||
var image = new Image();
|
||||
const image = new Image();
|
||||
image.onload = function ()
|
||||
{
|
||||
callback(image);
|
||||
|
|
@ -167,7 +169,7 @@
|
|||
|
||||
jsOMS.Modules.Draw.Editor.prototype.mousePosition = function (evt)
|
||||
{
|
||||
var rect = this.canvas.getBoundingClientRect();
|
||||
const rect = this.canvas.getBoundingClientRect();
|
||||
return {
|
||||
x: evt.clientX - rect.left - 0.5,
|
||||
y: evt.clientY - rect.top - 0.5
|
||||
|
|
@ -176,7 +178,7 @@
|
|||
|
||||
jsOMS.Modules.Draw.Editor.prototype.resize = function (size)
|
||||
{
|
||||
var tmpCanvas = document.createElement('canvas');
|
||||
const tmpCanvas = document.createElement('canvas');
|
||||
tmpCanvas.width = this.canvas.width;
|
||||
tmpCanvas.height = this.canvas.height;
|
||||
|
||||
|
|
@ -190,7 +192,7 @@
|
|||
|
||||
jsOMS.Modules.Draw.Editor.prototype.scale = function (scale)
|
||||
{
|
||||
var tmpCanvas = document.createElement('canvas');
|
||||
const tmpCanvas = document.createElement('canvas');
|
||||
tmpCanvas.width = this.canvas.width;
|
||||
tmpCanvas.height = this.canvas.height;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ jsOMS.ready(function ()
|
|||
*
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @copyright 2013 Dennis Eichhorn
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0 * @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user