53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
"use strict";
|
|
/**
|
|
* 使用样式事件
|
|
*/
|
|
define(function (require, exports, module) {
|
|
|
|
function handle(e) {
|
|
const ctx = require("../../common/ctx");
|
|
const utils = require("../../common/utils");
|
|
|
|
let event = utils.ParseEvent(e);
|
|
let curEl = utils.GetEventTarget(event);
|
|
let curId = curEl.getAttribute("id");
|
|
if (curId === "my_fontSize0") {
|
|
localStorage.clear();
|
|
location.reload();
|
|
return
|
|
}
|
|
|
|
console.log("curId : ", curId, " target: ", curEl)
|
|
if (curId === null) { //防止点击到 path
|
|
let tmpSvg = curEl.parentElement.closest("span");
|
|
if (tmpSvg !== undefined && tmpSvg !== null) {
|
|
curId = tmpSvg.getAttribute("id");
|
|
}
|
|
}
|
|
if (curId === "my_fontSize+") {
|
|
if (ctx.editFrontSize >= 72) {
|
|
ctx.editFrontSize = 72;
|
|
} else {
|
|
ctx.editFrontSize++;
|
|
}
|
|
} else {
|
|
if (ctx.editFrontSize <= 12) {
|
|
ctx.editFrontSize = 12
|
|
} else {
|
|
ctx.editFrontSize--;
|
|
}
|
|
}
|
|
|
|
//触发resize
|
|
let resizeImp = require("./RSizeEventImpl");
|
|
resizeImp.refreshEditFrontSize();
|
|
|
|
//保存在本地
|
|
localStorage.setItem('editFrontSize', ctx.editFrontSize);
|
|
//show
|
|
document.getElementById("cur_my_font_size").textContent = ctx.editFrontSize + "px"
|
|
}
|
|
|
|
//导出
|
|
exports.handle = handle;
|
|
}); |