@Override public void setTeXIcon(TeXIcon icon) { this.lastIcon = icon; double height = computeHeight(icon); if (ctx == null || height < 0) { return; } ctx.getCanvas().getStyle().setHeight(height, Unit.PX); ctx.getCanvas().getStyle().setWidth(roundUp(icon.getIconWidth() + 30), Unit.PX); parent.setHeight(height + "px"); parent.getElement().getStyle().setVerticalAlign(VerticalAlign.TOP); repaintWeb(); }
/** * Actually repaint the content (repaint() is ignored in Web * implementation). */ public void repaintWeb() { if (lastIcon == null) { return; } if (!active(wrap.getElement()) && this.enabled) { wrap.getElement().focus(); } final double height = computeHeight(lastIcon); final double width = roundUp(lastIcon.getIconWidth() + 30); ctx.getCanvas().setHeight(((int) Math.ceil(height * ratio))); ctx.getCanvas().setWidth((int) Math.ceil(width * ratio)); ctx.setFillStyle("rgb(255,255,255)"); ctx.fillRect(0, 0, ctx.getCanvas().getWidth(), height); JlmLib.draw(lastIcon, ctx, 0, getMargin(lastIcon), new ColorW(0, 0, 0), "#FFFFFF", null, ratio); }
front.beginPath(); front.clearRect(0, 0, width, height); front.drawImage(back.getCanvas(), 0, 0);