fix font save hash
This commit is contained in:
parent
247ad85643
commit
aa98e6e71e
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file Editor.js
|
||||
* @author mengke01
|
||||
* @date
|
||||
* @date
|
||||
* @description
|
||||
* 字体编辑控制器
|
||||
*/
|
||||
@ -61,7 +61,7 @@ define(
|
||||
|
||||
/**
|
||||
* 切换编辑模式
|
||||
*
|
||||
*
|
||||
* @param {string} modeName 模式名称
|
||||
* @return {Editor} 本对象
|
||||
*/
|
||||
@ -98,7 +98,7 @@ define(
|
||||
|
||||
/**
|
||||
* 执行指定命令
|
||||
*
|
||||
*
|
||||
* @param {string...} command 指令名,后续为命令参数集合
|
||||
* @return {boolean} 是否执行成功
|
||||
*/
|
||||
@ -125,7 +125,7 @@ define(
|
||||
|
||||
/**
|
||||
* 是否支持指令
|
||||
*
|
||||
*
|
||||
* @param {string} command 指令名
|
||||
* @return {boolean} 是否
|
||||
*/
|
||||
@ -135,7 +135,7 @@ define(
|
||||
|
||||
/**
|
||||
* 添加指令
|
||||
*
|
||||
*
|
||||
* @param {string} command 指令名
|
||||
* @param {Function} worker 执行函数
|
||||
* @return {boolean} 是否成功
|
||||
@ -150,7 +150,7 @@ define(
|
||||
|
||||
/**
|
||||
* 添加到剪切板
|
||||
*
|
||||
*
|
||||
* @param {Array} 形状集合
|
||||
* @return {this}
|
||||
*/
|
||||
@ -161,7 +161,7 @@ define(
|
||||
|
||||
/**
|
||||
* 是否改变过
|
||||
*
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
Editor.prototype.isChanged = function() {
|
||||
@ -169,9 +169,24 @@ define(
|
||||
return this.fontHash !== getFontHash(font);
|
||||
};
|
||||
|
||||
/**
|
||||
* 重置改变状态
|
||||
* @param {boolean} changed 状态
|
||||
* @return {boolean}
|
||||
*/
|
||||
Editor.prototype.setChanged = function(changed) {
|
||||
if (changed) {
|
||||
this.fontHash = 0;
|
||||
}
|
||||
else {
|
||||
var font = this.getFont();
|
||||
this.fontHash = getFontHash(font);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 从剪切板中获取
|
||||
*
|
||||
*
|
||||
* @param {Array} 形状集合
|
||||
* @return {this}
|
||||
*/
|
||||
@ -181,7 +196,7 @@ define(
|
||||
|
||||
/**
|
||||
* 获取焦点
|
||||
*
|
||||
*
|
||||
*/
|
||||
Editor.prototype.focus = function() {
|
||||
this.render.focus();
|
||||
@ -189,7 +204,7 @@ define(
|
||||
|
||||
/**
|
||||
* 离开焦点
|
||||
*
|
||||
*
|
||||
*/
|
||||
Editor.prototype.blur = function() {
|
||||
this.render.blur();
|
||||
@ -203,7 +218,7 @@ define(
|
||||
this.contextMenu.dispose();
|
||||
this.render && this.render.dispose();
|
||||
this.graduationMarker.dispose();
|
||||
|
||||
|
||||
this.options = this.contextMenu = this.render = null;
|
||||
this.fontLayer = this.coverLayer = this.axisLayer = this.graduationLayer = null;
|
||||
this.axis = this.rightSideBearing = this.graduation = this.graduationMarker = this.font = null;
|
||||
|
@ -137,6 +137,7 @@ define(
|
||||
if (program.ttfManager.get()) {
|
||||
|
||||
if (program.editor.isEditing()) {
|
||||
|
||||
// 如果是正在编辑的
|
||||
if (program.data.editingIndex !== -1) {
|
||||
program.ttfManager.replaceGlyf(program.editor.getFont(), program.data.editingIndex);
|
||||
@ -145,6 +146,7 @@ define(
|
||||
else {
|
||||
program.ttfManager.insertGlyf(program.editor.getFont());
|
||||
}
|
||||
program.editor.setChanged(false);
|
||||
}
|
||||
|
||||
if (program.data.projectName) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file GLYFEditor.js
|
||||
* @author mengke01
|
||||
* @date
|
||||
* @date
|
||||
* @description
|
||||
* 编辑器组件
|
||||
*/
|
||||
@ -53,7 +53,7 @@ define(
|
||||
|
||||
/**
|
||||
* font查看器
|
||||
*
|
||||
*
|
||||
* @constructor
|
||||
* @param {HTMLElement} main 主元素
|
||||
* @param {Object} options 参数
|
||||
@ -151,7 +151,7 @@ define(
|
||||
};
|
||||
|
||||
// 导出editor的函数
|
||||
['reset','setFont', 'getFont', 'addContours', 'isChanged', 'setAxis', 'adjustFont'].forEach(function(fn) {
|
||||
['reset','setFont', 'getFont', 'addContours', 'isChanged', 'setChanged', 'setAxis', 'adjustFont'].forEach(function(fn) {
|
||||
GLYFEditor.prototype[fn] = function() {
|
||||
return this.editor ? this.editor[fn].apply(this.editor, arguments) : undefined;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file previewer.js
|
||||
* @author mengke01
|
||||
* @date
|
||||
* @date
|
||||
* @description
|
||||
* 预览组件
|
||||
*/
|
||||
@ -24,7 +24,7 @@ define(
|
||||
var previewTplRender = null; // 模板渲染函数
|
||||
|
||||
|
||||
var isIE = !!navigator.userAgent.match(/\bMSIE\s+\d+\b/);
|
||||
var isIE = !!window.ActiveXObject || "ActiveXObject" in window;
|
||||
|
||||
// 列出unicode
|
||||
function listUnicode(unicode) {
|
||||
@ -35,7 +35,7 @@ define(
|
||||
|
||||
/**
|
||||
* 生成预览模板
|
||||
*
|
||||
*
|
||||
* @param {Object} ttf ttfObject
|
||||
* @param {string} fontFormat 字体类型
|
||||
* @return {string} html字符串
|
||||
@ -65,7 +65,7 @@ define(
|
||||
|
||||
// 过滤不显示的字形
|
||||
var filtered = ttf.glyf.filter(function(g) {
|
||||
return g.name != '.notdef' && g.name != '.null' && g.name != 'nonmarkingreturn'
|
||||
return g.name != '.notdef' && g.name != '.null' && g.name != 'nonmarkingreturn'
|
||||
&& g.unicode && g.unicode.length;
|
||||
});
|
||||
|
||||
@ -101,7 +101,7 @@ define(
|
||||
|
||||
/**
|
||||
* 加载预览按钮
|
||||
*
|
||||
*
|
||||
* @param {Object} ttf ttfObject
|
||||
* @param {string} fontFormat 字体类型
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user