Esempio n. 1
0
    virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
        for (Draw** iter = fList.begin(); iter < fList.end(); iter++) {
            (*iter)->setSelected(false);
        }

        Click* c = new Click(this);
        Draw* d = this->hitTestList(x, y);
        if (d) {
            d->setSelected(true);
            c->setType("dragger");
        } else {
            c->setType("maker");
        }
        return c;
    }
Esempio n. 2
0
 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y,
                                           unsigned modi) override {
     lua_State* L = this->ensureLua();
     lua_getglobal(L, gClickName);
     if (lua_isfunction(L, -1)) {
         fLua->pushScalar(x);
         fLua->pushScalar(y);
         fLua->pushString("down");
         if (lua_pcall(L, 3, 1, 0) != LUA_OK) {
             SkDebugf("lua err: %s\n", lua_tostring(L, -1));
         } else {
             if (lua_isboolean(L, -1) && lua_toboolean(L, -1)) {
                 this->inval(NULL);
                 Click* c = new Click(this);
                 c->setType(gLuaClickHandlerName);
                 return c;
             }
         }
     }
     return this->INHERITED::onFindClickHandler(x, y, modi);
 }