Skip to content

Commit

Permalink
pop out image nodes (just canvas) closes #97
Browse files Browse the repository at this point in the history
  • Loading branch information
forresto committed Sep 28, 2012
1 parent bf2ca77 commit af300ce
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 42 deletions.
2 changes: 1 addition & 1 deletion build/meemoo-iframework.min.js

Large diffs are not rendered by default.

62 changes: 35 additions & 27 deletions icons/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
"code": 128279,
"src": "entypo"
},
{
"uid": "744a71fe4b5ab7c4f4b7cd598e9bf75a",
"orig_css": "window",
"orig_code": 59214,
"css": "window",
"code": 59214,
"src": "entypo"
},
{
"uid": "d83b7429002f7b0b206c8d550034212b",
"orig_css": "install",
Expand All @@ -17,6 +25,14 @@
"code": 59256,
"src": "entypo"
},
{
"uid": "6a12c2b74456ea21cc984e11dec227a1",
"orig_css": "globe",
"orig_code": 127757,
"css": "globe-1",
"code": 127757,
"src": "entypo"
},
{
"uid": "9ea7cce5e08e5ac2c225fabf2e6dc353",
"orig_css": "bag",
Expand All @@ -26,20 +42,12 @@
"src": "entypo"
},
{
"uid": "744a71fe4b5ab7c4f4b7cd598e9bf75a",
"orig_css": "window",
"orig_code": 59214,
"css": "window",
"code": 59214,
"src": "entypo"
},
{
"uid": "6a12c2b74456ea21cc984e11dec227a1",
"orig_css": "globe",
"orig_code": 127757,
"css": "globe-1",
"code": 127757,
"src": "entypo"
"uid": "12f4ece88e46abd864e40b35e05b11cd",
"orig_css": "ok",
"orig_code": 10003,
"css": "ok",
"code": 10003,
"src": "fontawesome"
},
{
"uid": "5211af474d3a9848f67f945e2ccaf143",
Expand Down Expand Up @@ -137,14 +145,6 @@
"code": 10227,
"src": "fontawesome"
},
{
"uid": "12f4ece88e46abd864e40b35e05b11cd",
"orig_css": "ok",
"orig_code": 10003,
"css": "ok",
"code": 10003,
"src": "fontawesome"
},
{
"uid": "9ebd01466c6cb73106d26dbacef5f84a",
"orig_css": "doc",
Expand All @@ -153,6 +153,14 @@
"code": 59184,
"src": "iconic"
},
{
"uid": "09b87624e9d9a79109429ea81ed0d02d",
"orig_css": "split",
"orig_code": 9095,
"css": "split",
"code": 9095,
"src": "iconic"
},
{
"uid": "2npqajwqwxy3kbchcht7tyupllg270hb",
"orig_css": "scissors",
Expand Down Expand Up @@ -194,11 +202,11 @@
"src": "brandico"
},
{
"uid": "09b87624e9d9a79109429ea81ed0d02d",
"orig_css": "split",
"orig_code": 9095,
"css": "split",
"code": 9095,
"uid": "971be54c1452e2558926d36786e6b1d7",
"orig_css": "popup",
"orig_code": 59212,
"css": "popup",
"code": 59212,
"src": "iconic"
}
]
Expand Down
Binary file modified icons/font/meemoo-icons.eot
Binary file not shown.
4 changes: 3 additions & 1 deletion icons/font/meemoo-icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/font/meemoo-icons.ttf
Binary file not shown.
Binary file modified icons/font/meemoo-icons.woff
Binary file not shown.
1 change: 1 addition & 0 deletions iframework.css
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ div.panel {
.icon-doc:before { content: '\e730'; } /* '' */
.icon-login:before { content: '\e740'; } /* '' */
.icon-logout:before { content: '\e741'; } /* '' */
.icon-popup:before { content: '\e74c'; } /* '' */
.icon-window:before { content: '\e74e'; } /* '' */
.icon-down-open:before { content: '\e75c'; } /* '' */
.icon-left-open:before { content: '\e75d'; } /* '' */
Expand Down
5 changes: 3 additions & 2 deletions src/node-box-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $(function(){
if (!this.Native){
if (Iframework.NativeNodes.hasOwnProperty(this.model.lazyLoadType)) {
this.Native = new Iframework.NativeNodes[this.model.lazyLoadType]({model:this.model});
this.$(".inner").append( this.Native.initialize().$el );
this.$(".inner").append( this.Native.$el );
// Check if all modules are loaded
this.model.loaded = true;
this.model.graph.checkLoaded();
Expand Down Expand Up @@ -269,7 +269,8 @@ $(function(){
this.$el.remove();
},
refresh: function () {

},
popout: function () {
}//,
// selected: function(){
// console.log("sel", this.model);
Expand Down
90 changes: 79 additions & 11 deletions src/nodes/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@ $(function(){
var template =
// '<canvas id="canvas-<%= id %>" class="canvas" width="500" height="500" style="max-width:100%;" />'+
'<div class="info" />';
// '<input type="checkbox" checked="checked" class="showpreview" id="showpreview-<%= id %>" />'+
// '<label for="showpreview-<%= id %>">show preview</label>';

Iframework.NativeNodes["image"] = Iframework.NodeBoxNativeView.extend({

template: _.template(template),
canvas: null,
context: null,
// events: {
// "click .showpreview": "togglePreview"
// },
initializeCategory: function() {
// Add popout button to box
var self = this;
this.model.view.$("button.remove")
.after(
$('<button type="button" class="popout">popout</button>')
.button({ icons: { primary: "icon-popup" }, text: false })
.click(function(){
self.popout();
})
);
// Add refresh event
// this.events["click .refresh"] = "refresh";

this.canvas = document.createElement("canvas");
this.canvas.width = 500;
this.canvas.height = 500;
Expand All @@ -43,13 +51,73 @@ $(function(){
},
_smoothing: true,
inputsmoothing: function (s) {
if (this._smoothing !== s) {
this._smoothing = s;
// HACK browser-specific stuff
this.context.webkitImageSmoothingEnabled = s;
this.context.mozImageSmoothingEnabled = s;
this._smoothing = s;
// HACK browser-specific stuff
this.context.webkitImageSmoothingEnabled = s;
this.context.mozImageSmoothingEnabled = s;
},
popout: function() {
if (this.w) {
// Toggle
this.popin();
return false;
}

// Cache local canvas
this.localCanvas = this.canvas;
this.localContext = this.context;
$(this.localCanvas).hide();

// Open new window to about:blank
this.w = window.open("", "meemooRemoteWindow", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no");
var self = this;
this.w.addEventListener("unload", function(){
self.popin();
});

// Popin other
if (Iframework.popoutModule && Iframework.popoutModule !== this) {
Iframework.popoutModule.popin();
}
}
Iframework.popoutModule = this;
// TODO: fade out other canvas?
this.w.document.body.innerHTML = "";

// Make new canvas
this.canvas = this.w.document.createElement("canvas");
this.canvas.width = this.localCanvas.width;
this.canvas.height = this.localCanvas.height;
this.context = this.canvas.getContext('2d');
this.w.document.body.appendChild(this.canvas);

// Full-screen styling
this.w.document.body.style.backgroundColor="black";
this.w.document.body.style.margin="0px";
this.w.document.body.style.padding="0px";
this.canvas.style.position="absolute";
this.canvas.style.top="0px";
this.canvas.style.left="0px";
this.canvas.style.width="100%";
this.canvas.style.height="100%";

// Smoothing on new canvas
this.inputsmoothing(this._smoothing);

return false;
},
popin: function() {
if (this.w) {
this.w = null;
}
this.canvas = this.localCanvas;
this.context = this.localContext;
$(this.canvas).show();

// Smoothing on canvas (only matters if it changed while out)
this.inputsmoothing(this._smoothing);

return false;
}
// showResizer: function(translateX, translateY, scale, rotate){
// if (!this.resizer) {
// this.resizer = $('<div class="resizer">');
Expand Down

0 comments on commit af300ce

Please sign in to comment.