ui/lib/shared/addon/components/svg-edge/component.js

27 lines
579 B
JavaScript

import { computed } from '@ember/object';
import Component from '@ember/component';
import layout from './template';
export default Component.extend({
layout,
path: null,
tagName: 'g',
draw: computed('path', function() {
var out;
var paths = this.get('path');
out = `M ${paths.m[0]} ${paths.m[1]}`;
paths.l.forEach((item) => {
out += ` L ${item[0]} ${item[1]}`;
});
return out;
}),
markerPath: function() {
/** Markers require the full path in a SPA to work correctly */
return window.location.pathname;
}.property(),
});