click selects, second click pans, doubleclick zooms

This commit is contained in:
rolux 2011-05-27 13:55:48 +02:00
parent 419985c835
commit 453f226b18
2 changed files with 19 additions and 2 deletions

View file

@ -105,17 +105,24 @@ Ox.load('UI', {debug: true, hideScreen: true, showScreen: true, theme: 'modern'}
{name: 'Marie Curie', start: '1867-11-07', end: '1934-07-04', type: 'person'}, {name: 'Marie Curie', start: '1867-11-07', end: '1934-07-04', type: 'person'},
{name: 'Mahatma Gandhi', start: '1869-10-02', end: '1948-01-30', type: 'person'}, {name: 'Mahatma Gandhi', start: '1869-10-02', end: '1948-01-30', type: 'person'},
{name: 'Vladimir Lenin', start: '1870-04-22', end: '1924-01-21', type: 'person'}, {name: 'Vladimir Lenin', start: '1870-04-22', end: '1924-01-21', type: 'person'},
{name: 'Rosa Luxemburg', start: '1871-03-05', end: '1919-01-15', type: 'person'},
{name: 'Karl Liebknecht', start: '1871-08-13', end: '1919-01-15', type: 'person'},
{name: 'Winston Churchill', start: '1874-11-30', end: '1965-01-24', type: 'person'}, {name: 'Winston Churchill', start: '1874-11-30', end: '1965-01-24', type: 'person'},
{name: 'Mata Hari', start: '1876-08-07', end: '1917-10-15', type: 'person'},
{name: 'Lise Meitner', start: '1878-11-07', end: '1968-10-27', type: 'person'},
{name: 'Josef Stalin', start: '1878-12-18', end: '1953-03-05', type: 'person'}, {name: 'Josef Stalin', start: '1878-12-18', end: '1953-03-05', type: 'person'},
{name: 'Albert Einstein', start: '1879-03-14', end: '1955-04-18', type: 'person'}, {name: 'Albert Einstein', start: '1879-03-14', end: '1955-04-18', type: 'person'},
{name: 'Pablo Picasso', start: '1881-10-25', end: '1973-04-08', type: 'person'}, {name: 'Pablo Picasso', start: '1881-10-25', end: '1973-04-08', type: 'person'},
{name: 'Theodor Roosevelt', start: '1882-01-30', end: '1945-04-12', type: 'person'}, {name: 'Theodor Roosevelt', start: '1882-01-30', end: '1945-04-12', type: 'person'},
{name: 'James Joyce', start: '1882-02-02', end: '1941-01-13', type: 'person'}, {name: 'James Joyce', start: '1882-02-02', end: '1941-01-13', type: 'person'},
{name: 'Emmy Noether', start: '1882-03-23', end: '1935-04-14', type: 'person'},
{name: 'Franz Kafka', start: '1883-07-03', end: '1924-06-03', type: 'person'}, {name: 'Franz Kafka', start: '1883-07-03', end: '1924-06-03', type: 'person'},
{name: 'Adolf Hitler', start: '1889-04-20', end: '1945-04-30', type: 'person'}, {name: 'Adolf Hitler', start: '1889-04-20', end: '1945-04-30', type: 'person'},
{name: 'Charles de Gaulle', start: '1890-11-22', end: '1970-11-09', type: 'person'}, {name: 'Charles de Gaulle', start: '1890-11-22', end: '1970-11-09', type: 'person'},
{name: 'Walter Benjamin', start: '1892-07-15', end: '1940-09-26', type: 'person'}, {name: 'Walter Benjamin', start: '1892-07-15', end: '1940-09-26', type: 'person'},
{name: 'Mao Zedong', start: '1893-12-26', end: '1976-09-09', type: 'person'}, {name: 'Mao Zedong', start: '1893-12-26', end: '1976-09-09', type: 'person'},
{name: 'Antonin Artaud', start: '1896-09-04', end: '1948-03-04', type: 'person'},
{name: 'Bertolt Brecht', start: '1898-02-10', end: '1956-08-14', type: 'person'},
{name: 'Al Capone', start: '1899-01-17', end: '1947-01-25', type: 'person'}, {name: 'Al Capone', start: '1899-01-17', end: '1947-01-25', type: 'person'},
{name: 'Alfred Hitchcock', start: '1899-08-13', end: '1980-04-29', type: 'person'}, {name: 'Alfred Hitchcock', start: '1899-08-13', end: '1980-04-29', type: 'person'},
{name: 'Werner Heisenberg', start: '1901-12-05', end: '1976-02-01', type: 'person'}, {name: 'Werner Heisenberg', start: '1901-12-05', end: '1976-02-01', type: 'person'},
@ -159,6 +166,7 @@ Ox.load('UI', {debug: true, hideScreen: true, showScreen: true, theme: 'modern'}
{name: 'World Trade Center', start: '1973-04-04', end: '2001-09-11', type: 'place'}, {name: 'World Trade Center', start: '1973-04-04', end: '2001-09-11', type: 'place'},
{name: 'Stone Age', start: '-10000', end: '-3000', type: 'other'},
{name: 'Bronze Age', start: '-3000', end: '-1000', type: 'other'}, {name: 'Bronze Age', start: '-3000', end: '-1000', type: 'other'},
{name: 'Iron Age', start: '-1000', end: '500', type: 'other'}, {name: 'Iron Age', start: '-1000', end: '500', type: 'other'},
{name: 'Middle Ages', start: '500', end: '1350', type: 'other'}, {name: 'Middle Ages', start: '500', end: '1350', type: 'other'},

View file

@ -423,7 +423,12 @@ Ox.Calendar = function(options, self) {
} }
function doubleclick(event, e) { function doubleclick(event, e) {
if ($(e.target).is(':not(.OxLine > .OxEvent)')) { var $target = $(e.target),
id = $target.data('id');
if ($target.is('.OxLine > .OxEvent')) {
selectEvent(id, $target);
zoomToSelected();
} else {
if (self.options.zoom < self.maxZoom) { if (self.options.zoom < self.maxZoom) {
self.options.date = new Date( self.options.date = new Date(
(+self.options.date + +getMouseDate(e)) / 2 (+self.options.date + +getMouseDate(e)) / 2
@ -969,7 +974,11 @@ Ox.Calendar = function(options, self) {
var $target = $(e.target), var $target = $(e.target),
id = $target.data('id'); id = $target.data('id');
if ($target.is('.OxLine > .OxEvent')) { if ($target.is('.OxLine > .OxEvent')) {
if (id == self.options.selected) {
panToSelected();
} else {
selectEvent(id, $target); selectEvent(id, $target);
}
} else { } else {
selectEvent(''); selectEvent('');
panTo(getMouseDate(e)); panTo(getMouseDate(e));