Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

moved test page into demo folder

  • Loading branch information...
commit a377df2541e5eb4eb3720e418b35b8aa2e92640e 1 parent 723ec8e
@G3z authored
View
1  .gitignore
@@ -1 +0,0 @@
-node_modules
View
0  css/PixelMixer.css → build/PixelMixer.css
File renamed without changes
View
57 build/PixelMixer.js
@@ -3,8 +3,10 @@
Editable Image with Overlay
*/
-var Button, PMCanvas, PMEditableImage, PMLayers, PMPixel, PMTool, PMToolBar, PMWindow, PixelMixer,
- __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+var PMButton, PMCanvas, PMEditableImage, PMLayers, PMPixel, PMTool, PMToolBar, PMWindow, PixelMixer, ZoomIn,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = Object.prototype.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
PMEditableImage = (function() {
@@ -345,11 +347,13 @@ PMTool = (function() {
Basic Button Class
*/
-Button = (function() {
+PMButton = (function() {
- function Button() {}
+ function PMButton() {
+ this.trigger = __bind(this.trigger, this);
+ }
- Button.prototype.construcotr = function(width, height, icon, target, action) {
+ PMButton.prototype.construcotr = function(width, height, icon, target, action) {
this.width = width;
this.height = height;
this.icon = icon;
@@ -367,7 +371,46 @@ Button = (function() {
}
};
- return Button;
+ PMButton.prototype.trigger = function() {
+ var args, method;
+ if ((this.action != null) && (this.target != null)) {
+ if (this.action.action != null) method = this.action.action;
+ if (this.action.args != null) {
+ if ($.type(this.action.args) === "array") {
+ args = this.action.args;
+ } else {
+ args = [this.action.args];
+ }
+ }
+ }
+ if ((this.target != null) && (method != null) && (args != null)) {
+ return this.target.apply(method, args);
+ }
+ };
+
+ return PMButton;
+
+})();
+
+/* --------------------------------------------
+ Begin ZoomIn.coffee
+--------------------------------------------
+*/
+
+ZoomIn = (function() {
+
+ __extends(ZoomIn, PMTool);
+
+ function ZoomIn(pixMix) {
+ var args;
+ args = {
+ action: "add",
+ args: 1
+ };
+ ZoomIn.__super__.constructor.call(this, "", pixMix.zoom, args);
+ }
+
+ return ZoomIn;
})();
@@ -459,7 +502,7 @@ PixelMixer = (function() {
this.prepareImgs(this.scope);
}
this.toolBar = new PMToolBar(this);
- this.toolBar.add(new ZoomIn(this["this"]));
+ this.toolBar.add(new ZoomIn(this));
this.loaderElm = document.createElement("canvas");
this.loaderElm.setAttribute("width", "1000");
this.loaderElm.setAttribute("height", "1000");
View
0  404.html → demo/404.html
File renamed without changes
View
0  apple-touch-icon-114x114-precomposed.png → demo/apple-touch-icon-114x114-precomposed.png
File renamed without changes
View
0  apple-touch-icon-57x57-precomposed.png → demo/apple-touch-icon-57x57-precomposed.png
File renamed without changes
View
0  apple-touch-icon-72x72-precomposed.png → demo/apple-touch-icon-72x72-precomposed.png
File renamed without changes
View
0  apple-touch-icon-precomposed.png → demo/apple-touch-icon-precomposed.png
File renamed without changes
View
0  apple-touch-icon.png → demo/apple-touch-icon.png
File renamed without changes
View
0  css/style.css → demo/css/style.css
File renamed without changes
View
0  favicon.ico → demo/favicon.ico
File renamed without changes
View
6 index.html → demo/index.html
@@ -15,7 +15,7 @@
<link rel="stylesheet" href="css/style.css">
<!--<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">-->
- <link rel="stylesheet" href="css/PixelMixer.css">
+ <link rel="stylesheet" href="../build/PixelMixer.css">
</head>
<body>
@@ -35,8 +35,8 @@
</div>
</div>
</div>
- <script src="build/libs/jquery.js" type="text/javascript" charset="utf-8"></script>
- <script src="build/PixelMixer.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../build/libs/jquery.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../build/PixelMixer.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
pixmix = new PixelMixer({
container:"#container"
View
0  testImgs/G3z.gif → demo/testImgs/G3z.gif
File renamed without changes
View
0  testImgs/Me.jpg → demo/testImgs/Me.jpg
File renamed without changes
View
0  testImgs/avatar 8 bit.png → demo/testImgs/avatar 8 bit.png
File renamed without changes
View
0  testImgs/gruppi12.gif → demo/testImgs/gruppi12.gif
File renamed without changes
View
4 src/PixelMixer.coffee
@@ -13,7 +13,7 @@
#@codekit-prepend buttons/PMButton.coffee
## Standard Tools
#@codekit-prepend tools/PMTool.coffee
-#@codekit-prepend tools/*
+#@codekit-prepend tools/ZoomIn.coffee
class PixelMixer
###
@@ -71,7 +71,7 @@ class PixelMixer
@prepareImgs(@scope)
@toolBar = new PMToolBar(this)
- @toolBar.add(new ZoomIn(@this))
+ @toolBar.add(new ZoomIn(this))
@loaderElm = document.createElement("canvas")
@loaderElm.setAttribute("width","1000")
View
16 src/buttons/PMButton.coffee
@@ -1,7 +1,7 @@
###
Basic Button Class
###
-class Button
+class PMButton
construcotr:(@width,@height,@icon,@target,@action)->
@domElement = $("<div/>")
if @width? and not @height?
@@ -12,3 +12,17 @@ class Button
@domElement = $("<div/>").attr("style","width:#{@width}px;height:#{@height}px;")
else
@domElement = $("<div/>").attr("style","width:20px;height:20px;")
+
+
+
+ trigger:()=>
+ if @action? and @target?
+ if @action.action?
+ method = @action.action
+ if @action.args?
+ if $.type(@action.args) == "array"
+ args = @action.args
+ else
+ args = [@action.args]
+ if @target? and method? and args?
+ @target.apply(method,args)
Please sign in to comment.
Something went wrong with that request. Please try again.