@Override public void setCursor (Cursor cursor) { ((GwtApplication)Gdx.app).graphics.canvas.getStyle().setProperty("cursor", ((GwtCursor)cursor).cssCursorProperty); }
@Override public void setCursor (Cursor cursor) { ((GwtApplication)Gdx.app).graphics.canvas.getStyle().setProperty("cursor", ((GwtCursor)cursor).cssCursorProperty); }
@Override public void setSystemCursor (SystemCursor systemCursor) { ((GwtApplication)Gdx.app).graphics.canvas.getStyle().setProperty("cursor", GwtCursor.getNameForSystemCursor(systemCursor)); }
@Override public void setSystemCursor (SystemCursor systemCursor) { ((GwtApplication)Gdx.app).graphics.canvas.getStyle().setProperty("cursor", GwtCursor.getNameForSystemCursor(systemCursor)); }
@Override public void setCursor (Cursor cursor) { ((GwtApplication)Gdx.app).graphics.canvas.getStyle().setProperty("cursor", ((GwtCursor)cursor).cssCursorProperty); }
public void setWidth(String width) { canvas.getStyle().setProperty("width", width); }
public void setHeight(String height){ canvas.getStyle().setProperty("height", height); }
@Override public void setSystemCursor (SystemCursor systemCursor) { ((GwtApplication)Gdx.app).graphics.canvas.getStyle().setProperty("cursor", GwtCursor.getNameForSystemCursor(systemCursor)); }
/** * Sets whether this object is visible. * * @param visible * @return Layer */ @Override public Layer setVisible(boolean visible) { super.setVisible(visible); if (null != m_element) { if (false == visible) { m_element.getStyle().setVisibility(Visibility.HIDDEN); } else { m_element.getStyle().setVisibility(Visibility.VISIBLE); } } return this; }
/** * Return the {@link CanvasElement}. * * @return CanvasElement */ public CanvasElement getCanvasElement() { if (LienzoCore.IS_CANVAS_SUPPORTED) { if (null == m_element) { m_element = Document.get().createCanvasElement(); m_element.getStyle().setPosition(Position.ABSOLUTE); m_element.getStyle().setDisplay(Display.INLINE_BLOCK); } if (null == m_context) { m_context = new Context2D(m_element); } } return m_element; }
/** * Return the {@link CanvasElement}. * * @return CanvasElement */ public CanvasElement getCanvasElement() { if (LienzoCore.IS_CANVAS_SUPPORTED) { if (null == m_element) { m_element = Document.get().createCanvasElement(); m_element.getStyle().setPosition(Position.ABSOLUTE); m_element.getStyle().setDisplay(Display.INLINE_BLOCK); } if (null == m_context) { m_context = new Context2D(m_element); } } return m_element; }
@Override public void setPixelSize(int wide, int high) { if (LienzoGlobals.getInstance().isCanvasSupported()) { super.setPixelSize(wide, high); CanvasElement element = getCanvasElement(); element.setHeight(high); element.setWidth(wide); element.getStyle().setPosition(Position.ABSOLUTE); element.getStyle().setDisplay(Display.INLINE_BLOCK); } }
@Override public final void setPixelSize(final int wide, final int high) { if (LienzoCore.get().isCanvasSupported()) { super.setPixelSize(wide, high); CanvasElement element = getCanvasElement(); element.setHeight(high); element.setWidth(wide); element.getStyle().setPosition(Position.ABSOLUTE); element.getStyle().setDisplay(Display.INLINE_BLOCK); } }
@Override public void setPixelSize(final int wide, final int high) { if (LienzoCore.get().isCanvasSupported()) { CanvasElement element = getCanvasElement(); element.getStyle().setPosition(Position.ABSOLUTE); element.getStyle().setDisplay(Display.INLINE_BLOCK); element.setWidth(wide); element.setHeight(high); super.setWidth(wide); super.setHeight(high); } }
@Override public void setPixelSize(int wide, int high) { if (LienzoGlobals.getInstance().isCanvasSupported()) { CanvasElement element = getCanvasElement(); element.getStyle().setPosition(Position.ABSOLUTE); element.getStyle().setDisplay(Display.INLINE_BLOCK); element.setWidth(wide); element.setHeight(high); super.setWidth(wide); super.setHeight(high); } }
@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(); }
/** * Adds a {@link Layer} to the Scene. * A draw will be invoked after the layer is added. */ @Override public void add(Layer layer) { if ((null != layer) && (LienzoGlobals.getInstance().isCanvasSupported())) { CanvasElement element = layer.getCanvasElement(); layer.setPixelSize(m_wide, m_high); element.getStyle().setPosition(Position.ABSOLUTE); element.getStyle().setDisplay(Display.INLINE_BLOCK); getElement().appendChild(element); super.add(layer); layer.draw(); } }
/** * Adds a {@link Layer} to the Scene. * A draw will be invoked after the layer is added. */ @Override public final Scene add(final Layer layer) { if ((null != layer) && (LienzoCore.get().isCanvasSupported())) { CanvasElement element = layer.getCanvasElement(); layer.setPixelSize(m_wide, m_high); element.getStyle().setPosition(Position.ABSOLUTE); element.getStyle().setDisplay(Display.INLINE_BLOCK); getElement().appendChild(element); super.add(layer); layer.batch(); } return this; }
/** * Sizes or resizes the root element that contains the game view. This is specified in pixels as * understood by page elements. If the page is actually being dispalyed on a HiDPI (Retina) * device, the actual framebuffer may be 2x (or larger) the specified size. */ public void setSize (int width, int height) { rootElement.getStyle().setWidth(width, Unit.PX); rootElement.getStyle().setHeight(height, Unit.PX); // the frame buffer may be larger (or smaller) than the logical size, depending on whether // we're on a HiDPI display, or how the game has configured things (maybe they're scaling down // from native resolution to improve performance) Scale fbScale = new Scale(frameBufferPixelRatio); canvas.setWidth(fbScale.scaledCeil(width)); canvas.setHeight(fbScale.scaledCeil(height)); // set the canvas's CSS size to the logical size; the browser works in logical pixels canvas.getStyle().setWidth(width, Style.Unit.PX); canvas.getStyle().setHeight(height, Style.Unit.PX); viewportChanged(canvas.getWidth(), canvas.getHeight()); }
/** * Sizes or resizes the root element that contains the game view. This is specified in pixels as * understood by page elements. If the page is actually being dispalyed on a HiDPI (Retina) * device, the actual framebuffer may be 2x (or larger) the specified size. */ public void setSize (int width, int height) { rootElement.getStyle().setWidth(width, Unit.PX); rootElement.getStyle().setHeight(height, Unit.PX); // the frame buffer may be larger (or smaller) than the logical size, depending on whether // we're on a HiDPI display, or how the game has configured things (maybe they're scaling down // from native resolution to improve performance) Scale fbScale = new Scale(frameBufferPixelRatio); canvas.setWidth(fbScale.scaledCeil(width)); canvas.setHeight(fbScale.scaledCeil(height)); // set the canvas's CSS size to the logical size; the browser works in logical pixels canvas.getStyle().setWidth(width, Style.Unit.PX); canvas.getStyle().setHeight(height, Style.Unit.PX); viewportChanged(canvas.getWidth(), canvas.getHeight()); }