增加了搜索功能和点击查看功能#28
Open
SChen1024 wants to merge 5 commits into
Open
Conversation
Owner
|
感谢!我之后详细 review 一下,请先把两个 yarn 文件删一下,谢谢! |
Author
|
这边是要 关掉这里的pr 重新 提吗,, 这边不太会操作 这个 pr 移除 yarn 文件 就是自己取消跟踪后 加到了 忽略文件中, |
SChen1024
commented
Nov 13, 2019
| <script src="dist/lib/zrender.min.js"></script> | ||
|
|
||
| <!-- <script src="src/index.js"></script> --> | ||
| <script src="dist/index-min.js"></script> |
Author
There was a problem hiding this comment.
这里需要使用 gulp处理过的文件吗, 这边测试 使用的本地文件
SChen1024
commented
Nov 13, 2019
Comment on lines
+153
to
+168
| function getQueryVariable(variable) | ||
| { | ||
| var query = window.location.search.substring(1); | ||
| var vars = query.split("&"); | ||
| for (var i=0;i<vars.length;i++) { | ||
| var pair = vars[i].split("="); | ||
| if(pair[0] == variable){return pair[1];} | ||
| } | ||
| return(false); | ||
| } | ||
|
|
||
| // 获取参数之后 如果有效 标识出来颜色值 | ||
| let color = getQueryVariable("color"); | ||
| if(color != false) { | ||
| showSearchResult("#"+color); | ||
| } |
SChen1024
commented
Nov 13, 2019
Comment on lines
+386
to
+406
| function getColorCoord(color,minMax) { | ||
| var hsl = colorHexToHsl(color); | ||
| return getHslCoord(hsl,minMax); | ||
| } | ||
| // #hex 值转变为 hsl 值 | ||
| function colorHexToHsl(color) { | ||
| color = color.charAt(0) == "#" ?color:("#"+color); ///< 如果第一位是# 就不加了 | ||
| var hsl = tinycolor(color).toHsl(); | ||
| hsl.l *= 100; | ||
| return hsl; | ||
| } | ||
| // 根据 hsl 获取座标值 | ||
| function getHslCoord(hsl,minMax) { | ||
| var hue = encodeHue(hsl.h); | ||
| var light = hsl.l; | ||
| return { | ||
| x: (hue - minMax.minHue) * width / (minMax.maxHue - minMax.minHue) / bgDpi, | ||
| y: height / bgDpi - (light - minMax.minLight) * height / (minMax.maxLight - minMax.minLight) / bgDpi | ||
| }; | ||
|
|
||
| } |
Author
There was a problem hiding this comment.
这里其实可以放弃,因为之前考虑根据颜色显示一个标识符号, 后来换成了 找到最接近的颜色显示 减少了处理过程
SChen1024
commented
Nov 13, 2019
Comment on lines
+504
to
+508
| // 设置点击链接 | ||
| // el.setAttribute('onclick', | ||
| // "window.location.href=\'http://"+window.location.host + window.location.pathname +"?color=" +siblings[i].color.substr(1) + "\';return false"); | ||
|
|
||
| el.setAttribute('onclick','showSearchResult(\"'+siblings[i].color+'\")'); |
Author
There was a problem hiding this comment.
一开始考虑使用点击 使用url 发送, 这边换成了 点击直接触发函数 渲染显示了, 减少了处理
Owner
不需要关掉,我看你已经移除了~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
对这个项目十分感兴趣,但是感觉没有搜索功能比较麻烦, 这边 自己添加了点功能, 不过这边不会使用gulp 打包, 而且似乎这边使用yarn 之后, 稍微改动了 package文件,
ps: 第一次写js 的程序,很多不足 希望能理解
功能展示
后续