0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-12-03 13:34:56 +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:
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-cookie - Copyright (c) 2011, Klaus Hartl - MIT or GPLv2
jQuery-coolfieldset - Copyright (c) 2010 Lucky <bogeyman2007@gmail.com> - GPL

View File

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

View File

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

View File

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