in progress

This commit is contained in:
JFH
2021-12-27 00:14:18 -03:00
parent c786faf328
commit cdc5b8cc75
10 changed files with 567 additions and 1718 deletions

View File

@@ -1,5 +1,6 @@
import { getTypeMap } from '../common/units.js';
import rulersTemplate from './templates/rulersTemplate.html';
import SvgCanvas from '../svgcanvas/svgcanvas.js';
/**
*
*/
@@ -22,7 +23,7 @@ class Rulers {
// eslint-disable-next-line no-unsanitized/property
template.innerHTML = rulersTemplate;
this.editor.$svgEditor.append(template.content.cloneNode(true));
const { $id } = this.svgCanvas;
const { $id } = SvgCanvas;
this.rulerX = $id('ruler_x');
this.rulerY = $id('ruler_y');
this.rulerCorner = $id('ruler_corner');
@@ -68,7 +69,7 @@ class Rulers {
const dim = isX ? 'x' : 'y';
const lentype = isX ? 'width' : 'height';
const contentDim = Number(contentElem.getAttribute(dim));
const { $id } = this.svgCanvas;
const { $id } = SvgCanvas;
const $hcanvOrig = $id('ruler_' + dim).querySelector('canvas');
// Bit of a hack to fully clear the canvas in Safari & IE9

View File

@@ -24,16 +24,16 @@ const loadExtensionTranslation = async function (svgEditor) {
export default {
name,
async init ({ NS, getTypeMap }) {
async init () {
const svgEditor = this;
await loadExtensionTranslation(svgEditor);
const { svgCanvas } = svgEditor;
const { $id } = svgCanvas;
const { $id, NS } = svgCanvas;
const svgdoc = $id('svgcanvas').ownerDocument;
const { assignAttributes } = svgCanvas;
const hcanvas = document.createElement('canvas');
const canvBG = $id('canvasBackground');
const units = getTypeMap(); // Assumes prior `init()` call on `units.js` module
const units = svgCanvas.getTypeMap(); // Assumes prior `init()` call on `units.js` module
const intervals = [ 0.01, 0.1, 1, 10, 100, 1000 ];
let showGrid = svgEditor.configObj.curConfig.showGrid || false;