@sutton-signwriting/sgnw-components
Version:
a javascript package of web components for use with the SignWriting script.
59 lines (58 loc) • 1.97 kB
JavaScript
/*!
* The Sutton SignWriting Web Components
*/
//
import { Host, h } from "@stencil/core";
import { overlap } from "../../global/global";
export class FswSignbox {
paletteSymbolDropHandler(event) {
const target = event.target;
if (overlap(target, this.el)) {
console.log(event.detail);
}
}
render() {
return (h(Host, { key: '499a3393a1de94e73fb0d706d30fff0bd968e7b7' }, h("slot", { key: '1b64a39957bb4532707a8db11f33daced97b0ed8' })));
}
static get is() { return "fsw-signbox"; }
static get encapsulation() { return "scoped"; }
static get originalStyleUrls() {
return {
"$": ["fsw-signbox.css"]
};
}
static get styleUrls() {
return {
"$": ["fsw-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));
// }
// }