Skip to content

Instantly share code, notes, and snippets.

View JimmyJune's full-sized avatar

Jingming Yu JimmyJune

  • Glodon
  • beijing.china
View GitHub Profile
@JimmyJune
JimmyJune / designer.html
Last active August 29, 2015 14:21
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<polymer-element name="my-element">
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>
@JimmyJune
JimmyJune / Draw text background
Created October 29, 2014 02:39
//todo:get line height is still wrong
function drawTextBG(ctx, txt, font, x, y) {
ctx.save();
ctx.font = font;
ctx.textBaseline = 'top';
ctx.fillStyle = '#f50';
var width = ctx.measureText(txt).width;
ctx.fillRect(x, y, width, parseInt(font, 10));
function getPixelRatio() {
if ('devicePixelRatio' in window) {
if (window.devicePixelRatio > 1) {
return window.devicePixelRatio;
}
}
return 1;
}