0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-12-04 14:04:54 +01:00

New event structure in Popup, shape and wordart popups now behave correctly.

Add copyright notice for wordart font.
This commit is contained in:
Wouter R 2014-01-17 15:10:39 +01:00
parent d634f2e9c3
commit 5eb129d2a2
4 changed files with 30 additions and 27 deletions

View File

@ -1,6 +1,7 @@
Doodle3D uses the following external projects: Doodle3D uses the following external projects:
Garden font - Copyright (c) 2012 So-ghislaine - "Garden is a free font for commercial and personal use." Garden font - Copyright (c) 2012 So-ghislaine - "Garden is a free font for commercial and personal use."
Copse font - Copyright (c) 2010 Dan Rhatigan - SIL Open Font License v1.10
jQuery - Copyright (c) 2005, 2012 jQuery Foundation, Inc. and other contributors - MIT License jQuery - Copyright (c) 2005, 2012 jQuery Foundation, Inc. and other contributors - MIT License
jQuery-cookie - Copyright (c) 2011, Klaus Hartl - MIT or GPLv2 jQuery-cookie - Copyright (c) 2011, Klaus Hartl - MIT or GPLv2
jQuery-coolfieldset - Copyright (c) 2010 Lucky <bogeyman2007@gmail.com> - GPL jQuery-coolfieldset - Copyright (c) 2010 Lucky <bogeyman2007@gmail.com> - GPL

View File

@ -2,15 +2,15 @@ var shapeResolution=3;
var shapePopup; var shapePopup;
function initShapeDialog() { function initShapeDialog() {
$("#btnShapeOk").on("onButtonClick",onShapeOk); shapePopup = new Popup($("#popupShape"), $("#popupMask"));
$("#btnShapeCancel").on("onButtonClick",onShapeCancel); $("#btnShapeOk").on("onButtonClick", shapePopup.commit);
$("#btnShapeCancel").on("onButtonClick", shapePopup.cancel);
$("#popupShape").bind("onPopupCancel", onShapeCancel);
$("#popupShape").bind("onPopupCommit", onShapeOk);
$("#btnShapePlus").on("onButtonHold",onShapePlus); $("#btnShapePlus").on("onButtonHold",onShapePlus);
$("#btnShapeMin").on("onButtonHold",onShapeMin); $("#btnShapeMin").on("onButtonHold",onShapeMin);
updateShapePreview(); updateShapePreview();
shapePopup = new Popup($("#popupShape"), $("#popupMask"));
shapePopup.setEscapeKeyHandler(onShapeCancel);
shapePopup.setEnterKeyHandler(onShapeOk);
} }
function showShapeDialog() { function showShapeDialog() {
@ -18,12 +18,9 @@ function showShapeDialog() {
} }
function onShapeCancel() { function onShapeCancel() {
shapePopup.close();
} }
function onShapeOk() { function onShapeOk() {
shapePopup.close();
var res = shapeResolution; var res = shapeResolution;
if (res!=undefined) { if (res!=undefined) {

View File

@ -1,7 +1,5 @@
function Popup(element, mask) { function Popup(element, mask) {
var self = this; var self = this;
var escapeKeyHandler = null;
var enterKeyHandler = null;
this.open = function(complete, disableMaskClick) { this.open = function(complete, disableMaskClick) {
mask.fadeIn(POPUP_SHOW_DURATION); mask.fadeIn(POPUP_SHOW_DURATION);
@ -11,9 +9,9 @@ function Popup(element, mask) {
keyboardEscapeEnterEnabled = true; keyboardEscapeEnterEnabled = true;
document.body.removeEventListener('touchmove', prevent, false); document.body.removeEventListener('touchmove', prevent, false);
mask.bind("onButtonClick", function() { self.close() }); mask.bind("onButtonClick", self.cancel);
if (escapeKeyHandler) $(document).bind("onEscapeKey", escapeKeyHandler); $(document).bind("onEscapeKey", self.cancel);
if (enterKeyHandler) $(document).bind("onEnterKey", enterKeyHandler); $(document).bind("onEnterKey", self.commit);
} }
this.close = function(complete) { this.close = function(complete) {
@ -24,11 +22,18 @@ function Popup(element, mask) {
keyboardEscapeEnterEnabled = false; keyboardEscapeEnterEnabled = false;
document.body.addEventListener('touchmove', prevent, false); document.body.addEventListener('touchmove', prevent, false);
mask.unbind("onButtonClick"); mask.unbind("onButtonClick", self.cancel);
if (escapeKeyHandler) $(document).unbind("onEscapeKey", escapeKeyHandler); $(document).unbind("onEscapeKey", self.cancel);
if (enterKeyHandler) $(document).unbind("onEnterKey", enterKeyHandler); $(document).unbind("onEnterKey", self.commit);
} }
this.setEscapeKeyHandler = function(hnd) { escapeKeyHandler = hnd; } this.cancel = function() {
this.setEnterKeyHandler = function(hnd) { enterKeyHandler = hnd; } self.close();
$(element).trigger('onPopupCancel');
}
this.commit = function() {
self.close();
$(element).trigger('onPopupCommit');
}
} }

View File

@ -3,12 +3,12 @@ var wordArtPopup;
function initWordArt() { function initWordArt() {
$("body").append('<div id="svgfont" style="display:none"></div>'); $("body").append('<div id="svgfont" style="display:none"></div>');
$("#svgfont").load("img/font.svg?"); $("#svgfont").load("img/font.svg?");
$("#btnWordArtOk").on("onButtonClick",onWordArtOk);
$("#btnWordArtCancel").on("onButtonClick",onWordArtCancel);
wordArtPopup = new Popup($("#popupWordArt"),$("#popupMask")); wordArtPopup = new Popup($("#popupWordArt"),$("#popupMask"));
wordArtPopup.setEscapeKeyHandler(onWordArtCancel); $("#btnWordArtOk").on("onButtonClick",wordArtPopup.commit);
wordArtPopup.setEnterKeyHandler(onWordArtOk); $("#btnWordArtCancel").on("onButtonClick",wordArtPopup.cancel);
$("#popupWordArt").bind("onPopupCancel", onWordArtCancel);
$("#popupWordArt").bind("onPopupCommit", onWordArtOk);
} }
function showWordArtDialog() { function showWordArtDialog() {
@ -19,11 +19,11 @@ function showWordArtDialog() {
} }
function onWordArtCancel() { function onWordArtCancel() {
wordArtPopup.close(); $("#txtWordArt").blur();
} }
function onWordArtOk() { function onWordArtOk() {
wordArtPopup.close(); $("#txtWordArt").blur();
var s = $("#txtWordArt").val(); var s = $("#txtWordArt").val();
drawTextOnCanvas(s); drawTextOnCanvas(s);
} }