fix some tests
This commit is contained in:
@@ -31,19 +31,15 @@ export const setBlurNoUndo = function (val) {
|
||||
if (val === 0) {
|
||||
// Don't change the StdDev, as that will hide the element.
|
||||
// Instead, just remove the value for "filter"
|
||||
svgCanvas.changeSelectedAttributeNoUndoMethod('filter', '')
|
||||
svgCanvas.changeSelectedAttributeNoUndo('filter', '')
|
||||
svgCanvas.setFilterHidden(true)
|
||||
} else {
|
||||
const elem = selectedElements[0]
|
||||
if (svgCanvas.getFilterHidden()) {
|
||||
svgCanvas.changeSelectedAttributeNoUndoMethod('filter', 'url(#' + elem.id + '_blur)')
|
||||
}
|
||||
if (svgCanvas.isWebkit()) {
|
||||
elem.removeAttribute('filter')
|
||||
elem.setAttribute('filter', 'url(#' + elem.id + '_blur)')
|
||||
svgCanvas.changeSelectedAttributeNoUndo('filter', 'url(#' + elem.id + '_blur)')
|
||||
}
|
||||
const filter = svgCanvas.getFilter()
|
||||
svgCanvas.changeSelectedAttributeNoUndoMethod('stdDeviation', val, [filter.firstChild])
|
||||
svgCanvas.changeSelectedAttributeNoUndo('stdDeviation', val, [filter.firstChild])
|
||||
svgCanvas.setBlurOffsets(filter, val)
|
||||
}
|
||||
}
|
||||
@@ -77,8 +73,7 @@ export const setBlurOffsets = function (filterElem, stdDev) {
|
||||
width: '200%',
|
||||
height: '200%'
|
||||
}, 100)
|
||||
// Removing these attributes hides text in Chrome (see Issue 579)
|
||||
} else if (!svgCanvas.isWebkit()) {
|
||||
} else {
|
||||
filterElem.removeAttribute('x')
|
||||
filterElem.removeAttribute('y')
|
||||
filterElem.removeAttribute('width')
|
||||
@@ -107,7 +102,7 @@ export const setBlur = function (val, complete) {
|
||||
// Looks for associated blur, creates one if not found
|
||||
const elem = selectedElements[0]
|
||||
const elemId = elem.id
|
||||
svgCanvas.setFilter(svgCanvas.getElem(elemId + '_blur'))
|
||||
svgCanvas.setFilter(svgCanvas.getElement(elemId + '_blur'))
|
||||
|
||||
val -= 0
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import HistoryRecordingService from './historyrecording.js'
|
||||
|
||||
import { NS } from './namespaces.js'
|
||||
import {
|
||||
toXml, getElem
|
||||
toXml, getElement
|
||||
} from './utilities.js'
|
||||
import {
|
||||
copyElem as utilCopyElem
|
||||
@@ -1013,7 +1013,7 @@ export const setContext = function (elem) {
|
||||
const dataStorage = svgCanvas.getDataStorage()
|
||||
leaveContext()
|
||||
if (typeof elem === 'string') {
|
||||
elem = getElem(elem)
|
||||
elem = getElement(elem)
|
||||
}
|
||||
|
||||
// Edit inside this group
|
||||
|
||||
@@ -8,7 +8,7 @@ import { jGraduate } from '../editor/components/jgraduate/jQuery.jGraduate.js'
|
||||
import { NS } from './namespaces.js'
|
||||
import {
|
||||
getVisibleElements, getStrokedBBoxDefaultVisible, findDefs,
|
||||
walkTree, isNullish, getHref, setHref, getElem
|
||||
walkTree, isNullish, getHref, setHref, getElement
|
||||
} from './utilities.js'
|
||||
import {
|
||||
convertToNum
|
||||
@@ -356,7 +356,7 @@ export const setColorMethod = function (type, val, preventUndo) {
|
||||
svgCanvas.changeSelectedAttribute(type, val, elems)
|
||||
svgCanvas.call('changed', elems)
|
||||
} else {
|
||||
svgCanvas.changeSelectedAttributeNoUndoMethod(type, val, elems)
|
||||
svgCanvas.changeSelectedAttributeNoUndo(type, val, elems)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -883,10 +883,10 @@ export const setSegTypeMethod = function (newType) {
|
||||
* @returns {void}
|
||||
*/
|
||||
export const setBackgroundMethod = function (color, url) {
|
||||
const bg = getElem('canvasBackground')
|
||||
const bg = getElement('canvasBackground')
|
||||
const border = bg.querySelector('rect')
|
||||
let bgImg = getElem('background_image')
|
||||
let bgPattern = getElem('background_pattern')
|
||||
let bgImg = getElement('background_image')
|
||||
let bgPattern = getElement('background_pattern')
|
||||
border.setAttribute('fill', color === 'chessboard' ? '#fff' : color)
|
||||
if (color === 'chessboard') {
|
||||
if (!bgPattern) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @copyright 2011 Jeff Schiller
|
||||
*/
|
||||
import {
|
||||
assignAttributes, cleanupElement, getElem, getRotationAngle, snapToGrid, walkTree,
|
||||
assignAttributes, cleanupElement, getElement, getRotationAngle, snapToGrid, walkTree,
|
||||
isNullish, preventClickDefault, setHref, getBBox
|
||||
} from './utilities.js'
|
||||
import {
|
||||
@@ -98,7 +98,7 @@ export const mouseMoveEvent = (evt) => {
|
||||
const pt = transformPoint(evt.clientX, evt.clientY, svgCanvas.getrootSctm())
|
||||
const mouseX = pt.x * zoom
|
||||
const mouseY = pt.y * zoom
|
||||
const shape = getElem(svgCanvas.getId())
|
||||
const shape = getElement(svgCanvas.getId())
|
||||
|
||||
let realX = mouseX / zoom
|
||||
let x = realX
|
||||
@@ -555,7 +555,7 @@ export const mouseUpEvent = (evt) => {
|
||||
const x = mouseX / zoom
|
||||
const y = mouseY / zoom
|
||||
|
||||
let element = getElem(svgCanvas.getId())
|
||||
let element = getElement(svgCanvas.getId())
|
||||
let keep = false
|
||||
|
||||
const realX = x
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* @copyright 2010 Alexis Deveria, 2010 Jeff Schiller
|
||||
*/
|
||||
import { getElem, assignAttributes, cleanupElement } from './utilities.js'
|
||||
import { getElement, assignAttributes, cleanupElement } from './utilities.js'
|
||||
import { NS } from './namespaces.js'
|
||||
|
||||
let svgCanvas = null
|
||||
@@ -67,7 +67,7 @@ export const getJsonFromSvgElements = (data) => {
|
||||
export const addSVGElementsFromJson = function (data) {
|
||||
if (typeof data === 'string') return svgdoc_.createTextNode(data)
|
||||
|
||||
let shape = getElem(data.attr.id)
|
||||
let shape = getElement(data.attr.id)
|
||||
// if shape is a path but we need to create a rect/ellipse, then remove the path
|
||||
const currentLayer = svgCanvas.getDrawing().getCurrentLayer()
|
||||
if (shape && data.element !== shape.tagName) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
transformListToTransform
|
||||
} from './math.js'
|
||||
import {
|
||||
assignAttributes, getElem, getRotationAngle, snapToGrid, isNullish,
|
||||
assignAttributes, getElement, getRotationAngle, snapToGrid, isNullish,
|
||||
getBBox
|
||||
} from './utilities.js'
|
||||
|
||||
@@ -338,7 +338,7 @@ export const pathActionsMethod = (function () {
|
||||
const zoom = svgCanvas.getZoom()
|
||||
let x = mouseX / zoom
|
||||
let y = mouseY / zoom
|
||||
let stretchy = getElem('path_stretch_line')
|
||||
let stretchy = getElement('path_stretch_line')
|
||||
newPoint = [x, y]
|
||||
|
||||
if (svgCanvas.getGridSnapping()) {
|
||||
@@ -356,7 +356,7 @@ export const pathActionsMethod = (function () {
|
||||
'stroke-width': '0.5',
|
||||
fill: 'none'
|
||||
})
|
||||
getElem('selectorParentGroup').append(stretchy)
|
||||
getElement('selectorParentGroup').append(stretchy)
|
||||
}
|
||||
stretchy.setAttribute('display', 'inline')
|
||||
|
||||
@@ -404,7 +404,7 @@ export const pathActionsMethod = (function () {
|
||||
// Remove previous path object if previously created
|
||||
svgCanvas.removePath_(id)
|
||||
|
||||
const newpath = getElem(id)
|
||||
const newpath = getElement(id)
|
||||
let newseg
|
||||
let sSeg
|
||||
const len = seglist.numberOfItems
|
||||
@@ -624,7 +624,7 @@ export const pathActionsMethod = (function () {
|
||||
svgCanvas.replacePathSeg(6, index, [ptX, ptY, lastX, lastY, altX, altY], drawnPath)
|
||||
}
|
||||
} else {
|
||||
const stretchy = getElem('path_stretch_line')
|
||||
const stretchy = getElement('path_stretch_line')
|
||||
if (stretchy) {
|
||||
const prev = seglist.getItem(index)
|
||||
if (prev.pathSegType === 6) {
|
||||
@@ -709,7 +709,7 @@ export const pathActionsMethod = (function () {
|
||||
if (svgCanvas.getCurrentMode() === 'path') {
|
||||
newPoint = null
|
||||
if (!drawnPath) {
|
||||
element = getElem(svgCanvas.getId())
|
||||
element = getElement(svgCanvas.getId())
|
||||
svgCanvas.setStarted(false)
|
||||
firstCtrl = null
|
||||
}
|
||||
@@ -853,11 +853,11 @@ export const pathActionsMethod = (function () {
|
||||
const drawnPath = svgCanvas.getDrawnPath()
|
||||
currentPath = null
|
||||
if (drawnPath) {
|
||||
const elem = getElem(svgCanvas.getId())
|
||||
const psl = getElem('path_stretch_line')
|
||||
const elem = getElement(svgCanvas.getId())
|
||||
const psl = getElement('path_stretch_line')
|
||||
psl.parentNode.removeChild(psl)
|
||||
elem.parentNode.removeChild(elem)
|
||||
const pathpointgripContainer = getElem('pathpointgrip_container')
|
||||
const pathpointgripContainer = getElement('pathpointgrip_container')
|
||||
const elements = pathpointgripContainer.querySelectorAll('*')
|
||||
Array.prototype.forEach.call(elements, function (el) {
|
||||
el.setAttribute('display', 'none')
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from './math.js'
|
||||
import {
|
||||
assignAttributes, getRotationAngle, isNullish,
|
||||
getElem
|
||||
getElement
|
||||
} from './utilities.js'
|
||||
|
||||
let svgCanvas = null
|
||||
@@ -95,9 +95,9 @@ export const getPointFromGripMethod = function (pt, pth) {
|
||||
* @returns {Element}
|
||||
*/
|
||||
export const getGripContainerMethod = function () {
|
||||
let c = getElem('pathpointgrip_container')
|
||||
let c = getElement('pathpointgrip_container')
|
||||
if (!c) {
|
||||
const parentElement = getElem('selectorParentGroup')
|
||||
const parentElement = getElement('selectorParentGroup')
|
||||
c = document.createElementNS(NS.SVG, 'g')
|
||||
parentElement.append(c)
|
||||
c.id = 'pathpointgrip_container'
|
||||
@@ -117,7 +117,7 @@ export const addPointGripMethod = function (index, x, y) {
|
||||
// create the container of all the point grips
|
||||
const pointGripContainer = getGripContainerMethod()
|
||||
|
||||
let pointGrip = getElem('pathpointgrip_' + index)
|
||||
let pointGrip = getElement('pathpointgrip_' + index)
|
||||
// create it
|
||||
if (!pointGrip) {
|
||||
pointGrip = document.createElementNS(NS.SVG, 'circle')
|
||||
@@ -164,7 +164,7 @@ export const addPointGripMethod = function (index, x, y) {
|
||||
* @returns {SVGCircleElement}
|
||||
*/
|
||||
export const addCtrlGripMethod = function (id) {
|
||||
let pointGrip = getElem('ctrlpointgrip_' + id)
|
||||
let pointGrip = getElement('ctrlpointgrip_' + id)
|
||||
if (pointGrip) { return pointGrip }
|
||||
|
||||
pointGrip = document.createElementNS(NS.SVG, 'circle')
|
||||
@@ -192,7 +192,7 @@ export const addCtrlGripMethod = function (id) {
|
||||
* @returns {SVGLineElement}
|
||||
*/
|
||||
export const getCtrlLineMethod = function (id) {
|
||||
let ctrlLine = getElem('ctrlLine_' + id)
|
||||
let ctrlLine = getElement('ctrlLine_' + id)
|
||||
if (ctrlLine) { return ctrlLine }
|
||||
|
||||
ctrlLine = document.createElementNS(NS.SVG, 'line')
|
||||
@@ -299,7 +299,7 @@ export const replacePathSegMethod = function (type, index, pts, elem) {
|
||||
*/
|
||||
export const getSegSelectorMethod = function (seg, update) {
|
||||
const { index } = seg
|
||||
let segLine = getElem('segline_' + index)
|
||||
let segLine = getElement('segline_' + index)
|
||||
if (!segLine) {
|
||||
const pointGripContainer = getGripContainerMethod()
|
||||
// create segline
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
import { NS } from './namespaces.js'
|
||||
import { convertToNum } from '../common/units.js'
|
||||
import { isWebkit } from '../common/browser.js'
|
||||
import { getRotationAngle, getHref, getBBox, getRefElem, isNullish } from './utilities.js'
|
||||
import { BatchCommand, ChangeElementCommand } from './history.js'
|
||||
import { remapElement } from './coords.js'
|
||||
@@ -155,7 +154,7 @@ export const recalculateDimensions = function (selected) {
|
||||
|
||||
// If it still has a single [M] or [R][M], return null too (prevents BatchCommand from being returned).
|
||||
switch (selected.tagName) {
|
||||
// Ignore these elements, as they can absorb the [M]
|
||||
// Ignore these elements, as they can absorb the [M]
|
||||
case 'line':
|
||||
case 'polyline':
|
||||
case 'polygon':
|
||||
@@ -609,24 +608,22 @@ export const recalculateDimensions = function (selected) {
|
||||
|
||||
// Check if it has a gradient with userSpaceOnUse, in which case
|
||||
// adjust it by recalculating the matrix transform.
|
||||
// TODO: Make this work in Webkit using transformlist.SVGTransformList
|
||||
if (!isWebkit()) {
|
||||
const fill = selected.getAttribute('fill')
|
||||
if (fill && fill.startsWith('url(')) {
|
||||
const paint = getRefElem(fill)
|
||||
if (paint) {
|
||||
let type = 'pattern'
|
||||
if (paint?.tagName !== type) type = 'gradient'
|
||||
const attrVal = paint.getAttribute(type + 'Units')
|
||||
if (attrVal === 'userSpaceOnUse') {
|
||||
// Update the userSpaceOnUse element
|
||||
m = transformListToTransform(tlist).matrix
|
||||
const gtlist = paint.transform.baseVal
|
||||
const gmatrix = transformListToTransform(gtlist).matrix
|
||||
m = matrixMultiply(m, gmatrix)
|
||||
const mStr = 'matrix(' + [m.a, m.b, m.c, m.d, m.e, m.f].join(',') + ')'
|
||||
paint.setAttribute(type + 'Transform', mStr)
|
||||
}
|
||||
|
||||
const fill = selected.getAttribute('fill')
|
||||
if (fill && fill.startsWith('url(')) {
|
||||
const paint = getRefElem(fill)
|
||||
if (paint) {
|
||||
let type = 'pattern'
|
||||
if (paint?.tagName !== type) type = 'gradient'
|
||||
const attrVal = paint.getAttribute(type + 'Units')
|
||||
if (attrVal === 'userSpaceOnUse') {
|
||||
// Update the userSpaceOnUse element
|
||||
m = transformListToTransform(tlist).matrix
|
||||
const gtlist = paint.transform.baseVal
|
||||
const gmatrix = transformListToTransform(gtlist).matrix
|
||||
m = matrixMultiply(m, gmatrix)
|
||||
const mStr = 'matrix(' + [m.a, m.b, m.c, m.d, m.e, m.f].join(',') + ')'
|
||||
paint.setAttribute(type + 'Transform', mStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { NS } from './namespaces.js'
|
||||
import * as hstry from './history.js'
|
||||
import * as pathModule from './path.js'
|
||||
import {
|
||||
isNullish, getStrokedBBoxDefaultVisible, setHref, getElem, getHref, getVisibleElements,
|
||||
isNullish, getStrokedBBoxDefaultVisible, setHref, getElement, getHref, getVisibleElements,
|
||||
findDefs, getRotationAngle, getRefElem, getBBox as utilsGetBBox, walkTreePost, assignAttributes, getFeGaussianBlur
|
||||
} from './utilities.js'
|
||||
import {
|
||||
@@ -854,7 +854,7 @@ export const ungroupSelectedElement = function () {
|
||||
}
|
||||
if (g.tagName === 'use') {
|
||||
// Somehow doesn't have data set, so retrieve
|
||||
const symbol = getElem(getHref(g).substr(1))
|
||||
const symbol = getElement(getHref(g).substr(1))
|
||||
dataStorage.put(g, 'symbol', symbol)
|
||||
dataStorage.put(g, 'ref', symbol)
|
||||
convertToGroup(g)
|
||||
@@ -940,7 +940,7 @@ export const updateCanvas = function (w, h) {
|
||||
y
|
||||
})
|
||||
|
||||
const bgImg = getElem('background_image')
|
||||
const bgImg = getElement('background_image')
|
||||
if (bgImg) {
|
||||
assignAttributes(bgImg, {
|
||||
width: '100%',
|
||||
|
||||
@@ -423,7 +423,7 @@ export const setRotationAngle = function (val, preventUndo) {
|
||||
)
|
||||
svgCanvas.call('changed', selectedElements)
|
||||
}
|
||||
// const pointGripContainer = getElem('pathpointgrip_container');
|
||||
// const pointGripContainer = getElement('pathpointgrip_container');
|
||||
// if (elem.nodeName === 'path' && pointGripContainer) {
|
||||
// pathActions.setPointContainerTransform(elem.getAttribute('transform'));
|
||||
// }
|
||||
|
||||
@@ -977,7 +977,7 @@ export const setUseDataMethod = function (parent) {
|
||||
Array.prototype.forEach.call(elems, function (el, _) {
|
||||
const dataStorage = svgCanvas.getDataStorage()
|
||||
const id = svgCanvas.getHref(el).substr(1)
|
||||
const refElem = svgCanvas.getElem(id)
|
||||
const refElem = svgCanvas.getElement(id)
|
||||
if (!refElem) { return }
|
||||
dataStorage.put(el, 'ref', refElem)
|
||||
if (refElem.tagName === 'symbol' || refElem.tagName === 'svg') {
|
||||
|
||||
@@ -48,7 +48,7 @@ import {
|
||||
import { sanitizeSvg } from './sanitize.js'
|
||||
import { getReverseNS, NS } from './namespaces.js'
|
||||
import {
|
||||
assignAttributes, cleanupElement, getElem, getUrlFromAttr,
|
||||
assignAttributes, cleanupElement, getElement, getUrlFromAttr,
|
||||
findDefs, getHref, setHref, getRefElem, getRotationAngle,
|
||||
getBBoxOfElementAsPath, convertToPath, encode64, decode64,
|
||||
getVisibleElements, init as utilsInit,
|
||||
@@ -147,6 +147,7 @@ class SvgCanvas {
|
||||
this.bSpline = { x: 0, y: 0 }
|
||||
this.nextPos = { x: 0, y: 0 }
|
||||
this.idprefix = 'svg_' // Prefix string for element IDs
|
||||
this.encodableImages = {}
|
||||
|
||||
this.curConfig = { // Default configuration options
|
||||
show_outside_canvas: true,
|
||||
@@ -521,7 +522,7 @@ class SvgCanvas {
|
||||
Object.values(attrs).forEach((val) => {
|
||||
if (val && val.startsWith('url(')) {
|
||||
const id = getUrlFromAttr(val).substr(1)
|
||||
const ref = getElem(id)
|
||||
const ref = getElement(id)
|
||||
if (!ref) {
|
||||
findDefs().append(this.removedElements[id])
|
||||
delete this.removedElements[id]
|
||||
@@ -744,7 +745,7 @@ class SvgCanvas {
|
||||
if (elem) {
|
||||
const filterUrl = elem.getAttribute('filter')
|
||||
if (filterUrl) {
|
||||
const blur = getElem(elem.id + '_blur')
|
||||
const blur = getElement(elem.id + '_blur')
|
||||
if (blur) {
|
||||
val = blur.firstChild.getAttribute('stdDeviation')
|
||||
} else {
|
||||
@@ -876,7 +877,7 @@ class SvgCanvas {
|
||||
this.setHref = setHref
|
||||
this.getBBox = utilsGetBBox
|
||||
this.getRotationAngle = getRotationAngle
|
||||
this.getElem = getElem
|
||||
this.getElement = getElement
|
||||
this.getRefElem = getRefElem
|
||||
this.assignAttributes = assignAttributes
|
||||
this.cleanupElement = cleanupElement
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
transformPoint, getMatrix
|
||||
} from './math.js'
|
||||
import {
|
||||
assignAttributes, getElem, getBBox as utilsGetBBox
|
||||
assignAttributes, getElement, getBBox as utilsGetBBox
|
||||
} from './utilities.js'
|
||||
import {
|
||||
supportsGoodTextCharPos
|
||||
@@ -67,7 +67,7 @@ export const textActionsMethod = (function () {
|
||||
if (!empty) {
|
||||
textinput.setSelectionRange(index, index)
|
||||
}
|
||||
cursor = getElem('text_cursor')
|
||||
cursor = getElement('text_cursor')
|
||||
if (!cursor) {
|
||||
cursor = document.createElementNS(NS.SVG, 'line')
|
||||
assignAttributes(cursor, {
|
||||
@@ -75,7 +75,7 @@ export const textActionsMethod = (function () {
|
||||
stroke: '#333',
|
||||
'stroke-width': 1
|
||||
})
|
||||
getElem('selectorParentGroup').append(cursor)
|
||||
getElement('selectorParentGroup').append(cursor)
|
||||
}
|
||||
|
||||
if (!blinker) {
|
||||
@@ -117,7 +117,7 @@ export const textActionsMethod = (function () {
|
||||
textinput.setSelectionRange(start, end)
|
||||
}
|
||||
|
||||
selblock = getElem('text_selectblock')
|
||||
selblock = getElement('text_selectblock')
|
||||
if (!selblock) {
|
||||
selblock = document.createElementNS(NS.SVG, 'path')
|
||||
assignAttributes(selblock, {
|
||||
@@ -126,7 +126,7 @@ export const textActionsMethod = (function () {
|
||||
opacity: 0.5,
|
||||
style: 'pointer-events:none'
|
||||
})
|
||||
getElem('selectorParentGroup').append(selblock)
|
||||
getElement('selectorParentGroup').append(selblock)
|
||||
}
|
||||
|
||||
const startbb = chardata[start]
|
||||
|
||||
@@ -27,7 +27,7 @@ let svgCanvas = null
|
||||
* @param {module:undo.undoContext} undoContext
|
||||
* @returns {void}
|
||||
*/
|
||||
export const init = function (canvas) {
|
||||
export const init = (canvas) => {
|
||||
svgCanvas = canvas
|
||||
canvas.undoMgr = getUndoManager()
|
||||
}
|
||||
|
||||
@@ -1016,7 +1016,7 @@ export let getRotationAngle = function (elem, toRad) {
|
||||
* @returns {Element} Reference element
|
||||
*/
|
||||
export const getRefElem = function (attrVal) {
|
||||
return getElem(getUrlFromAttr(attrVal).substr(1))
|
||||
return getElement(getUrlFromAttr(attrVal).substr(1))
|
||||
}
|
||||
/**
|
||||
* Get the reference element associated with the given attribute value.
|
||||
@@ -1041,11 +1041,11 @@ export const getFeGaussianBlur = function (ele) {
|
||||
|
||||
/**
|
||||
* Get a DOM element by ID within the SVG root element.
|
||||
* @function module:utilities.getElem
|
||||
* @function module:utilities.getElement
|
||||
* @param {string} id - String with the element's new ID
|
||||
* @returns {?Element}
|
||||
*/
|
||||
export const getElem = (id) => {
|
||||
export const getElement = (id) => {
|
||||
// querySelector lookup
|
||||
return svgroot_.querySelector('#' + id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user