Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
moved test page into demo folder
Browse files Browse the repository at this point in the history
  • Loading branch information
G3z committed Nov 28, 2011
1 parent 723ec8e commit a377df2
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 14 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

File renamed without changes.
57 changes: 50 additions & 7 deletions build/PixelMixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down Expand Up @@ -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;
Expand All @@ -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;

})();

Expand Down Expand Up @@ -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");
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions index.html → demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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"
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
4 changes: 2 additions & 2 deletions src/PixelMixer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
###
Expand Down Expand Up @@ -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")
Expand Down
16 changes: 15 additions & 1 deletion src/buttons/PMButton.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###
Basic Button Class
###
class Button
class PMButton
construcotr:(@width,@height,@icon,@target,@action)->
@domElement = $("<div/>")
if @width? and not @height?
Expand All @@ -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)

0 comments on commit a377df2

Please sign in to comment.