@sutton-signwriting/sgnw-components
Version:
a javascript package of web components for use with the SignWriting script.
54 lines (53 loc) • 1.75 kB
JavaScript
/*!
* The Sutton SignWriting Web Components
*/
//
import { Component, Element, Listen, Host, h } from '@stencil/core';
import { overlap } from '../../global/global';
export class SgnwSignbox {
paletteSymbolDropHandler(event) {
const target = event.target;
if (overlap(target, this.el)) {
console.log(event.detail);
}
}
render() {
return (h(Host, null,
h("slot", null)));
}
static get is() { return "sgnw-signbox"; }
static get encapsulation() { return "scoped"; }
static get originalStyleUrls() { return {
"$": ["sgnw-signbox.css"]
}; }
static get styleUrls() { return {
"$": ["sgnw-signbox.css"]
}; }
static get elementRef() { return "el"; }
static get listeners() { return [{
"name": "paletteSymbolDrop",
"method": "paletteSymbolDropHandler",
"target": "window",
"capture": false,
"passive": false
}]; }
}
//
// window.addEventListener('fancyEvent', function(e) {})
//
// var adj = DictionaryFront.signmaker.size/2;
// var sb = document.getElementById("signbox");
// if (overlap(this.element,sb)){
// var offset1 = getOffset( this.element ),
// offset2 = getOffset( sb );
// var symbol = {symbol:this.element.symbol,x: parseInt(500-adj+offset1.left-offset2.left),y: parseInt(500-adj-1+offset1.top-offset2.top)};
// DictionaryFront.signbox.addSymbol(symbol);
// } else {
// var seq = document.getElementById("sequence");
// if (overlap(this.element,seq)){
// var offset1 = getOffset( this.element ),
// offset2 = getOffset( seq );
// var symbol = {symbol:this.element.symbol};
// DictionaryFront.sequence.addSymbol(symbol,parseInt((offset1.top-offset2.top)/28));
// }
// }