onmousewheel

滚轮的行为从滚动百分比改为滚动固定的3行
修改.g4文件的位置
This commit is contained in:
YouWei Zhao 2019-03-23 14:58:16 -04:00
parent 1b0c65f6f6
commit 74b168a285
3 changed files with 7 additions and 4 deletions

View File

@ -38,10 +38,12 @@ HTML5 canvas制作的魔塔样板支持全平台游戏
│ ├─ /sounds/ # 音效目录
│ ├─ data.js # 全局变量信息
│ ├─ enemys.js # 怪物属性数据
│ ├─ events.js # 公共事件
│ ├─ functions.js # 可能会被修改的脚本代码
│ ├─ icons.js # 素材和ID的对应关系定义
│ ├─ items.js # 道具的定义,获得道具的效果
│ └─ maps.js # 地图和数字的对应关系
│ ├─ maps.js # 地图和数字的对应关系
│ └─ plugins.js # 自定义插件
├── /常用工具/ # 一些常用工具,可以辅助造塔;具体可参见下面的【相关工具】
├── editor.html # 可视化地图编辑工具
├── editor-mobile.html # 可视化地图编辑工具(手机版)

View File

@ -313,7 +313,8 @@ document.getElementById('blocklyDiv').onmousewheel = function(e){
//console.log(e);
e.preventDefault();
var hvScroll = e.shiftKey?'hScroll':'vScroll';
workspace.scrollbar[hvScroll].handlePosition_+=( ((e.deltaY||0)+(e.detail||0)) >0?20:-20);
var mousewheelOffsetValue=20/380*workspace.scrollbar[hvScroll].handleLength_*3;
workspace.scrollbar[hvScroll].handlePosition_+=( ((e.deltaY||0)+(e.detail||0)) >0?mousewheelOffsetValue:-mousewheelOffsetValue);
workspace.scrollbar[hvScroll].onScroll_();
workspace.setScale(workspace.scale);
}
@ -443,13 +444,13 @@ function omitedcheckUpdateFunction(event) {
xhr.onreadystatechange = function () {
if (xhr.readyState != 4) return;
if (xhr.status != 200) {
alert("无法在file://下加载");
alert("图块描述文件加载失败, 请在'启动服务.exe'中打开编辑器");
return;
}
input_ = xhr.responseText;
editor_blockly.runOne();
}
xhr.open('GET', '_server/blockly/MotaAction.g4', true);
xhr.open('GET', '_server/MotaAction.g4', true);
xhr.send(null);
codeAreaHL = CodeMirror.fromTextArea(document.getElementById("codeArea"), {