Commit b0dc80e3 authored by liujiaxin's avatar liujiaxin

feat: custom formula input

parent 5c209d10
...@@ -67,17 +67,18 @@ export class FormulaInputComponent implements OnInit, OnChanges, OnDestroy, Afte ...@@ -67,17 +67,18 @@ export class FormulaInputComponent implements OnInit, OnChanges, OnDestroy, Afte
window.__tmp_fp_input_model__ = this; window.__tmp_fp_input_model__ = this;
const rect = this.inputEl.nativeElement.getBoundingClientRect(); const rect = this.inputEl.nativeElement.getBoundingClientRect();
const fb = document.getElementById(this.FB_id); const fb = document.getElementById(this.FB_id);
fb.style.position = 'absolute'; fb.style.position = 'fixed';
let left = rect.left + rect.width;
let top = rect.top;
// @ts-ignore // @ts-ignore
const padWidth = $('#' + this.FB_id).outerWidth() * .8; const padWidth = $('#' + this.FB_id).outerWidth() * .8;
// @ts-ignore // @ts-ignore
const padHeight = $('#' + this.FB_id).outerHeight() * .8;
// @ts-ignore
const ww = $(window).innerWidth(); const ww = $(window).innerWidth();
if ((left + padWidth) > ww) { // @ts-ignore
left = ww - padWidth; const hh = $(window).innerHeight();
top = top + rect.height; const left = (ww - padWidth) / 2;
} const top = (hh - padHeight) / 2;
console.log('left', left); console.log('left', left);
fb.style.left = left + 'px'; fb.style.left = left + 'px';
fb.style.top = top + 'px'; fb.style.top = top + 'px';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment