diff options
author | Cary Clark <caryclark@skia.org> | 2017-11-01 10:21:45 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-01 14:23:50 +0000 |
commit | d49980c43547bca53ba79403a8a8bd2cdccee83d (patch) | |
tree | 7120abeb4d00b6ee2d6148cebc4f3c851cd8e64e /docs/catalogTrailer.txt | |
parent | 2d59d2f9c5ad642f1b81dc53fa2077c70f341c4d (diff) |
streamline doc menus
No-Try: true
Docs-Preview: https://skia.org/?cl=66145
Bug: skia:6898
Change-Id: I11acd8c17db5faa833ca38550d82819e799dd311
Reviewed-on: https://skia-review.googlesource.com/66145
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'docs/catalogTrailer.txt')
-rw-r--r-- | docs/catalogTrailer.txt | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/docs/catalogTrailer.txt b/docs/catalogTrailer.txt index 0bfb8b7584..064fdd535c 100644 --- a/docs/catalogTrailer.txt +++ b/docs/catalogTrailer.txt @@ -15,58 +15,58 @@ var images = {} var imagesLength = 0; function recContains(rec, value) { - if (!value.length)
- return 0
- var lc = value.toLowerCase()
- if (rec.name.toLowerCase().indexOf(lc) >= 0)
- return 1
- if (rec.code.toLowerCase().indexOf(lc) >= 0)
- return 2
- return 3
+ if (!value.length) + return 0 + var lc = value.toLowerCase() + if (rec.name.toLowerCase().indexOf(lc) >= 0) + return 1 + if (rec.code.toLowerCase().indexOf(lc) >= 0) + return 2 + return 3 } function setLink(recstr) { var under var link = recstr - if (!link.startsWith("Sk")) {
+ if (!link.startsWith("Sk")) { under = link.indexOf('_') - link = link.substring(under + 1)
+ link = link.substring(under + 1) } under = link.lastIndexOf('_') var len = link.length - if (under == len - 2) {
+ if (under == len - 2) { var letter = link[len - 1] - if ('a' <= letter && letter <= 'z') {
- link = link.substr(0, len - 2)
- } else if ('0' <= letter && letter <= '9') {
- link = link.substr(0, len - 2)
- }
+ if ('a' <= letter && letter <= 'z') { + link = link.substr(0, len - 2) + } else if ('0' <= letter && letter <= '9') { + link = link.substr(0, len - 2) + } } - lastLinkStr = link
+ lastLinkStr = link } -function showLink() {
- var link = lastLink.file + '#' + lastLinkStr
- context.save()
+function showLink() { + var link = lastLink.file + '#' + lastLinkStr + context.save() context.font = "normal 16px Arial"; - labelback.w = Math.max(labelback.w, context.measureText(link).width + 8)
- context.beginPath()
- context.rect(labelback.x, labelback.y, labelback.w, labelback.h)
- context.fillStyle = "rgba(232,180,220, 1)"
- context.fill()
- context.fillStyle = "rgba(64,32,48, 1)"
- context.fillText(link, labelback.x + 4, labelback.y + 16)
- context.restore()
+ labelback.w = Math.max(labelback.w, context.measureText(link).width + 8) + context.beginPath() + context.rect(labelback.x, labelback.y, labelback.w, labelback.h) + context.fillStyle = "rgba(232,180,220, 1)" + context.fill() + context.fillStyle = "rgba(64,32,48, 1)" + context.fillText(link, labelback.x + 4, labelback.y + 16) + context.restore() } -function imageIterator(callout, state) {
+function imageIterator(callout, state) { var row = outset + 30 var column = outset for (var recstr in pngs) { var rec = pngs[recstr] var contains = recContains(rec, input.value) - if (3 == contains)
- continue;
+ if (3 == contains) + continue; var height = rec.height < maxHeight ? rec.height : maxHeight if (callout(state, column, row, height, contains, recstr)) break; @@ -109,12 +109,12 @@ function handleMouseClick() { } } -function doKeyPress(evt) {
+function doKeyPress(evt) { idiv.style.height = 20 input.focus() } -function drawImage(hash, x, y, w, h, contains) {
+function drawImage(hash, x, y, w, h, contains) { context.save() context.transform(scale, 0, 0, scale, 0, 0) context.save() @@ -133,33 +133,33 @@ function drawImage(hash, x, y, w, h, contains) { function draw() { var callout = function(state, column, row, height, contains, recstr) { drawImage(pngs[recstr].hash, column, row, columnWidth, height, contains) - return false
+ return false } imageIterator(callout, null) } -function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
-}
-
-async function redraw() {
- context.strokeStyle = "white"
+function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +async function redraw() { + context.strokeStyle = "white" context.beginPath() context.fillStyle = "white" context.rect(0, 30, canvas.width, canvas.height) context.fill() context.rect((256 + outset) * scale, 0, canvas.width, 30) - context.fill()
- for (var image in images) {
- image.drawn = false
- }
- do {
- draw();
- if (loadedImages >= imagesLength)
- break;
- console.debug(" loadedImages:" + loadedImages + " imagesLength:" + imagesLength)
- await sleep(1000);
- } while (true)
+ context.fill() + for (var image in images) { + image.drawn = false + } + do { + draw(); + if (loadedImages >= imagesLength) + break; + console.debug(" loadedImages:" + loadedImages + " imagesLength:" + imagesLength) + await sleep(1000); + } while (true) } function resize() { @@ -176,22 +176,22 @@ function setSize() { labelback.h = 20 } -function loadImages() {
- for (var recstr in pngs) {
+function loadImages() { + for (var recstr in pngs) { var rec = pngs[recstr] var image = new Image() - images[rec.hash] = image
+ images[rec.hash] = image if (getFromWeb) image.src = 'https://fiddle.skia.org/i/' image.src += rec.hash + '_raster.png' - image.onload = function () {
- loadedImages += 1
- }
- imagesLength += 1;
- }
+ image.onload = function () { + loadedImages += 1 + } + imagesLength += 1; + } } -function start() {
+function start() { loadImages() window.addEventListener('keypress', doKeyPress, true); window.addEventListener('keydown', doKeyPress, true); @@ -204,8 +204,8 @@ function start() { </head> <body onLoad="start()" onresize="resize()"> -<div style="height:0" id="idiv">
-<input type="text" id="input" onkeypress="redraw()" onkeydown="redraw()"/>
+<div style="height:0" id="idiv"> +<input type="text" id="input" onkeypress="redraw()" onkeydown="redraw()"/> </div> <canvas id="canvas" width="750" height="500" onmousedown="mouseDown = true" |