Skip to content

Commit

Permalink
use global typescript compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Mar 6, 2017
1 parent 0c374e3 commit 94f4964
Show file tree
Hide file tree
Showing 173 changed files with 49,901 additions and 46,126 deletions.
92,802 changes: 47,993 additions & 44,809 deletions index.js

Large diffs are not rendered by default.

25 changes: 16 additions & 9 deletions js/application.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path");
var TWEEN = require("tween.js");
var Events = require("./events");
Expand All @@ -28,12 +34,13 @@ var interaction_service_1 = require("./interaction-request/interaction-service")
var Application = (function (_super) {
__extends(Application, _super);
function Application(name) {
_super.call(this);
this._name = name;
this.parseURLParams();
var _this = _super.call(this) || this;
_this._name = name;
_this.parseURLParams();
if (!Application.instance) {
Application.instance = this;
Application.instance = _this;
}
return _this;
}
Object.defineProperty(Application.prototype, "name", {
/**
Expand Down
1 change: 0 additions & 1 deletion js/assets.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference path="../typings/globals/node/index.d.ts" />
/// <reference path="../typings/globals/eventemitter3/index.d.ts" />
/// <reference path="../typings/globals/whatwg-fetch/index.d.ts" />
import "whatwg-fetch";
import { Emitter } from "./emitter";
export declare class Image {
Expand Down
36 changes: 21 additions & 15 deletions js/assets.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
/// <reference path="../typings/globals/node/index.d.ts"/>
/// <reference path="../typings/globals/eventemitter3/index.d.ts"/>
/// <reference path="../typings/globals/whatwg-fetch/index.d.ts"/>
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
require("whatwg-fetch");
var path = require("path");
var Events = require("./events");
Expand Down Expand Up @@ -40,6 +45,7 @@ function load(url, type) {
* @enum AssetType
* 资源类型。
*/
var AssetType;
(function (AssetType) {
/**
* @property {number} [AUDIO=1]
Expand Down Expand Up @@ -71,8 +77,7 @@ function load(url, type) {
* 文本资源。
*/
AssetType[AssetType["TEXT"] = 6] = "TEXT";
})(exports.AssetType || (exports.AssetType = {}));
var AssetType = exports.AssetType;
})(AssetType = exports.AssetType || (exports.AssetType = {}));
;
/**
* @class AssetManager
Expand Down Expand Up @@ -237,21 +242,22 @@ exports.AssetItem = AssetItem;
var AssetGroup = (function (_super) {
__extends(AssetGroup, _super);
function AssetGroup(items, onProgress) {
_super.call(this);
this.event = {
var _this = _super.call(this) || this;
_this.event = {
total: 0,
loaded: 0,
type: Events.PROGRESS
};
var i = 0;
var n = items.length;
this.loaded = 0;
this.total = items.length;
this.event.total = this.total;
_this.loaded = 0;
_this.total = items.length;
_this.event.total = _this.total;
if (onProgress) {
this.onProgress(onProgress);
_this.onProgress(onProgress);
}
items.forEach(this.loadOne.bind(this));
items.forEach(_this.loadOne.bind(_this));
return _this;
}
/**
* 注册加载进度的回调函数。
Expand Down
3 changes: 2 additions & 1 deletion js/behaviors/behavior.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Events = require("../events");
var inputEventAdapter = require("../input-event-adapter");
/**
Expand Down Expand Up @@ -146,7 +147,7 @@ var BehaviorFactory = (function () {
var create = BehaviorFactory.creators[type];
return create ? create(widget, options) : null;
};
BehaviorFactory.creators = {};
return BehaviorFactory;
}());
BehaviorFactory.creators = {};
exports.BehaviorFactory = BehaviorFactory;
20 changes: 13 additions & 7 deletions js/behaviors/draggable.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Events = require("../events");
var key_event_1 = require("../key-event");
var behavior_1 = require("./behavior");
Expand All @@ -14,7 +20,7 @@ var behavior_1 = require("./behavior");
var Draggable = (function (_super) {
__extends(Draggable, _super);
function Draggable(widget, options) {
_super.call(this, Draggable.TYPE, widget, options);
return _super.call(this, Draggable.TYPE, widget, options) || this;
}
Draggable.prototype.init = function (options) {
this.onDrawDragging = function (evt) {
Expand Down Expand Up @@ -73,9 +79,9 @@ var Draggable = (function (_super) {
}
};
;
Draggable.TYPE = "draggable";
return Draggable;
}(behavior_1.Behavior));
Draggable.TYPE = "draggable";
exports.Draggable = Draggable;
behavior_1.BehaviorFactory.register(Draggable.TYPE, function (widget, options) {
return new Draggable(widget, options);
Expand Down
20 changes: 13 additions & 7 deletions js/behaviors/droppable.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Events = require("../events");
var key_event_1 = require("../key-event");
var behavior_1 = require("./behavior");
Expand All @@ -14,7 +20,7 @@ var behavior_1 = require("./behavior");
var Droppable = (function (_super) {
__extends(Droppable, _super);
function Droppable(widget, options) {
_super.call(this, Droppable.TYPE, widget, options);
return _super.call(this, Droppable.TYPE, widget, options) || this;
}
Droppable.prototype.onPointerEnter = function (evt) {
if (Events.DragEvent.isDragging) {
Expand Down Expand Up @@ -52,9 +58,9 @@ var Droppable = (function (_super) {
}
};
;
Droppable.TYPE = "droppable";
return Droppable;
}(behavior_1.Behavior));
Droppable.TYPE = "droppable";
exports.Droppable = Droppable;
behavior_1.BehaviorFactory.register(Droppable.TYPE, function (widget, options) {
return new Droppable(widget, options);
Expand Down
29 changes: 18 additions & 11 deletions js/behaviors/movable.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Events = require("../events");
var key_event_1 = require("../key-event");
var behavior_1 = require("./behavior");
Expand Down Expand Up @@ -36,11 +42,12 @@ exports.MovableOptions = MovableOptions;
var Movable = (function (_super) {
__extends(Movable, _super);
function Movable(widget, options) {
_super.call(this, Movable.TYPE, widget, options);
this.movingEvent = { type: Events.MOVING };
this.moveEndEvent = { type: Events.MOVE_END };
this.moveBeginEvent = { type: Events.MOVE_BEGIN };
this.moveCancelEvent = { type: Events.MOVE_CANCEL };
var _this = _super.call(this, Movable.TYPE, widget, options) || this;
_this.movingEvent = { type: Events.MOVING };
_this.moveEndEvent = { type: Events.MOVE_END };
_this.moveBeginEvent = { type: Events.MOVE_BEGIN };
_this.moveCancelEvent = { type: Events.MOVE_CANCEL };
return _this;
}
Movable.prototype.init = function (options) {
this.options = new MovableOptions(options);
Expand Down Expand Up @@ -120,9 +127,9 @@ var Movable = (function (_super) {
}
};
;
Movable.TYPE = "movable";
return Movable;
}(behavior_1.Behavior));
Movable.TYPE = "movable";
exports.Movable = Movable;
behavior_1.BehaviorFactory.register(Movable.TYPE, function (widget, options) {
return new Movable(widget, options);
Expand Down
2 changes: 1 addition & 1 deletion js/behaviors/resizable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export declare class Resizable extends Behavior {
protected onKeyDownGlobal(evt: CustomEvent): void;
protected onPointerDown(evt: Events.PointerEvent): void;
protected onPointerUp(evt: Events.PointerEvent): void;
protected testPointerPosition(evt: Events.PointerEvent): string;
protected testPointerPosition(evt: Events.PointerEvent): "w" | "nw" | "n" | "ne" | "e" | "sw" | "s" | "se";
protected onPointerMove(evt: Events.PointerEvent): void;
protected x: number;
protected y: number;
Expand Down
31 changes: 19 additions & 12 deletions js/behaviors/resizable.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var point_1 = require("../point");
var Events = require("../events");
var key_event_1 = require("../key-event");
Expand Down Expand Up @@ -36,12 +42,13 @@ exports.ResizableOptions = ResizableOptions;
var Resizable = (function (_super) {
__extends(Resizable, _super);
function Resizable(widget, options, type) {
_super.call(this, type || Resizable.TYPE, widget, options);
this.resizingEvent = { type: Events.RESIZING };
this.resizeEndEvent = { type: Events.RESIZE_END };
this.resizeBeginEvent = { type: Events.RESIZE_BEGIN };
this.resizeCancelEvent = { type: Events.RESIZE_CANCEL };
this.border = 5;
var _this = _super.call(this, type || Resizable.TYPE, widget, options) || this;
_this.resizingEvent = { type: Events.RESIZING };
_this.resizeEndEvent = { type: Events.RESIZE_END };
_this.resizeBeginEvent = { type: Events.RESIZE_BEGIN };
_this.resizeCancelEvent = { type: Events.RESIZE_CANCEL };
_this.border = 5;
return _this;
}
Resizable.prototype.init = function (options) {
this.options = new ResizableOptions(options);
Expand Down Expand Up @@ -190,9 +197,9 @@ var Resizable = (function (_super) {
}
}
};
Resizable.TYPE = "resizable";
return Resizable;
}(behavior_1.Behavior));
Resizable.TYPE = "resizable";
exports.Resizable = Resizable;
behavior_1.BehaviorFactory.register(Resizable.TYPE, function (widget, options) {
return new Resizable(widget, options);
Expand Down
39 changes: 23 additions & 16 deletions js/canvas.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var emitter_1 = require("./emitter");
var Events = require("./events");
var event_detail_1 = require("./event-detail");
Expand All @@ -21,30 +27,31 @@ var inputEventAdapter = require("./input-event-adapter");
var Canvas = (function (_super) {
__extends(Canvas, _super);
function Canvas(x, y, w, h, devicePixelRatio, offline) {
_super.call(this);
this._x = x || 0;
this._y = y || 0;
this._w = w || 0;
this._h = h || 0;
this._offline = offline || false;
this._devicePixelRatio = devicePixelRatio || 1;
var me = this;
this.onPointerEvent = function (evt) {
var _this = _super.call(this) || this;
_this._x = x || 0;
_this._y = y || 0;
_this._w = w || 0;
_this._h = h || 0;
_this._offline = offline || false;
_this._devicePixelRatio = devicePixelRatio || 1;
var me = _this;
_this.onPointerEvent = function (evt) {
me.transformXY(evt.detail);
var e = Events.PointerEvent.create(evt.type, evt.detail);
me.dispatchEvent(e);
e.dispose();
};
this.onKeyEvent = function (evt) {
_this.onKeyEvent = function (evt) {
var e = Events.KeyEvent.create(evt.type, evt.detail);
me.dispatchEvent(e);
e.dispose();
};
this.onWheelEvent = function (evt) {
_this.onWheelEvent = function (evt) {
var e = Events.WheelEvent.create(evt.detail);
me.dispatchEvent(e);
e.dispose();
};
return _this;
}
Object.defineProperty(Canvas.prototype, "x", {
/**
Expand Down
Loading

0 comments on commit 94f4964

Please sign in to comment.