提交 207c2a70 编辑于 作者: wenxiangdong's avatar wenxiangdong
浏览文件

最后完成

上级 87fff498
......@@ -5,7 +5,8 @@
"main": "main.js",
"scripts": {
"build": "webpack",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"start": "index.html"
},
"author": "",
"license": "ISC",
......
run 'npm install' to install dependencies
run 'npm build' to build file
run 'npm start' to start the program
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var logger_1 = require("../utils/logger");
var panel_state_manager_1 = require("../panel-state-manager/panel-state-manager");
var shape_recognition_util_1 = require("../recogonition/shape-recognition-util");
var message_1 = require("../utils/message");
var DrawingPanel = /** @class */ (function () {
......@@ -32,14 +31,6 @@ var DrawingPanel = /** @class */ (function () {
}
};
this.drawing = false;
// 准备options
options = options || {};
for (var key in DrawingPanel.defaultOptions) {
options[key] = options[key] || DrawingPanel.defaultOptions[key];
}
for (var key in options.style) {
options.style[key] = options.style[key] || DrawingPanel.defaultOptions.style[key];
}
this.init(containerID, options);
}
// 切换画图工具
......@@ -54,6 +45,7 @@ var DrawingPanel = /** @class */ (function () {
DrawingPanel.prototype.setStateManager = function (stateManager) {
this.stateManager = stateManager;
};
// 获取canvas元素
DrawingPanel.prototype.getCanvas = function () {
return this.canvas;
};
......@@ -75,14 +67,13 @@ var DrawingPanel = /** @class */ (function () {
* @return {PanelState[]} 目前状态列表
*/
DrawingPanel.prototype.saveCanvas = function () {
var data = this.canvas.toDataURL();
var id = "state" + new Date().getTime().toString();
var state = new panel_state_manager_1.PanelState(id, data);
if (!this.stateManager) {
return [];
}
this.stateManager.save(state).then(function (res) {
this.stateManager.save().then(function () {
message_1.Message.show('保存成功');
}).catch(function (e) {
message_1.Message.error('保存失败');
});
var stateList = [];
this.stateManager.forEach(function (item) {
......@@ -96,15 +87,7 @@ var DrawingPanel = /** @class */ (function () {
*/
DrawingPanel.prototype.restoreCanvas = function (state) {
this.resetCanvas();
if (!state) {
return false;
}
var ctx = this.canvas.getContext('2d');
var pic = new Image();
pic.src = state.data.toString();
pic.onload = function () {
ctx.drawImage(pic, 0, 0);
};
this.stateManager.restore(state);
return true;
};
/**
......@@ -144,12 +127,29 @@ var DrawingPanel = /** @class */ (function () {
}
this.options = options;
};
/**
* 初始画板设置
* @param options
* @return {any}
*/
DrawingPanel.prototype.initOptions = function (options) {
// 准备options
options = options || {};
for (var key in DrawingPanel.defaultOptions) {
options[key] = options[key] || DrawingPanel.defaultOptions[key];
}
for (var key in options.style) {
options.style[key] = options.style[key] || DrawingPanel.defaultOptions.style[key];
}
return options;
};
/**
* 总体初始化
* @param {string} containerID
* @param {DrawingPanelOptions} options
*/
DrawingPanel.prototype.init = function (containerID, options) {
options = this.initOptions(options);
var container = document.getElementById(containerID);
if (!container) {
logger_1.default.error('没拿到容器');
......
{"version":3,"file":"drawing-panel.js","sourceRoot":"","sources":["drawing-panel.ts"],"names":[],"mappings":";;AAAA,0CAAqC;AAGrC,kFAGoD;AACpD,iFAA8E;AAC9E,4CAA2C;AAc3C;IAaE,sBAAY,WAAmB,EAAE,OAA6B;QAA9D,iBAWC;QAsFD;;;;WAIG;QACK,iBAAY,GAAG,UAAC,KAAY,EAAE,SAAqB;YACzD,gBAAM,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5C,IAAI,eAAe,GAAG,6CAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACnE,IAAI,KAAK,CAAC;YACV,IAAI,CAAC,eAAe,EAAE;gBACpB,SAAS;gBACT,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;aAChC;iBAAM;gBACL,IAAI,OAAO,CAAC,qDAAW,eAAe,CAAC,KAAK,iEAAY,CAAC,EAAE;oBACzD,KAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;oBAC9B,eAAe,CAAC,IAAI,CAAC,KAAI,CAAC,MAAM,CAAC,UAAU,CAAC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AAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACnF;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACK,2BAAI,GAAZ,UAAa,WAAmB,EAAE,OAA4B;QAC5D,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACpC,IAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,EAAE;YACd,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SACvB;QACD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC/C,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IA/Kc,gBAAG,GAAG,cAAc,CAAC;IACrB,2BAAc,GAAwB,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,EAAC,eAAe,EAAE,OAAO,EAAE,MAAM,EAAC,mBAAmB,EAAC,EAAC,CAAC;IAC/H,uBAAU,GAAG,QAAQ,CAAC;IACtB,sBAAS,GAAG,iBAAiB,CAAC;IA6K/C,mBAAC;CAAA,AAjLD,IAiLC;AAjLY,oCAAY"}
\ No newline at end of file
import logger from '../utils/logger';
import { IDrawingTool } from './i-drawing-tool';
import { IDrawingTool } from './drawing-tool/i-drawing-tool';
import { Point, Shape } from '../shape/shape';
import {
IPanelStateManager,
......@@ -25,6 +25,7 @@ export class DrawingPanel {
private static defaultOptions: DrawingPanelOptions = {width: 500, height: 500, style: {backgroundColor: 'white', border:'1px solid #dcdee2'}};
private static labelColor = 'tomato';
private static labelFont = 'bold 20px Arial';
private canvas: HTMLCanvasElement;
private drawingTool: IDrawingTool;
private drawing: boolean;
......@@ -35,14 +36,6 @@ export class DrawingPanel {
constructor(containerID: string, options?: DrawingPanelOptions) {
this.drawing = false;
// 准备options
options = options || <DrawingPanelOptions>{};
for (let key in DrawingPanel.defaultOptions) {
options[key] = options[key] || DrawingPanel.defaultOptions[key];
}
for (let key in options.style) {
options.style[key] = options.style[key] || DrawingPanel.defaultOptions.style[key];
}
this.init(containerID, options);
}
......@@ -60,6 +53,7 @@ export class DrawingPanel {
this.stateManager = stateManager;
}
// 获取canvas元素
public getCanvas(): HTMLCanvasElement {
return this.canvas;
}
......@@ -82,17 +76,14 @@ export class DrawingPanel {
* @return {PanelState[]} 目前状态列表
*/
public saveCanvas(): PanelState[] {
let data = this.canvas.toDataURL();
const id = `state${new Date().getTime().toString()}`;
let state = new PanelState(id, data);
if (!this.stateManager) {
return [];
}
this.stateManager.save(state).then(
res => {
Message.show('保存成功');
}
);
this.stateManager.save().then(() => {
Message.show('保存成功');
}).catch(e => {
Message.error('保存失败');
});
let stateList: PanelState[] = [];
this.stateManager.forEach((item) => {
stateList.push(item);
......@@ -104,17 +95,9 @@ export class DrawingPanel {
* 恢复某个画面
* @param {PanelState} state
*/
public restoreCanvas(state: PanelState): boolean {
public restoreCanvas(state?: PanelState): boolean {
this.resetCanvas();
if (!state) {
return false;
}
const ctx = this.canvas.getContext('2d');
const pic = new Image();
pic.src = state.data.toString();
pic.onload = () => {
ctx.drawImage(pic, 0, 0);
};
this.stateManager.restore(state);
return true;
}
......@@ -182,12 +165,30 @@ export class DrawingPanel {
this.options = options;
}
/**
* 初始画板设置
* @param options
* @return {any}
*/
private initOptions(options) {
// 准备options
options = options || <DrawingPanelOptions>{};
for (let key in DrawingPanel.defaultOptions) {
options[key] = options[key] || DrawingPanel.defaultOptions[key];
}
for (let key in options.style) {
options.style[key] = options.style[key] || DrawingPanel.defaultOptions.style[key];
}
return options;
}
/**
* 总体初始化
* @param {string} containerID
* @param {DrawingPanelOptions} options
*/
private init(containerID: string, options: DrawingPanelOptions) {
options = this.initOptions(options);
const container = document.getElementById(containerID);
if (!container) {
logger.error('没拿到容器');
......@@ -196,5 +197,4 @@ export class DrawingPanel {
container.appendChild(this.canvas);
this.initCanvas(options);
}
}
\ No newline at end of file
{"version":3,"file":"drawing-tool-custom.js","sourceRoot":"","sources":["drawing-tool-custom.ts"],"names":[],"mappings":";;AAEA,0CAAqC;AACrC,kFAAwE;AAExE;IAOE,2BAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,gCAAI,GAAJ,UAAK,YAA4D;QAAjE,iBAuCC;QArCC,IAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,OAAO;QACP,MAAM,CAAC,WAAW,GAAG,UAAC,CAAC;YACrB,gBAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC1C,IAAM,SAAS,GAAG,KAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC1C,IAAI,KAAI,CAAC,OAAO,EAAE;gBAChB,OAAO;aACR;YACD,KAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,OAAO;YACP,IAAM,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC;YACxC,IAAM,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC;YACvC,MAAM;YACN,GAAG,CAAC,SAAS,EAAE,CAAC;YAChB,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACjB,YAAY;YACZ,IAAI,KAAK,GAAU,EAAC,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,EAAC,CAAC,GAAA,EAAE,CAAC,GAAA,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAC,CAAC;YACjE,YAAY;YACZ,MAAM,CAAC,WAAW,GAAG,UAAA,CAAC;gBACpB,IAAM,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC;gBACxC,IAAM,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC;gBACvC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACjB,GAAG,CAAC,MAAM,EAAE,CAAC;gBACb,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,EAAC,CAAC,GAAA,EAAE,CAAC,GAAA,EAAC,CAAC,CAAC;YACjC,CAAC,CAAC;YACF,MAAM,CAAC,SAAS,GAAG,UAAA,CAAC;gBAClB,OAAO;gBACP,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC;gBAC1B,IAAI,YAAY,EAAE;oBAChB,KAAK,CAAC,EAAE,GAAG,iBAAiB,CAAC,GAAG,GAAG,iBAAiB,CAAC,OAAO,CAAC;oBAC7D,iBAAiB,CAAC,OAAO,EAAE,CAAC;oBAC5B,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;oBACrB,YAAY,CAAC,KAAK,EAAE,IAAI,gCAAU,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;iBACxD;YACH,CAAC,CAAC;QACJ,CAAC,CAAA;IACH,CAAC;IAED,gCAAI,GAAJ;QACE,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC;IACjC,CAAC;IApDM,yBAAO,GAAW,CAAC,CAAC;IACpB,qBAAG,GAAG,QAAQ,CAAC;IAoDxB,wBAAC;CAAA,AAxDD,IAwDC;AAxDY,8CAAiB"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var logger_1 = require("../utils/logger");
var panel_state_manager_1 = require("../panel-state-manager/panel-state-manager");
var logger_1 = require("../../utils/logger");
var panel_state_manager_1 = require("../../panel-state-manager/panel-state-manager");
var message_1 = require("../../utils/message");
/**
* 画图工具的实现
* 自由画图,即任意点画图的实现
*/
var DrawingToolCustom = /** @class */ (function () {
function DrawingToolCustom(canvas) {
this.canvas = canvas;
......@@ -9,9 +14,14 @@ var DrawingToolCustom = /** @class */ (function () {
}
DrawingToolCustom.prototype.init = function (onDrawingEnd) {
var _this = this;
var ctx = this.canvas.getContext('2d');
var canvas = this.canvas;
// 监听事件
if (!canvas) {
logger_1.default.error(DrawingToolCustom.name, '初始化失败,没有canvas');
message_1.Message.error('画图工具初始化失败');
return;
}
var ctx = canvas.getContext('2d');
// 鼠标按下即开始画
canvas.onmousedown = function (e) {
logger_1.default.info(DrawingToolCustom.tag, '开始画');
var lastState = _this.canvas.toDataURL();
......
{"version":3,"file":"drawing-tool-custom.js","sourceRoot":"","sources":["drawing-tool-custom.ts"],"names":[],"mappings":";;AAEA,6CAAwC;AACxC,qFAA2E;AAC3E,+CAA8C;AAE9C;;;GAGG;AACH;IAQE,2BAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,gCAAI,GAAJ,UAAK,YAA4D;QAAjE,iBA2CC;QA1CC,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,MAAM,EAAE;YACX,gBAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;YACvD,iBAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC3B,OAAO;SACR;QACD,IAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACpC,WAAW;QACX,MAAM,CAAC,WAAW,GAAG,UAAC,CAAC;YACrB,gBAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC1C,IAAM,SA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E,CAAC;oBAC5B,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;oBACrB,YAAY,CAAC,KAAK,EAAE,IAAI,gCAAU,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;iBACxD;YACH,CAAC,CAAC;QACJ,CAAC,CAAA;IACH,CAAC;IAED,gCAAI,GAAJ;QACE,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC;IACjC,CAAC;IA1DM,yBAAO,GAAW,CAAC,CAAC;IACpB,qBAAG,GAAG,QAAQ,CAAC;IA0DxB,wBAAC;CAAA,AA7DD,IA6DC;AA7DY,8CAAiB"}
\ No newline at end of file
import { IDrawingTool } from './i-drawing-tool';
import { Shape } from '../shape/shape';
import logger from '../utils/logger';
import { PanelState } from '../panel-state-manager/panel-state-manager';
import { Shape } from '../../shape/shape';
import logger from '../../utils/logger';
import { PanelState } from '../../panel-state-manager/panel-state-manager';
import { Message } from '../../utils/message';
/**
* 画图工具的实现
* 自由画图,即任意点画图的实现
*/
export class DrawingToolCustom implements IDrawingTool{
drawing: boolean;
static counter: number = 0;
static tag = 'custom';
drawing: boolean;
canvas: HTMLCanvasElement;
constructor(canvas: HTMLCanvasElement) {
......@@ -16,10 +22,14 @@ export class DrawingToolCustom implements IDrawingTool{
}
init(onDrawingEnd?: (shape: Shape, lastState: PanelState) => void): void {
const ctx = this.canvas.getContext('2d');
const canvas = this.canvas;
// 监听事件
if (!canvas) {
logger.error(DrawingToolCustom.name, '初始化失败,没有canvas');
Message.error('画图工具初始化失败');
return;
}
const ctx = canvas.getContext('2d');
// 鼠标按下即开始画
canvas.onmousedown = (e) => {
logger.info(DrawingToolCustom.tag, '开始画');
const lastState = this.canvas.toDataURL();
......
import { Shape } from '../shape/shape';
import { PanelState } from '../panel-state-manager/panel-state-manager';
import { Shape } from '../../shape/shape';
import { PanelState } from '../../panel-state-manager/panel-state-manager';
/**
* 画板鼠标画图的接口
*/
export interface IDrawingTool {
canvas: HTMLCanvasElement;
drawing: boolean;
/**
* 初始化工具
* @param {(shape: Shape, lastState: PanelState) => void} onDrawingEnd 可提供的每次绘画结束的回调
*/
init(onDrawingEnd?: (shape: Shape, lastState: PanelState) => void): void;
/**
......
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var drawing_panel_1 = require("./drawing-panel");
var drawing_tool_custom_1 = require("./drawing-tool-custom");
var drawing_tool_custom_1 = require("./drawing-tool/drawing-tool-custom");
var panel_state_manager_1 = require("../panel-state-manager/panel-state-manager");
var PanelLoader = /** @class */ (function () {
function PanelLoader() {
}
PanelLoader.createPanel = function () {
var panel = new drawing_panel_1.DrawingPanel(this.CONTAINER_ID, this.config);
panel.setDrawingTool(new this.dependendyMap.IDrawingTool(panel.getCanvas()));
panel.setStateManager(new this.dependendyMap.IPanelStateManager());
panel.setDrawingTool(new this.dependencyMap.IDrawingTool(panel.getCanvas()));
panel.setStateManager(new this.dependencyMap.IPanelStateManager(panel.getCanvas()));
return panel;
};
PanelLoader.dependendyMap = {
// 画板所需的依赖
PanelLoader.dependencyMap = {
IDrawingTool: drawing_tool_custom_1.DrawingToolCustom,
IPanelStateManager: panel_state_manager_1.PanelStateManagerByLocalStorage
};
......
{"version":3,"file":"panel-loader.js","sourceRoot":"","sources":["panel-loader.ts"],"names":[],"mappings":";;AAAA,iDAA+C;AAC/C,6DAA0D;AAC1D,kFAA6F;AAE7F;IAAA;IAcA,CAAC;IANQ,uBAAW,GAAlB;QACE,IAAI,KAAK,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7D,KAAK,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAC7E,KAAK,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACnE,OAAO,KAAK,CAAC;IACf,CAAC;IAZM,yBAAa,GAAG;QACrB,YAAY,EAAE,uCAAiB;QAC/B,kBAAkB,EAAE,qDAA+B;KACpD,CAAC;IACK,wBAAY,GAAG,WAAW,CAAC;IAC3B,kBAAM,GAAG,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC,CAAC;IAQ5C,kBAAC;CAAA,AAdD,IAcC;AAdY,kCAAW"}
\ No newline at end of file
{"version":3,"file":"panel-loader.js","sourceRoot":"","sources":["panel-loader.ts"],"names":[],"mappings":";;AAAA,iDAA+C;AAC/C,0EAAuE;AACvE,kFAA6F;AAE7F;IAAA;IAgBA,CAAC;IANQ,uBAAW,GAAlB;QACE,IAAI,KAAK,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7D,KAAK,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAC7E,KAAK,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QACpF,OAAO,KAAK,CAAC;IACf,CAAC;IAbD,UAAU;IACH,yBAAa,GAAG;QACrB,YAAY,EAAE,uCAAiB;QAC/B,kBAAkB,EAAE,qDAA+B;KACpD,CAAC;IACK,wBAAY,GAAG,WAAW,CAAC;IAC3B,kBAAM,GAAG,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC,CAAC;IAQ5C,kBAAC;CAAA,AAhBD,IAgBC;AAhBY,kCAAW"}
\ No newline at end of file
import { DrawingPanel } from './drawing-panel';
import { DrawingToolCustom } from './drawing-tool-custom';
import { DrawingToolCustom } from './drawing-tool/drawing-tool-custom';
import { PanelStateManagerByLocalStorage } from '../panel-state-manager/panel-state-manager';
export class PanelLoader {
static dependendyMap = {
// 画板所需的依赖
static dependencyMap = {
IDrawingTool: DrawingToolCustom,
IPanelStateManager: PanelStateManagerByLocalStorage
};
......@@ -12,8 +14,8 @@ export class PanelLoader {
static createPanel(): DrawingPanel {
let panel = new DrawingPanel(this.CONTAINER_ID, this.config);
panel.setDrawingTool(new this.dependendyMap.IDrawingTool(panel.getCanvas()));
panel.setStateManager(new this.dependendyMap.IPanelStateManager());
panel.setDrawingTool(new this.dependencyMap.IDrawingTool(panel.getCanvas()));
panel.setStateManager(new this.dependencyMap.IPanelStateManager(panel.getCanvas()));
return panel;
}
}
\ No newline at end of file
var dependencyPool = {};
function propertyInject(dependency) {
return function (target, propertyName) {
var constructor = dependencyPool[dependency];
if (!constructor) {
throw new Error("\u4F9D\u8D56" + dependency + "\u672A\u6CE8\u518C");
}
return new constructor();
};
}
function bind(name, constructor) {
}
//# sourceMappingURL=ioc.js.map
\ No newline at end of file
{"version":3,"file":"ioc.js","sourceRoot":"","sources":["ioc.ts"],"names":[],"mappings":"AAAA,IAAI,cAAc,GAA0C,EAAE,CAAC;AAE/D,SAAS,cAAc,CAAC,UAAU;IAChC,OAAO,UAAU,MAAW,EAAE,YAAoB;QAChD,IAAI,WAAW,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,iBAAK,UAAU,uBAAK,CAAC,CAAC;SACvC;QACD,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC,CAAA;AACH,CAAC;AAED,SAAS,IAAI,CAAC,IAAY,EAAE,WAAgC;AAE5D,CAAC"}
\ No newline at end of file
var dependencyPool: {[name: string]: FunctionConstructor} = {};
function propertyInject(dependency) {
return function (target: any, propertyName: string) {
let constructor = dependencyPool[dependency];
if (!constructor) {
throw new Error(`依赖${dependency}未注册`);
}
return new constructor();
}
}
function bind(name: string, constructor: FunctionConstructor) {
}
\ No newline at end of file
......@@ -4,7 +4,6 @@ var $ = require("jquery");
var logger_1 = require("./utils/logger");
var message_1 = require("./utils/message");
var panel_loader_1 = require("./drawing/panel-loader");
var tool;
var panel;
var states = [];
var SAVE_BTN_ID = 'save-btn';
......@@ -16,7 +15,7 @@ window.onload = function (e) {
// 初始列表
states = panel.getPanelStates();
refreshList();
// 绑定按钮事件
//=== 绑定按钮事件 ===//
var saveBtn = document.getElementById(SAVE_BTN_ID);
if (saveBtn) {
saveBtn.onclick = handleSave;
......@@ -36,9 +35,9 @@ var handleNew = function () {
};
var refreshList = function () {
logger_1.default.info(TAG, 'states', states);
var list = $('#' + STATE_LIST_ID);
list.empty();
logger_1.default.info(TAG, 'list', list);
var stateList = $('#' + STATE_LIST_ID);
stateList.empty();
logger_1.default.info(TAG, 'list', stateList);
var _loop_1 = function (state) {
var li = $('<li></li>');
li.html(state.id);
......@@ -47,7 +46,7 @@ var refreshList = function () {
panel.restoreCanvas(state);
});
li.addClass('state-item');
list.append(li);
stateList.append(li);
};
for (var _i = 0, states_1 = states; _i < states_1.length; _i++) {
var state = states_1[_i];
......
{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";;AAEA,0BAA4B;AAC5B,yCAAoC;AAEpC,2CAA0C;AAC1C,uDAAqD;AAErD,IAAI,IAAI,CAAC;AACT,IAAI,KAAmB,CAAC;AACxB,IAAI,MAAM,GAAiB,EAAE,CAAC;AAE9B,IAAM,WAAW,GAAG,UAAU,CAAC;AAC/B,IAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,IAAM,aAAa,GAAG,YAAY,CAAC;AACnC,IAAM,GAAG,GAAG,SAAS,CAAC;AAEtB,MAAM,CAAC,MAAM,GAAG,UAAC,CAAC;IAChB,KAAK,GAAG,0BAAW,CAAC,WAAW,EAAE,CAAC;IAClC,OAAO;IACP,MAAM,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC;IAChC,WAAW,EAAE,CAAC;IAEd,SAAS;IACT,IAAI,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACnD,IAAI,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AAS,GAAG,CAAC,CAAC,GAAG,GAAG,aAAa,CAAC,CAAC;IACzC,SAAS,CAAC,KAAK,EAAE,CAAC;IAClB,gBAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;4BAC3B,KAAK;QACZ,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC;QACxB,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,gBAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC9B,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,CAAC;YACf,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC1B,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IATD,KAAkB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM;QAAnB,IAAI,KAAK,eAAA;gBAAL,KAAK;KASb;AACH,CAAC,CAAC"}
\ No newline at end of file
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册